With a strong type-system to define an API, GraphQL gives the specification of what exactly is needed through only one endpoint. It becomes front-end friendly and a good fit for complex systems or microservices.
Working with GraphQL API, you can use this URL https://api.nimvio.com to access the API. You may also require Environment ID and Content ID to do so. By default, this API provides you with a default response structure. However, you are allowed to customize it as well. The following guides will then help you to work with each type of endpoint.
You can retrieve the default response by setting the request body as below.
query {
content(){
}
}
The response will be as in the following example.
{
"status": 200,
"data": {
"Status": "Published",
"CreatedBy": "Erian Suwandi",
"CreatedAt": "2021-04-23T03:24:17.851Z",
"Data": {
"title": "New Blog"
},
"PublishedBy": "Erian Suwandi",
"UpdatedAt": "2021-05-10T06:21:28.079Z",
"Name": "Blog",
"PublishedAt": "2021-05-10T06:21:28.079Z",
"UpdatedBy": "Erian Suwandi",
"TemplateName": "Blog",
"TemplateID": "Template_64a5416f-3255-4b2f-b2fd-f86100418eb8",
"ContentID": "Content_eaea0b46-f440-438c-9c26-92f4006ae03a"
}
}
You can retrieve custom responses by using a specific query. Below is an example of the query.
query {
content(){
Name,
ContentID
}
}
The response will be as in the following example.
{
"status": 200,
"data": {
"Name": "Blog",
"ContentID": "Content_eaea0b46-f440-438c-9c26-92f4006ae03a"
}
}
GraphQL API also provides filtering features that can be done from the query to search certain content with specific fields.
Below is an example of the query.
query {
content(pageSize: 3, page: 1, sortAsc: true ){
Name
}
}
The response will be as in the following example.
{
"status": 200,
"data": [
{
"Name": "1"
},
{
"Name": "a"
},
{
"Name": "3"
}
],
"totalItems": 3
}
Below is an example of the query.
query {
content(pageSize: 3, page: 1, sortAsc: true, PublishedBy: "Erian Suwandi" ){
Name,
ContentID,
PublishedBy
}
}
The response will be as in the following example.
{
"status": 200,
"data": [
{
"PublishedBy": "Erian Suwandi",
"Name": "1",
"ContentID": "Content_ef3959e2-188d-408d-8e2b-b6b5150e0caf"
}
],
"totalItems": 1
}
Below is an example of the query.
query {
content(pageSize: 3, page: 1, sortAsc: true, PublishedBy: "Erian", data: {desc: "lorem"} ){
Name,
ContentID,
Data,
PublishedBy
}
}
The response will be as in the following example.
{
"status": 200,
"data": [
{
"Data": {
"desc": "<p>lorem ipsum</p>",
"recommendation": {
"Type": "Reference",
"ReferenceType": "Content"
},
"asset": {
"Type": "Reference",
"ReferenceType": "Media"
}
},
"PublishedBy": "Erian Suwandi",
"Name": "3",
"ContentID": "Content_a056e3b6-cb5a-483a-8b09-6222d5fb2eb6"
}
],
"totalItems": 1
}
You can do a search based on the range for datetime field by referring to the table below.
Arguments |
Description |
Example |
get |
reater Gor Equals |
query { |
gt |
Greater Than |
query { |
lte |
Lower or Equals |
query { |
lt |
Lower Than |
query { |
With this endpoint, you can get a list of content items with specific query parameters. The details are shown in the table below. Be noted that Path Parameters are mandatory, while Query Parameters are dynamic as the query type above.
POST /cda/graphql/v1/{environment_id} | ||
Full URL https://api.nimvio.com/cda/graphql/v1/{environment_id} |
||
Path parameters |
Values |
Description |
environment_id |
Environment ID |
String |
Query parameters |
Values |
Description |
name |
Content name |
String |
templateName |
Content template name |
String |
status |
Content status |
String |
createdBy |
Content creator name |
String |
createdAt |
Content created date | String Use to request by specific content created date |
data |
Element or field of content |
String |
publishedBy |
Content published date |
String |
updatedBy |
Content editor name |
String |
contentID |
Content ID |
String |
templateID |
Template ID |
String |
page |
Page number |
String |
pageSize |
Page size |
Int |
sort |
Field Name |
String |
sortAsc |
true or false |
Boolean |
Responses |
Fields |
Description |
|
status |
The HTTP response status |
|
data |
The content items’s system properties |
|
totalItems |
The total of content items |
|
data.Status |
The content items’s status |
|
data.CreatedBy |
The content items’s creator name |
|
data.CreatedAt |
The content items’s created date |
|
data.Data |
The content’s element or field with its value |
|
data.PublishedBy |
The content items’s publisher name |
|
data.UpdatedAt |
The content items’s updated date |
|
data.Name |
The content items’s name |
|
data.PublishedAt |
The content items’s published date |
|
data.UpdatedBy |
The content items’s editor name |
|
data.TemplateName |
The content items’s template name |
|
data.TemplateID |
The content items’s template ID |
|
data.ContentID |
The content items’s ID |
The below is a response example when using application/json as the content-type.
{
"status": 200,
"data": [
{
"Status": "Published",
"CreatedBy": "Erian Suwandi",
"CreatedAt": "2021-04-23T03:24:17.851Z",
"Data": {
"title": "New Blog"
},
"PublishedBy": "Erian Suwandi",
"UpdatedAt": "2021-05-10T06:21:28.079Z",
"Name": "Blog",
"PublishedAt": "2021-05-10T06:21:28.079Z",
"UpdatedBy": "Erian Suwandi",
"TemplateName": "Blog",
"TemplateID": "Template_64a5416f-3255-4b2f-b2fd-f86100418eb8",
"ContentID": "Content_eaea0b46-f440-438c-9c26-92f4006ae03a"
}
],
"totalItems": 1
}
Congratulations! You have finished the guide. Keep exploring below: