Introduction to Authentication
Making a request to Skylark
Skylark's API uses GraphQL, and as such all requests are made via POST
requests.
It currently requires an API key to be supplied in the header Authorization
.
When you create a Skylark account you will be issued with 4 API keys for different roles, each with a different set of permissions.
Account Permissions
Different levels of permission are required to access certain queries, mutations and features in the Skylark API.
The permissions in Skylark are:
Permission | Explainer |
---|---|
READ | This permission gives access to the Query type except any query that relate to self configuration, such as getObjectConfiguration . |
WRITE | This permission gives access to the Mutation type except any mutation that related to self configuration, such as createObjectConfiguration . |
SELF_CONFIG | This permission gives access to all queries and mutations that relate to data model self configuration. |
IGNORE_AVAILABILITY | This permission, in connection with the READ permission, allows use of the ignore_availability argument when querying. |
TIME_TRAVEL | This permission, in connection with the READ permission, allows use of the x-time-travel header when querying. |
ACCOUNT_SETUP | This permisison is used for reading and writing certain objects that relate to account configuration. This includes setting up playback/DRM providers, playback URL templates, and playback details. |
Roles
The roles that are provided each contain a set of different permissions.
Role | Permissions | Example Token |
---|---|---|
READ_ONLY | READ | skylark-read-only-KujUUrSQZU-PVHIPmLJUX8mtZeDR5t-OF7TuwiEnrQM |
READ_WRITE | READ , WRITE | skylark-read-write-dU09OM6uRIzGlN-y4Zym1majgnzss26dOJFWKzyT6FI |
EDITOR | READ , WRITE , IGNORE_AVAILABILITY , TIME_TRAVEL | skylark-editor-2MiHfUIOjXU3bq3KmwlEGmnso9XXQodioE2tqfsrpWA |
ADMIN | READ , WRITE , IGNORE_AVAILABILITY , TIME_TRAVEL , SELF_CONFIG , ACCOUNT_SETUP | skylark-admin-vwvmMNJBClMLMHCKYF9EhPXPU8sJac9d9dMiOh1f3DI |
Example
In this example we're performing an authenticated listEpisode request:
curl --location --request POST '<GraphQL URL>' \
--header 'Authorization: <API KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{"query":"{listEpisode {objects {title}}}","variables":{}}'
var myHeaders = new Headers();
myHeaders.append("Authorization", "<API KEY>");
myHeaders.append("Content-Type", "application/json");
var graphql = JSON.stringify({
query: '{"query":"{listEpisode {objects {title}}}","variables":{}',
variables: {}
})
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: graphql,
redirect: 'follow'
};
fetch("<GraphQL URL>", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
import requests
import json
url = '<GraphQL URL>'
payload={'query': '{listEpisode {objects {title}}}'}
headers = {
'Authorization': '<API KEY>',
'Content-Type': 'application/json'
}
response = requests.request('POST', url, headers=headers, data=json.dumps(payload))
print(response.text)
Updated about 2 months ago