The Tipe docs Developer Hub

Welcome to the Tipe docs developer hub. You'll find comprehensive guides and documentation to help you start working with Tipe docs as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

GraphQL

Request a simple query

You can use GraphQL for getting your content into your app.

Make a GraphQL call

Our GraphQL endpoint is here:

https://api.tipe.io/graphql

As our API uses GraphQL you can use any JavaScript GraphQL client such as Apollo, graphql-request, Lokka, or even a fetch() or curl request.

Make sure to replace YOUR_ORG_SECRET_KEY, YOUR_API_KEY, and YOUR_FOLDER_ID with the ones in your Tipe dashboard.

Additionally, include the necessary Headers on each request:

Content-Type: application/json
Authorization: YOUR_API_KEY
Tipe-Id: YOUR_ORG_SECRET_KEY

A GraphQL request

To make a GraphQL GET request, you need four parts to your request:

  1. The URL of the GraphQL end point (that's your app)
  2. The HTTP verb, in this case GET
  3. The content type, for example application/json
  4. The data that's being sent

To make a GraphQL request with Tipe, model it after the following:

import { request } from 'graphql-request'

var YOUR_FOLDER_ID = ''
var YOUR_ORG_SECRET_KEY = ''
var YOUR_API_KEY = ''

var client = new GraphQLClient('https://api.tipe.io/graphql, {
  headers: {
    'Content-Type': 'application/json',
    'Authorization': YOUR_API_KEY,
    'Tipe-Id': YOUR_ORG_SECRET_KEY
  },
})

var variables = { id: YOUR_FOLDER_ID }
var query = `
query API($id: ID!) {
  Folder(id: $id) {
    id
    name
  }
}
`

client.request(query, variables)
  .then(function (data) {
    console.log(data)
  })

For more information on GraphQL requests, check out 4 simple ways to call a GraphQL API.

Using window.fetch()

You can make GraphQL calls using the window.fetch() API to make requests for Document, Templates, and Folders.

Use window.fetch() with two arguments; the URL and options, fetch(url, options). The fetch() method will then return a promise with a response object that contains metadata about the response object. With the options parameter, you can pass in an object as the argument such asset the method you want to use, set the HTTP header, and set the body of the request. For example, as the options argument, you can define a mode as follows:

fetch('http://www...', {mode: 'same-origin'})

If using fetch(), model it after the following:

var YOUR_FOLDER_ID = ''
var YOUR_ORG_SECRET_KEY = ''
var YOUR_API_KEY = ''

var variables = { id: YOUR_FOLDER_ID }
var query = `
query API($id: ID!) {
  Folder(id: $id) {
    id
    name
  }
}
`

window.fetch('https://api.tipe.io/graphql', {
  method: 'post',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': YOUR_API_KEY,
    'Tipe-Id': YOUR_ORG_SECRET_KEY
  },
  body: JSON.stringify({ query: query, variables: variables })
})
  .then(function (res) { return res.json() })
  .then(function (data) {
    console.log(data)
  })

The window.fetch() method is easy for one time calls, but if you're going to be making multiple calls, consider using a GraphQL client instead.

For more information on window.fetch(), see the Google Developers article Introduction to fetch().

Making a curl request

Your curl request should be modeled after the following:

curl 'https://api.tipe.io/graphql' \
 -H 'content-type: application/json' \
 -H 'authorization: YOUR_API_KEY' \
 -H 'tipe-id: YOUR_ORG_SECRET_KEY' \
 --data-binary '{"query":"{ Folder(id: "YOUR_FOLDER_ID") {id name} }"}' \
 --compressed

Go further

Check out how to GET Documents with GraphQL.

GraphQL

Request a simple query