Developers

Build with Gitana through its API, an HTTPS endpoint that uses OAuth 2.0, or through a driver for your language.

Start here

1. Get your API Keys

Copy them from the API Keys page of your platform or project. No tenant yet? Request an evaluation.

2. Read a node

You also need the IDs of the node you want to read. Open a piece of content in your project and click View in API. The address of the page that opens contains all three:

/proxy/repositories/{repositoryId}/branches/{branchId}/nodes/{nodeId}

Fill in your keys and IDs, then run this script. It needs curl and jq.

API=https://api.cloudcms.com

# your API keys
CLIENT_KEY=
CLIENT_SECRET=
USERNAME=
PASSWORD=

# the node to read
REPOSITORY_ID=
BRANCH_ID=master
NODE_ID=

# sign in
TOKEN=$(curl -fsS -u "$CLIENT_KEY:$CLIENT_SECRET" \
  --data-urlencode "grant_type=password" \
  --data-urlencode "username=$USERNAME" \
  --data-urlencode "password=$PASSWORD" \
  "$API/oauth/token" | jq -r '.access_token // empty')

# read the node from its branch, with its changeset
if [ -n "$TOKEN" ]; then
  curl -fsS -H "Authorization: Bearer $TOKEN" \
    "$API/repositories/$REPOSITORY_ID/branches/$BRANCH_ID/nodes/$NODE_ID?metadata=true"
else
  echo "Sign-in failed. Check your four API keys and the API address." >&2
fi

The node comes back as JSON. This example is shortened:

{
    "_doc": "d0977d2194dfcb8eec61",
    "_type": "my:article",
    "_qname": "o:d0977d2194dfcb8eec61",
    "title": "Hello World",
    "_system": {
        "changeset": "40:84e03c7bbb4813a2e16e"
    }
}

_doc is the node's ID. Every node is versioned, so _system names the changeset it is on.

Self-managed installations use their own address in place of api.cloudcms.com.

3. Build with a driver

Pick the driver for your stack below, then follow its cookbook.

Drivers

Drivers sign in, keep the session and make API calls from your language.

Frameworks and tools

Examples to use as a starting point for your own project.

Work with the API

  • API guide: requests, formats, pagination and limits
  • API Explorer: try calls in your browser
  • Reference: data stores, objects and types
  • GraphQL: query a branch for the shape of content you need
  • Authentication: OAuth 2.0 tokens and grant types
  • Command line: work with projects, applications and data stores from a terminal

Extend Gitana