GraphQL API Examples
Examples for how to use Objects Grid GraphQL API
Create an Access Token example
GraphiQL Query and Headers sections:
mutation CreateAccessToken{
createUserAccountAccessToken(input: {
grant_type: "urn:ietf:params:oauth:grant-type:token-exchange"
subject_token: "your id token here, use https://admin.objectsgrid.com/google_token.html to get one"
subject_token_type: "urn:ietf:params:oauth:token-type:id_token"
client_id: "your organization account id org-???-????"
}){
access_token
token_type
expires_in
refresh_token
}
}
{
"X-ObjectsGrid-Accesspoint": "EU"
}
You should get back:
{
"data": {
"createUserAccountAccessToken": {
"access_token": "newly created access token for you to use to call all OG APIs",
"token_type": "Bearer",
"expires_in": 14399,
"refresh_token": "newly created refresh token for you"
}
}
List Generic Objects
GraphiQL Query and Headers sections:
query listGenericObjects {
genericObjects(from: 1, size: 5) {
id
namespace
stringAttributes{
name
val
}
}
}
{
"X-ObjectsGrid-Accesspoint": "EU",
"Authorization": "Bearer your_access_token_obtained_above"
}
You should get back:
{
"data": {
"genericObjects": [
{
"id": "095567a3-bf9b-4d58-88b9-becf65725902",
"namespace": "com.objectsgrid.test",
"stringAttributes": [
{
"name": "Attr1",
"val": "val1"
},
{
"name": "Attr2",
"val": "val2"
}
]
},
{
"id": "61af808a-9bac-4593-b73e-cf1a2e0d189b",
"namespace": "com.objectsgrid.test",
"stringAttributes": [
{
"name": "Attr1",
"val": "val1"
},
{
"name": "Attr2",
"val": "val2"
}
]
},
{
"id": "4cc66522-8a9f-4e45-b7e2-d0908158f015",
"namespace": "com.objectsgrid.test",
"stringAttributes": [
{
"name": "Attr1",
"val": "val1"
},
{
"name": "Attr2",
"val": "val2"
}
]
}
]
}
}
Last updated
Was this helpful?