API Connect

API Connect

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Publish product from postman

    Posted Tue October 03, 2023 10:45 AM

    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
    ------------------------------


  • 2.  RE: Publish product from postman

    Posted Wed October 04, 2023 05:06 AM

    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/
    ------------------------------



  • 3.  RE: Publish product from postman

    Posted Wed October 04, 2023 07:14 AM

    I saw this two request in the blog that seemed to be useful:

    • Publish a Product, from a file, direct to the Catalog bypassing creation in Drafts (run from the same directory as the files or use absolute paths as reference):

    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"

    • Publish a Product, from a file, direct to the Catalog bypassing creation in Drafts with APIs which include WSDLs:

    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
    ------------------------------



  • 4.  RE: Publish product from postman

    Posted Wed October 04, 2023 07:33 AM

    A Draft Product is a product that exists in the Develop section of the API Manager UI.

    You can create Draft Products and APIs either directly in the API Manager UI or you can build them using the Provider-API (see my Blog for how to do that - screenshot included here). Once you have Draft APIs / Products you can publish the Product:

    I don't fully follow what you are trying to achieve - what is the flow you need?



    ------------------------------
    Nick Cawood
    API Connect Consultant
    IBM Hybrid Cloud Integration Expert Labs
    IBM UK Ltd

    https://www.linkedin.com/in/nickcawood/
    ------------------------------