Usage
API EndpointLink copied!
There is a single endpoint for all requests to the GraphQL Asset Management API: https://api.amplience.net/graphql
AuthenticationLink copied!
CredentialsLink copied!
Amplience uses OAuth2 to authorize access to the GraphQL Asset Management API.
To use the API you will need an API key and secret. These credentials will be provided to you by Amplience at the beginning of your project, or you can request them from Amplience support. Your API key will define the resources to which you have access.
Your API key and secret are used to obtain an access token from the Amplience authorization service. This token must be included in the authorization header of all requests to the Asset Management API and is set to expire after a set time period, generally 300 seconds.
You can also use a personal access token instead of a token generated from an API key and secret to use the account management features of the API.
Note that for experimentation purposes, you can log in to the API Playground which will provide an authenticated call to the API
Getting an access tokenLink copied!
To get an authorization token, send a POST
request to the Amplience authorization server at https://auth.amplience.net as follows.
RequestLink copied!
Auth HeadersLink copied!
Header | Description |
---|---|
Content-Type | application/x-www-form-urlencoded |
Auth ParametersLink copied!
The parameters should be URL encoded and included in the body of the request:
Replace {yourclientid}
and {yoursecret}
with your client id and secret.
Parameter | Description |
---|---|
client_id | The client id (API key) provided to you by Amplience |
client_secret | The client secret provided to you by Amplience |
grant_type | Set this to client_credentials to specify that the authorization token should be generated based on the client ID and secret |
ResponseLink copied!
Auth Status codesLink copied!
Status code | Description |
---|---|
200 | OK. Credentials are valid. |
400 | Bad Request. client id or secret are not valid. |
Auth Response bodyLink copied!
If the client_id
and client_secret
are valid, the response body will be returned as in the example below. Note that the example access_token
has been truncated.
You will need to save the access token and include it in requests to the API. If the token has expired, request another token from the authorization service.
Including the token in an API requestLink copied!
To make a request to the GraphQL Asset Management API, you would send a request to API endpoint:
In the request header you must set the Authorization
format to Bearer
and include the access_token
:
Replace access_token
with the access token returned by the authorization service.
If the access token is valid, then the request is processed and the response is returned.
MethodsLink copied!
Both POST
and GET
methods are supported.
The HTTPS POST
method is recommended. The query should be sent in the body of a POST
request.
The HTTPS GET
method requires that the query is included in the URL string using the ?query=
parameter.
Status codesLink copied!
Status code | Phrase | Description |
---|---|---|
200 | OK | Successful request |
400 | Bad Request | Non specific error with request. Usually due to an invalid query or mutation argument |
429 | Too many requests | A rate limit has been exceeded |
500 | Internal server error | Non specific error occurred on the server |
Error response formatLink copied!
If 400
(Bad request) error occurs, the response body contains a JSON object containing an errors array. This will contain the error type, a message field describing the error and a locations array stating where in the request body the error was found. Here is an example of an error due to a mistyped query:
Asset ingestionLink copied!
Assets can be ingested using the createAsset
mutation by specifying a URL path to the source asset. The source asset must be available via a publicly accessible URL.
Identifying ingestion requestsLink copied!
Ingestion requests from the Asset Management API can be identified by the user agent, which is sent in an HTTP request header:
Request header name | Request header value |
---|---|
User-Agent | amplience-dam-api/1.5.0 |
Note: The number suffixed to the header value is the current version number of the API, and this number is subject to change.