Skip to main content
Version: 2.0

Get set up to use GraphGrid's API

We encourage you to try out GraphGrid's API requests to learn more about the capabilities of GraphGrid. With that in mind, we've made API interactivity a easier by including shell variables in our example requests.

info

Learn better by seeing it done? Follow along with our API Shell Variable Setup video

Setup Shell Variables

Jump into Graphgrid's API quickly and easily by setting shell variables. GraphGrid Docs provides API requests that leverage the use of shell variables so that you can copy and paste each request without having to worry about filling in your hostname and/or auth token.

Here is an example of an API request that takes of advantage of all three shell variables you need to get the most out of the API docs:

curl --request POST \
--url "${API_BASE}/1.0/security/oauth/check_token" \
--header "Authorization: Basic ${BASIC_AUTH}
" \
--data "token=${BEARER_TOKEN}"

This request checks the status of a user's authorization token. There are three shell variables used in this request: API_BASE, BASIC_AUTH, and BEARER_TOKEN.

API_BASE should be set to the URL prefix related to the host root. For example, if you wanted to set the variable to use your local environment.

GraphGrid's API requests require an authorization header. GraphGrid Security uses basic authorization in a few instances, notably to generate a bearer authorization token to use with other GraphGrid endpoints.

The BASIC_AUTH shell variable should be set to the value of the generated basic auth header using client credentials. To generate a basic auth header, separate a client id and secret with a colon and then base64 encode them. Client credentials are configurable, however you may use the default values for a client id and secret:

'CLIENT_ID': 'a3847750f486bd931de26c6e683b1dc4'
'CLIENT_SECRET': '81a62cea53883f4a163a96355d47656e'

Find information on how to generate your authorization header here.

Lastly, the BEARER_TOKEN should be set to the user's authorization bearer token.

Putting it all together, setting your shell variables in terminal should look something like this:

API_BASE=http://localhost
BASIC_AUTH=YTM4NDc3NTBmNDg2YmQ5MzFkZTI2YzZlNjgzYjFkYzQ6ODFhNjJjZWE1Mzg4M2Y0YTE2M2E5NjM1NWQ0NzY1NmU=

BEARER_TOKEN=123abc45-6e78-9101-1a2b-123456abcdef

Now you are all set to test out any GraphGrid API endpoint using shell variables. To test it out, try running the check token request above. The variables should be substituted with what you just set them to and in conclusion return a successful response!