Using the API Endpoint

You can make requests to the TakeShape GraphQL API from your project endpoint:

https://api.takeshape.io/project/[the-projects-id]/graphql

Your request should include the API key you created as a Bearer Token. 

For a simple request using fetch set the body of the request as the GraphQL query.

const query = `
{
    getBookList {
        items {
            title
        }
    }
}
`;

fetch('https://api.takeshape.io/project/[THE-PROJECT-ID]/graphql', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer [GENERATED-API-KEY]'
  },
  body: JSON.stringify({query})
}).then(res => {
  return res.json();
}).then(json => {
  console.log(json)
});

The response will look like this:

{
    "data": {
        "getBookList": {
            "items": [
                {
                    "title": "Peter Pan"
                },
                {
                    "title": "The Lion, the Witch, and the Wardrobe"
                },
                {
                    "title": "Treasure Island"
                },
                {
                    "title": "Alice in Wonderland"
                }
            ]
        }
    }
}

Join us

Interested in joining the team as coworker or investor?

contact@takeshape.com