Using the API Gateway Archive REST APIs to search for and download assets

products versions - API Gateway versions 10.x and up

Introduction

The webMethods API Gateway provides a number of REST APIs for managing assets and the gateway itself. Among those is the Archive API, which exposes two resources to export and import an archive:

GET /rest/apigateway/archive: Retrieves the archive, which is a ZIP file that contains the selected assets and its dependent assets.

POST /rest/apigateway/archive: Imports the API Gateway archive as well as exports the assets as an archive.

The POST resource is pretty straightforward. Likewise, the GET resource, by default, takes a query string of the assets you want to archive, along with their associated options. This is all well and good, if you know the names of all the assets you want to archive. Fortunately, there is a way to use the same criteria from the Search API to create and download an archive in a single step.

Executing the GET resource using POST and the x-HTTP-Method-Override header

The API Gateway uses the x-HTTP-Method-Override header to execute a resource other than the one matching the HTTP method of the request. This allows you to, for example, execute the GET resource of a REST API while sending a payload using the POST method.

The payload

As previously mentioned, the Archive API takes the exact same search criteria in the payload as the Search API. So, for instance, if you want to download all of the threat protection policies from the gateway, you could specify it in the payload this way:

{
    "types": [
        "policy"
    ],
    "scope": {
        "attributeName": "stageKey",
        "keyword": "threatProtection"
    }
}

Similarly, to download all APIs that begin with “My” you could use this payload:

{
    "types": ["api"],
    "condition": "and",
    "scope": [{
        "attributeName": "apiName",
        "keyword": "My.*"
    }]
}

As you can see, using search criteria can add a lot of flexibility to the Archive API.

Next steps

If you would like to learn more about using Gateway APIs, our YouTube channel has a short video tutorial. If you haven’t already, sign up for a fully functional free trial . See for yourself why Software AG has been named a Leader in the 2022 Gartner® Magic Quadrant™ for Full Life Cycle API Management for the fifth consecutive year.

Useful links | Relevant resources

To help you get started, here are the Archive Service and Search Service Postman collections.

Archive API:
https://raw.githubusercontent.com/SoftwareAG/webmethods-api-gateway/master/apigatewayservices/postmancollections/apis/archive-service/ArchiveService.json

Search API:
https://raw.githubusercontent.com/SoftwareAG/webmethods-api-gateway/master/apigatewayservices/postmancollections/apis/search-service/SearchService.json

3 Likes

Thank you @Theodore_Ezell1,

  1. Are these APIs also applicable to the WM IO API GW? What would be the base URL and what has to be configured in the Cloud tenant to allow management via APIs?
  2. Do you have more articles on how a customer can manage the WM IO API GW Product via its APIs?
    I really appreciate any help you can provide,
    Aviv
1 Like

Hi Aviv. Yes, these APIs are all available on the WMIO API GW with no additional setup required. You just need a user with admin access. The base URL would be https://<tenant>/rest/apigateway/

I’m not aware of any additional articles, but the APIs and sample Postman collections can be found here: https://github.com/SoftwareAG/webmethods-api-gateway/tree/master/apigatewayservices

2 Likes