API Platform API

(4 reviews)

Query API platform applications

Let's work with the API Platform API. In the notebook, APIs are driven by RAML files (more about RAML). RAML files define an API's endpoints and expected parameters.

In this short example, we will create an aggregated report of applications. For each application, this data is stored:
+ a name
+ owner's name
+ owner's email address
+ a list of all APIs that the application is registered for. For each such contract, the following data is obtained:
+ a name
+ a version
+ a tier

To create an API client in a notebook, we use the built-in API.createClient method:

To authenticate an API client in the notebook, let us use another built-in API.authenticate function:

You will be prompted to enter an API name.

Now we obtain the active organization

We retrieve the API by its name

The array of all contracts (applications that requested access) for the given API is retrieved:

The applications map, as an application can be registered for multiple API versions, will hold all applications that requested the access to the given api.

The map of all applications for the given API is retrieved:

The array of all APIs belonging to the user is retrieved:

Now we will iterate through all our apps. We are going to find all APIs to which the apps requested the access. An API name, a version and a tier name are extracted.

Finally, we print the aggregated report of all applications:


Reviews