Layerise

Docs

Layerise Organisation API

Organisation API enables developers to access organisation data and build amazing experiences fast and with scale. This guide will assist you to integrate Layerise Organisation API.

Using the the API's is easy and made available programmatically via. GraphQL-compliant API.

What is GraphQl?

GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data. GraphQL provides a complete and understandable description of the data in your API, gives clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs over time, and enables powerful developer tools.

We recommend using GraphQL Playground hosted by us to model queries, refer Schema & testing locally.

Pre-Requisites & Authentication

Authentication to Layerise Organisation API is done by setting a HTTP header organisationSecret token. The token is available in Layerise Admin.

Playground HTTP Header

When using the GraphQL Playground you have to declare your API Token in the HTTP Headers. If you do not add or miss spell your token you will not be able to query your data and a 401 error (Response not successful: Received status code 401) will be displayed.

{
  	"organisationSecret": "your-token-available-at-layerise-admin"
}
Reference cURL request
curl -X POST -H "Content-Type: application/json" -H "organisationSecret: <your-token-available-at-layerise-admin>" -d '{ "query": "<query>" }' https://api.layerise.com
Reference Javascript request
const response = await fetch("https://api.layerise.com", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Accept: "application/json",
    organisationSecret: "<your-token-available-at-layerise-admin>"
  },
  body: JSON.stringify({ query: "<query>" })
});
const data = await response.json();

Query Endpoints

Layerise Organisation API exposes following query endpoints,

  • Products
  • Experiences
  • Languages
  • Highlights
  • Topics
  • TopicCategories
  • ReminderSchemas

Each of the above endpoint can use following clauses,

  • where
  • orderBy
  • skip
  • after
  • before
  • first
  • last
Filter Data using where clause
{
 products(where: { archive: true }) {
  id
  title
 }
}
Sort Data using orderBy clause
{
 topics(orderBy: createdAt_ASC) {
  id
  title
 }
}
Pagination using skip or after or before or first or last clause
{
 highlights(skip: 1) {
  id
  title
 }
}