In How to use your Vodori API schema we discussed how to use the out-of-the-box types with the Vodori API.
Here will explore how to use customer-specific types to retrieve custom properties and values from the Vodori API.
Assuming a customer has Promotional and Reference documents configured in their instance of Vodori, their schema.json file might resemble the image below.
In order to retrieve the customer-specific fields on the Promotional document, we'll need to use either the promotional or promotionalCollection types. Below we'll use promotionalCollection so that we can retrieve multiple results.
Selecting promotionalCollection displays the available properties.
From here, selecting PromotionalFilter will display the available properties on the filter. The sysFilter and fieldsFilter contain the same properties and postfixes as the sysFilter and fieldsFilter filters as the document and documentCollection queries. The dataFilter, shown with type of PromotionaldataFilter, will contain the customer-specific properties corresponding to the Promotional document in Vodori.
Available postfixes and Vodori label corresponding to the given property are also displayed here.
Given the schema above, the following query can be used to retrieve all Promotional documents with a Method of Dissemination of Salesforce.
Query
{
promotionalCollection(
skip: 0
limit: 1000
where: {
dataFilter: {
methodOfDissemination_in: ["SALESFORCE"]
}
}
sortBy: { sortableField: CREATED, orderDirection: ASC }
) {
skip
limit
total
nodes {
fields {
kind
}
sys {
documentId
}
data {
documentLanguage {
id
display
}
methodOfDissemination {
id
display
}
}
}
}
}Response
{
"data": {
"promotionalCollection": {
"skip": 0,
"limit": 1000,
"total": 2,
"nodes": [
{
"fields": {
"kind": "promotional"
},
"sys": {
"documentId": "1004-v1"
},
"data": {
"documentLanguage": {
"id": "ENGLISH",
"display": "English"
},
"methodOfDissemination": [
{
"id": "SALESFORCE",
"display": "Salesforce"
}
]
}
},
{
"fields": {
"kind": "promotional"
},
"sys": {
"documentId": "1009-v2"
},
"data": {
"documentLanguage": {
"id": "ENGLISH",
"display": "English"
},
"methodOfDissemination": [
{
"id": "SALESFORCE",
"display": "Salesforce"
}
]
}
}
]
}
}
}As with all GraphQL requests, the node definition in the query drives the schema of the response object. Additional properties can be included or omitted from the node definition to meet the requirements of the consuming application.
Comments
0 comments
Article is closed for comments.