Lesson 2: Request 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. You can obtain an API key from your customer success representative. This will also grant you access to the Skylark UI.

๐Ÿ“˜

Using the Skylark UI to build and execute GraphQL queries

The Skylark UI has been updated with a Developer Section that simplifies the process of querying your Skylark account.

With this feature, authenticated users can run queries directly from the UI, eliminating the need for a separate tool like Postman.

The query and mutation builder is easy to use and automatically populated with the schema of your account. This allows users to make any desired changes to both the data model and dataset.

For more information, visit our [UI guide] (https://help.skylarkplatform.com/en/)

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)

Whatโ€™s Next

Next: Learn about customising your schema