I saw this two request in the blog that seemed to be useful:
curl -v -k -X POST $mgmt-url/api/catalogs/{org}/{catalog}/publish -H 'Accept: application/json' -H "Authorization: Bearer $b" -H "content-type: multipart/form-data" -F "product=@theproduct_1.0.0.yaml;type=application/yaml" -F "openapi=@theapi_1.0.0.yaml;type=application/yaml"
curl -v -k -X POST $mgmt-url/api/catalogs/{org}/{catalog}/publish -H 'Accept: application/json' -H "Content-Type: multipart/form-data" -H "Authorization: Bearer $b" -F "product=@/directory/file/location/fromwsdlProduct_1.0.0.yaml;type=application/yaml" -F "openapi=@/directory/file/location/fromwsdlAPI_1.0.0.yaml;type=application/yaml" -F "wsdl=@/directory/file/location/Client-backend-system-WSDL.wsdl;type=application/wsdl"
I tried them, but the error persists. What I exactly need is to publish a product that already exists as draft. In this case, it creates and publishes directly from the request or from the file. Even filling out the product and the openapi with apparently correct data, I receive the same message: "When spaces are enabled for a catalog the product must be published to a space." Even if the catalog has no spaces enabled.
By the way, what is exactly the difference between publish the product-draft and publish the product? is it that with the draft you have the product done and you just publish it, while with the publish product you create everything from zero?
------------------------------
Jon Iturbe
------------------------------
Original Message:
Sent: Wed October 04, 2023 05:06 AM
From: Nick Cawood
Subject: Publish product from postman
Hi,
Is this blog helpful at all?
https://community.ibm.com/community/user/integration/blogs/nick-cawood/2023/02/23/api-connect-v10-provider-api-calls-api-lifecycle-c?CommunityKey=2106cca0-a9f9-45c6-9b28-01a28f4ce947
------------------------------
Nick Cawood
API Connect Consultant
IBM Hybrid Cloud Integration Expert Labs
IBM UK Ltd
https://www.linkedin.com/in/nickcawood/
Original Message:
Sent: Tue October 03, 2023 05:50 AM
From: Jon Iturbe
Subject: Publish product from postman
Hi all,
I'm trying to create the request for Publish Product (catalog scope) in API Connect V10 but I always get this response:
{
"status": 400,
"message": [
"The multipart 'product' field must contain a single product definition."
]
}
This is the kind if call I'm making in cURL following the indications I saw in this link:
curl --location 'https://apimserver.example.com/api/catalogs/<string>/<string>/publish' \
--header 'Content-Type: multipart/form-data; Boundary=<calculated when request is sent>' \
--header 'Accept: application/json' \--header 'Authorization: Bearer token'\
--form 'product="[{ \"product\": \"1.0.0\", \"info\": { \"name\": \"addingnewproductfrompostmanjustchecking\", \"version\": \"1.0.0\" } }]"' \
--form 'openapi="[object Object],[object Object]"'
I'm not sure if I'm getting the flow of the products correctly. But I recieve the error above or this other one:
"When spaces are enabled for a catalog the product must be published to a space."
I was able to do the request in the space scope as this link shows:
but also need to do it with the catalog scope way. I've been looking for blogs and forums to understand the products flow and trying to achieve the correct request, but I can't find how. I would be grateful to get some help.
Thanks in advance!
------------------------------
Jon Iturbe
------------------------------