GraphQL API Examples
Examples for how to use Objects Grid GraphQL API
Last updated
Was this helpful?
Examples for how to use Objects Grid GraphQL API
Last updated
Was this helpful?
For GraphiQL Playground go to
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"
}
}
GraphiQL Query and Headers sections:
mutation CreateGenericObject{
createGenericObject(
input: {
objectID: "yourObjectID",
namespace: "yourNamespace",
objectType: "yourObjectType"
})
{
id,
objectID,
namespace,
objectType,
meta{
objectVersion
createdAt,
createdBy
}
}
}
{
"X-ObjectsGrid-Accesspoint": "EU",
"Authorization": "Bearer your_access_token_obtained_above"
}
You should get back something close to:
{
"data": {
"createGenericObject": {
"id": "e4955322-d835-4b25-93c3-133fca2ba9f7",
"objectID": "object-10003",
"namespace": "namespace",
"objectType": "product",
"meta": {
"objectVersion": 1744788743359810,
"createdAt": "2025-04-16T07:32:23.093716032Z",
"createdBy": "56228ff2-1034-43b0-8c66-9fb1bfdb1910"
}
}
}
}
GraphiQL Query and Headers sections:
query RetrieveGenericObject {
genericObject(id: "e4955322-d835-4b25-93c3-133fca2ba999"){
id,
objectID,
namespace,
objectType
}
}
{
"X-ObjectsGrid-Accesspoint": "EU",
"Authorization": "Bearer your_access_token_obtained_above"
}
You should get back something close to:
{
"data": {
"genericObject": {
"id": "e4955322-d835-4b25-93c3-133fca2ba999",
"objectID": "object-10003",
"namespace": "namespace",
"objectType": "product"
}
}
}
GraphiQL Query and Headers sections:
mutation UpdateGenericObject {
updateGenericObject(input: {
id: "e4955322-d835-4b25-93c3-133fca2ba999",
objectID: "object-10003",
namespace: "namespace",
objectType: "product",
stringAttributes: [
{
name: "name1",
val: "val1"
}
]
}){
id,
objectID,
namespace,
objectType
stringAttributes{
name,
val
}
}
}
{
"X-ObjectsGrid-Accesspoint": "EU",
"Authorization": "Bearer your_access_token_obtained_above"
}
You should get back something close to:
{
"data": {
"updateGenericObject": {
"id": "e4955322-d835-4b25-93c3-133fca2ba999",
"objectID": "object-10003",
"namespace": "namespace",
"objectType": "product",
"stringAttributes": [
{
"name": "name1",
"val": "val1"
}
]
}
}
}
GraphiQL Query and Headers sections:
mutation DeleteGenericObject {
deleteGenericObject(id: "e4955322-d835-4b25-93c3-133fca2ba999")
}
{
"X-ObjectsGrid-Accesspoint": "EU",
"Authorization": "Bearer your_access_token_obtained_above"
}
You should get back:
{
"data": {
"deleteGenericObject": true
}
}
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"
}
]
}
]
}
}
GraphiQL Query and Headers sections:
mutation CreateEnumStringLocalized {
createEnumStringLocalized(
input:{
id: "id234",
description: "description",
disabled: false,
values:[
{
key: "key1",
val: [
{
language: "en",
value: "val en"
},
{
language: "de",
value: "val de"
}
],
order: 1
},
{
key: "key2",
val: [
{
language: "en",
value: "val en"
},
{
language: "de",
value: "val de"
}
],
order: 2
}
],
tags: [
{
name: "Attr1",
val: "val1"
},
{
name: "Attr2",
val: "val2"
}
]
}
){
id
description
values{
key
val{
language
value
}
}
disabled
tags{
name
val
}
meta{
createdBy
createdAt
objectType
}
}
}
{
"X-ObjectsGrid-Accesspoint": "EU",
"Authorization": "Bearer your_access_token_obtained_above"
}
GraphiQL Query and Headers sections:
query RetrieveEnumStringLocalized {
enumStringLocalizedByID(id: "id234"){
id
description
values{
key
val{
language
value
}
}
disabled
tags{
name
val
}
meta{
createdBy
createdAt
objectType
}
}
}
{
"X-ObjectsGrid-Accesspoint": "EU",
"Authorization": "Bearer your_access_token_obtained_above"
}
GraphiQL Query and Headers sections:
mutation UpdateEnumStringLocalized {
updateEnumStringLocalized(
input:{
id: "id234",
description: "description UPDATED",
disabled: false,
values:[
{
key: "key1",
val: [
{
language: "en",
value: "val en"
},
{
language: "de",
value: "val de"
}
],
order: 1
},
{
key: "key2",
val: [
{
language: "en",
value: "val en"
},
{
language: "de",
value: "val de"
}
],
order: 2
}
],
tags: [
{
name: "Attr1",
val: "val1"
},
{
name: "Attr2",
val: "val2"
}
]
}
){
id
description
values{
key
val{
language
value
}
}
disabled
tags{
name
val
}
meta{
createdBy
createdAt
objectType
}
}
}
{
"X-ObjectsGrid-Accesspoint": "EU",
"Authorization": "Bearer your_access_token_obtained_above"
}
GraphiQL Query and Headers sections:
mutation DeleteEnumStringLocalized {
deleteEnumStringLocalized(id: "id234")
}
{
"X-ObjectsGrid-Accesspoint": "EU",
"Authorization": "Bearer your_access_token_obtained_above"
}
You should get back "true":
{
"data": {
"deleteEnumStringLocalized": true
}
}
GraphiQL Query and Headers sections:
query listEnums{
enums
}
{
"X-ObjectsGrid-Accesspoint": "EU",
"Authorization": "Bearer your_access_token_obtained_above"
}
You should get back an array of Enums IDs:
{
"data": {
"enums": [
"id123",
"id124",
"id125",
"myEnum1"
]
}
}