On this page you will learn in detail about the diferents queries you can perform in our GraphQL server.
The following resources can be queried
The getOrder query returns the order information given an specific id.
query($id: ID!){
getOrder(id: $id){
id
number
status
urgency
totalPrice
shippedAt
dueDate
createdAt
updatedAt
}
}
(and a query variable like { “id”: “ckip2fskk11681zqp8u4tcdmy” })
Response: order information given an id
{
"data": {
"getOrder": {
"id": "ckip2fskk11681zqp8u4tcdmy",
"number": 4,
"status": "NEW",
"urgency": 2,
"totalPrice": 4.5,
"shippedAt": null,
"externalNotes1": "No external note",
"externalNotes2": "No external note",
"dueDate": "2020-12-10T02:31:30.900Z",
"createdAt": "2020-12-14T21:25:14.468Z",
"updatedAt": "2020-12-14T21:25:14.469Z"
}
}
}
The getOrderByNumber query finds with a given order number and returns his information.
query{
getOrderByNumber(number: 1){
id
number
status
urgency
totalPrice
shippedAt
externalNotes1
dueDate
}
}
Response:
{
"data": {
"getOrderByNumber": {
"id": "ckidq5df00010b0dyc8jw06gv",
"number": 1,
"status": "NEW",
"urgency": 0,
"totalPrice": 890,
"shippedAt": null,
"externalNotes1": "",
"dueDate": "2020-12-10T02:31:30.900Z"
}
}
}
The getAllOrders query returns all orders, you can also get the total count of orders.
query{
getAllOrders{
totalCount
items{
id
number
status
}
}
}
Response:
{
"data": {
"getAllOrders": {
"totalCount": 3,
"items": [
{
"id": "ckip2fskk11681zqp8u4tcdmy",
"number": 4,
"status": "ACCEPTED"
},
{
"id": "ckidq5eg80026b0dy02rextlu",
"number": 3,
"status": "QUOTE_REQUESTED"
},
{
"id": "ckidq5eg80027b0dyr9yfyf03",
"number": 2,
"status": "COLLECTED"
}
]
}
}
A simple query that returns the highest order number available in the list.
query{
getHighestOrderNumber
}
Response:
{
"data": {
"getHighestOrderNumber": 4
}
}
The getAllCustomers query returns all customers registered, in this query you can pass arguments like first, skip and search so you can better filter and get only the data you really want.
query{
getAllCustomers(first: 1){
totalCount
items{
id
name
email
phone
}
}
}
Response: All customers registered and total count .
The getCustomer query returns the latest customer information given the customer id.
query{
getCustomer(id: "ckidq5eg80028b0dyudw99rfi"){
id
name
email
phone
identificationNumber
personName
createdBy{
id
name
email
}
addresses{
id
street
number
}
}
}
Response: the customer information requested like id, name and email.
{
"data": {
"getCustomer": {
"id": "ckidq5eg80028b0dyudw99rfi",
"name": "Company Inc.",
"email": null,
"phone": null,
"identificationNumber": "1567984511",
"personName": "Jane Blue",
"createdBy": {
"id": "ckidq5cnd0000b0dywp3xevza",
"name": "Admin",
"email": "admin"
},
"addresses": []
}
}
}
The getAllMaterials query returns all materials available.
query{
getAllMaterials(deleted: false){
id
name
price
createdBy{
id
name
}
createdAt
updatedAt
}
}
Response: all materials listed.
{
"data": {
"getAllMaterials": [
{
"id": "ckidq5d250004b0dyil8vc4yq",
"name": "Banner 510",
"price": 150,
"createdBy": {
"id": "ckidq5cnd0000b0dywp3xevza",
"name": "Admin"
},
"createdAt": "2020-12-06T22:55:44.478Z",
"updatedAt": "2020-12-06T22:55:44.478Z"
}
]