Skip to main content

Sciforge API: Access with Application Keys

The prior module covered the generation of an Application Key (or AppKey). Now, it is time to learn to access the API endpoints.

The your AppKey and the associated Elab username, a JWT token is first generated, that can then be used to access the rest of the API.

The JWT token is set to expire after 1 hour.

Video: Application Key Usage

Generating a JWT token from your App Key and username.

Navigating to the SciForge API, you can enter the following query into the query editor.

mutation{LoginAppKeyJWT}

You will need to add the following to the HTTP Headers section of the query.

{
"elab-key-auth": "<APPKEY>",
"elab-user-name": "<USERNAME>"
}

Below is an example in the GraphQL editor

If successful this will generate a JWT Token for us to use in the instructions below. If the headers are not set correctly, or if the AppKey is incorrect, you will see the following response:

 

Using your JWT Token to Query the API

In the Playground add the following query to test.

query {
getCustomPkl(data:{PickListType:-1}){
PickListType,
PickListCode,
PickListDesc,
PickListValue
}
}

Then in the HTTP Headers add the following:

{
"x-auth-token":"<JWT_TOKEN>"
}

Below is an example for reference.

A successful query should return some data regarding picklists. If the query is not successful because the JWT was set incorrectly, you should see the following error: