Querying DX Graph Collections
Data residing in a DX Graph Collection can be fetched using one query (returning a maximum of 300 records) or using a cursor that allows for an unlimited number of records to be fetched using a series of queries.
Fetching with one query
POST https://io.conscia.ai/vue/_api/v1/collections/{{collectionCode}}/records/_query
content-type: application/json
Authorization: Bearer {{apiKey}}
X-Customer-Code: {{customerCode}}
Sample response
{
"data": [
{
"id": "001",
"first_name": "Beverley",
"last_name": "Williams"
},
{
"id": "002",
"first_name": "Florence",
"last_name": "Elaine"
},
]
}
Fetching using a cursor
POST https://io.conscia.ai/vue/_api/v1/collections/{{collectionCode}}/records/_scroll
content-type: application/json
Authorization: Bearer {{apiKey}}
X-Customer-Code: {{customerCode}}
{
}
Sample response
{
"scrollId": "01b72eb8-5316-4e65-af04-e6ada0ab8950",
"hasNext": true,
"data": [
...
]
}
Subsequent fetches are performed as follows (until hasNext
is false
):
POST https://io.conscia.ai/vue/_api/v1/collections/{{collectionCode}}/records/_scroll
content-type: application/json
Authorization: Bearer {{apiKey}}
X-Customer-Code: {{customerCode}}
{
"scrollId": "01b72eb8-5316-4e65-af04-e6ada0ab8950"
}
Sample response
{
"scrollId": "01b72eb8-5316-4e65-af04-e6ada0ab8950",
"hasNext": true,
"data": [
...
]
}
Fetching using a filter
POST https://io.conscia.ai/vue/_api/v1/collections/{{collectionCode}}/records/_scroll
content-type: application/json
Authorization: Bearer {{apiKey}}
X-Customer-Code: {{customerCode}}
{
"limit": 100,
"offset": 0,
"filter": {
"$and": [
{
"$gte": {
"field": "age",
"value": 40
}
},
{
"$eq": {
"field": "state",
"value": "NY"
}
}
]
}
}
Limiting the total number of records returned
POST https://io.conscia.ai/vue/_api/v1/collections/{{collectionCode}}/records/_scroll
content-type: application/json
Authorization: Bearer {{apiKey}}
X-Customer-Code: {{customerCode}}
{
"limit": 100,
"filter": {
"$and": [
{
"$gte": {
"field": "age",
"value": 40
}
},
{
"$eq": {
"field": "state",
"value": "NY"
}
}
]
}
}
Returning records from related Collections and specifying returned fields
By specifying recordLayoutConfig
, the response can include related Data Records (using related Collections) and return only the fields specified.
POST https://io.conscia.ai/vue/_api/v1/collections/{{collectionCode}}/records/_scroll
content-type: application/json
Authorization: Bearer {{apiKey}}
X-Customer-Code: {{customerCode}}
{
"limit": 100,
"filter": {
"$and": [
{
"$gte": {
"field": "age",
"value": 40
}
},
{
"$eq": {
"field": "state",
"value": "NY"
}
}
]
},
"options": {
"useMaterializedShadowFields": true,
"fieldsToReturn": ["first_name", "email_address"],
"recordLayoutConfig": {
"relationships": {
"familyMembers": {
"fieldsToReturn": ["first_name", "last_name"]
}
}
}
}
}
Once recordLayoutConfig
is specified, the structure of the response is slightly different to allow for each record to show its related records.
Sample response:
{
"scrollId": "54dd7753-7c28-4dbd-8a31-53de75d42ebf",
"hasNext": true,
"data": [
{
"values": {
"first_name": "Doug",
"email_address": "dd@gmail.com"
},
"relationships": {
"familyMembers": {
"entities": [
{
"values": {
"first_name": "David",
"last_name": "Ingram"
},
"relationships": null
},
{
"values": {
"app_installed": "Debra",
"avatar_updated": "Ceyrone"
},
"relationships": null
}
]
}
}
},
{
"values": {
"first_name": "Florence",
"email_address": "f_1968@gmail.com"
},
"relationships": {
"familyMembers": {
"entities": [
{
"values": {
"first_name": "Beverley",
"last_name": "Williams"
},
"relationships": null
},
{
"values": {
"app_installed": "Ayana",
"avatar_updated": "Wasim"
},
"relationships": null
}
]
}
}
}
]
}