For API plans, with the information you find in the Subscriptions section, you can start implementing the necessary API calls in your application.
Use an API tool like Postman or cURL-commands to try them out or to run a quick test.
The URL in the API calls must always include the https:// prefix, otherwise the API call will return a 404.
Consuming a Service
To consume a service via the apinity marketplace, you need to have a Consumer Client for the authentication of your requests (Please refer to Consumer Clients for more information).
The first necessary step for the usage of every Service is the authentication to the API gateway. The gateway handles the authentication to the service provider automatically.
The service provider may require additional authorization. In such case, API requests must carry two authorization tokens (one for the marketplace, and one for the provider). For more info, see the concept article about Authorization.
Depending on the authentication type, the connection can be established as described below.
Connecting with API Key
Necessary for implementation are these two values:
Endpoint URL: The Endpoint URL is the base URL for implementing every API Call. This is found in the Technical Setup of every subscribed API service under Subscriptions.
API Key: The key is generated while creating a consumer client, and can’t be retrieved again after the consumer client has been saved. If you misplace it, you will need to generate a new key or create a new consumer client.
Step 1: Login Call
The first necessary API call is the Login needed for authentication against the apinity marketplace.
For this, use a POST to https://api.marketplace.apinity.io/{EndpointURI}/login with the following body as raw JSON request:
{"api-key": “API_KEY”}
The key name in this JSON is always api-key, not the name of the consumer client.
The access token has a lifetime of exactly one year. Subsequent login calls within this period will return the same token. After expiry, a new login call is required.
Ending a subscription also invalidates the token as soon as the subscription expires.
Step 3: All further calls - input Authorization header in every header
Now you are ready to implement all further calls specified in the Swagger documentation by the service provider. For all these calls, these authorization values you received from the Login call should be sent as headers:
Necessary for implementation are these three values:
Endpoint URL: The Endpoint URL is the base URL for implementing every API call. This is found in the Technical Setup of every subscribed API service under Subscriptions.
Client Id: This is generated together with the consumer client and is necessary for Authentication. You can look it up by clicking “edit” on the respective consumer client in the Consumer Clients section.
Client Secret: The secret is generated together with the consumer client and can’t be retrieved again after the consumer client has been saved. If you misplace it, you will need to generate a new secret or create a new consumer client.
Step 1: Login Call
The first necessary API call is the Login needed for authentication against the apinity marketplace.
For this, use a POST to https://api.marketplace.apinity.io/{EndpointURI}/login with the following body as x-www-form-urlencoded request:
Step 3: All further calls - input Authorization header in every header
Now you are ready to implement all further calls specified in the Swagger documentation by the service provider. For all these calls, the authorization information you received should be sent as headers:
The OAuth2 tokens used by the marketplace expire after a while (time in seconds is specified in the /token endpoint response) and need to be refreshed by using the refresh token. Refreshing the token works by sending another POST request to the same endpoint: