Layer7 API Management

 View Only
  • 1.  Gateway API interacting with PAPI --- POST /api-management/1.0/apis/{apiUuid}/assets

    Posted Jul 21, 2021 06:02 PM
    Hello all,

    I am trying to write a Gateway service that helps our ServiceNow automation be able to upload a swagger document for an API.

    The issue I seem to be running into, is this PAPI endpoint only accepts 3 parameters, and the only way I can interact with this path in PAPI, is to use Postman UI to choose form-data content type and use the File "dropdown" feature to upload the file itself using the key of "files" and the value being the file itself.

    My question is, is there a way to handle this similar call within the Gateway? Either by submitting the file contents in Body, extract and generate a file of some sort, and then use that file as a formdata header in the routing assertion that is hitting PAPI? Or, is there a way to interact with this path in PAPI using multipart form data headers/boundaries instead of submitting a file?

    Thanks.

    Ex:
    Parameters
    Parameter Value Description Parameter Type Data Type
    apiUuid
    apiUuid path string
    files
    The Asset to upload. A REST API can have an optionally specified WADL, or Swagger JSON file. A SOAP API must have a WSDL specified for it as well as any optional XSDs. formData file
    filesToDelete
    The UUID of file to delete. Multiple UUIDs can be provided in separate parts. formData string


  • 2.  RE: Gateway API interacting with PAPI --- POST /api-management/1.0/apis/{apiUuid}/assets

    Broadcom Employee
    Posted Jul 22, 2021 06:40 AM
    Nathan,

    Check KB using CURL to upload swagger (json) file assets 

    Steve McQ



  • 3.  RE: Gateway API interacting with PAPI --- POST /api-management/1.0/apis/{apiUuid}/assets

    Posted Jul 22, 2021 11:50 AM
    Edited by nathan blumenthal Jul 22, 2021 11:51 AM
    Thank you for the reply and I came across this yesterday as well. I assume we must interact with this endpoint sending a file.

    Do you happen to know if we can support creating and attaching a file to interact with this PAPI endpoint, using Gateway assertions at the Gateway level? Like say the calling client calls into Gateway service sending swagger contents in Body... could we then use that to create a file or storing in memory some way and append to the outbound route to PAPI? 

    Thanks.


  • 4.  RE: Gateway API interacting with PAPI --- POST /api-management/1.0/apis/{apiUuid}/assets

    Broadcom Employee
    Posted Jul 22, 2021 12:55 PM
    Not OOB but GW flexible it probably could be done in policy but requires some work