Setup Queries - Reference Catalog
Use these queries to read the reference data you need before you place an order. Every request is a POST to the GraphQL endpoint, with Authorization: Bearer <token>.
Run them in this order when you set up an integration:
- Locations and price lists: Get Locations, Get Sale Price Categories.
- Products: Get Products by Sale Price Category or Get Products by Product Category.
- Addresses: Get Counties and Cities by Country, Get Streets by County.
- Customers and companies: Get Customer Categories, Get Company Categories, Get Customers with Addresses.
Pagination
List fields that return a connection (customer, products, streets, country, companies, orders, and others) accept cursor arguments: first, after, last, and before. They return totalCount, pageInfo, and items.
Query
query GetCustomersPage($first: Int, $after: String) {
customers {
customer(first: $first, after: $after, orderBy: LAST_NAME) {
totalCount
pageInfo {
hasNextPage
hasPreviousPage
startCursor
endCursor
}
items {
publicKey
firstName
lastName
mobilePhone
}
}
}
}Variables
{
"first": 50,
"after": null
}cURL
curl --location 'https://sandbox.expressoft.eu/connect/api/interopgql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{"query": "query GetCustomersPage($first: Int, $after: String) { customers { customer(first: $first, after: $after, orderBy: LAST_NAME) { totalCount pageInfo { hasNextPage hasPreviousPage startCursor endCursor } items { publicKey firstName lastName mobilePhone } } } }", "variables": {"first": 50, "after": null}}'To get the next page, send the endCursor of the previous response as after. Repeat until hasNextPage is false. The examples below omit the cursor arguments to stay short.
Get Customers with Addresses
Returns customers with their saved addresses, ordered by last name.
Query
query getCustomers {
customers {
customer(orderBy: LAST_NAME) {
totalCount
items {
publicKey
firstName
lastName
mobilePhone
addresses {
publicKey
streetName
streetNumber
buildingNumber
staircase
floor
intercom
landmark
roomNumber
}
}
}
}
}cURL
curl --location 'https://sandbox.expressoft.eu/connect/api/interopgql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{"query": "query getCustomers { customers { customer(orderBy: LAST_NAME) { totalCount items { publicKey firstName lastName mobilePhone addresses { publicKey streetName streetNumber buildingNumber staircase floor intercom landmark roomNumber } } } } }"}'Response
{
"data": {
"customers": {
"customer": {
"totalCount": 2,
"items": [
{
"publicKey": "00000000-0000-0000-0000-000000000001",
"firstName": "Jane",
"lastName": "Doe",
"mobilePhone": "0700000001",
"addresses": [
{
"publicKey": "00000000-0000-0000-0000-000000000011",
"streetName": "Sample Street",
"streetNumber": "12",
"buildingNumber": "B",
"staircase": "1",
"floor": "3",
"intercom": "30",
"landmark": "Next to the park",
"roomNumber": "9"
}
]
},
{
"publicKey": "00000000-0000-0000-0000-000000000002",
"firstName": "John",
"lastName": "Roe",
"mobilePhone": "0700000002",
"addresses": []
}
]
}
}
}
}Get Customer Categories
Returns the customer categories. Use a category publicKey when you create a customer.
Query
query getCustomerCategories {
customers {
customerCategories {
publicKey
name
}
}
}cURL
curl --location 'https://sandbox.expressoft.eu/connect/api/interopgql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{"query": "query getCustomerCategories { customers { customerCategories { publicKey name } } }"}'Response
{
"data": {
"customers": {
"customerCategories": [
{
"publicKey": "00000000-0000-0000-0000-000000000021",
"name": "Gold customers"
},
{
"publicKey": "00000000-0000-0000-0000-000000000022",
"name": "Silver customers"
}
]
}
}
}Get Counties and Cities by Country
Returns the counties, cities, and districts of a country. The country is filtered by name (the example uses Romania).
Query
query getCountiesAndCities {
organization {
country (name: "Romania") {
totalCount
items {
publicKey
name
county (orderBy: NAME) {
totalCount
items {
publicKey
name
city (orderBy: NAME) {
totalCount
items {
publicKey
name
districts {
publicKey
name
}
}
}
}
}
}
}
}
}cURL
curl --location 'https://sandbox.expressoft.eu/connect/api/interopgql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{"query": "query getCountiesAndCities { organization { country (name: \"Romania\") { totalCount items { publicKey name county (orderBy: NAME) { totalCount items { publicKey name city (orderBy: NAME) { totalCount items { publicKey name districts { publicKey name } } } } } } } } }"}'Response
{
"data": {
"organization": {
"country": {
"totalCount": 1,
"items": [
{
"publicKey": "00000000-0000-0000-0000-000000000031",
"name": "Romania",
"county": {
"totalCount": 42,
"items": [
{
"publicKey": "00000000-0000-0000-0000-000000000032",
"name": "Alba",
"city": {
"totalCount": 12,
"items": [
{
"publicKey": "00000000-0000-0000-0000-000000000033",
"name": "Abrud",
"districts": []
}
]
}
}
]
}
}
]
}
}
}
}Get Streets by County
Returns the streets of a county and city. Pass the publicKey values from the previous query.
Query
query getStreets ($county: Guid, $city: Guid)
{
organization {
streets(county: $county city:$city orderBy: NAME) {
items {
publicKey
name
active
startNumber
endNumber
city {
publicKey
name
}
district {
publicKey
name
}
}
}
}
}Variables
{
"county": "<countyKey>",
"city": "<cityKey>"
}cURL
curl --location 'https://sandbox.expressoft.eu/connect/api/interopgql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{"query": "query getStreets ($county: Guid, $city: Guid) { organization { streets(county: $county city:$city orderBy: NAME) { items { publicKey name active startNumber endNumber city { publicKey name } district { publicKey name } } } } }", "variables": {"county": "<countyKey>", "city": "<cityKey>"}}'Response
{
"data": {
"organization": {
"streets": {
"items": [
{
"publicKey": "00000000-0000-0000-0000-000000000041",
"name": "Sample Street",
"active": true,
"startNumber": 1,
"endNumber": 9999,
"city": {
"publicKey": "00000000-0000-0000-0000-000000000042",
"name": "Sector 1"
},
"district": null
}
]
}
}
}
}Use the street publicKey as streetKey when you add a customer address.
Get Locations
Returns the locations, with their availability and preparation time.
Query
query getLocation
{
organization {
locations
{
name
publicKey
active
city {
publicKey
name
}
county {
publicKey
name
}
country {
publicKey
name
}
available
preparationMinutes
}
}
}cURL
curl --location 'https://sandbox.expressoft.eu/connect/api/interopgql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{"query": "query getLocation { organization { locations { name publicKey active city { publicKey name } county { publicKey name } country { publicKey name } available preparationMinutes } } }"}'Response
{
"data": {
"organization": {
"locations": [
{
"name": "Downtown Restaurant",
"publicKey": "00000000-0000-0000-0000-000000000051",
"active": true,
"city": {
"publicKey": "00000000-0000-0000-0000-000000000042",
"name": "Sector 1"
},
"county": {
"publicKey": "00000000-0000-0000-0000-000000000052",
"name": "Bucuresti"
},
"country": {
"publicKey": "00000000-0000-0000-0000-000000000031",
"name": "Romania"
},
"available": true,
"preparationMinutes": 40
}
]
}
}
}Get Sale Price Categories
Returns the price lists (sale price categories). You need one when you read prices and when you create an order.
Query
{
products {
salePriceCategories {
publicKey
name
}
}
}cURL
curl --location 'https://sandbox.expressoft.eu/connect/api/interopgql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{"query": "{ products { salePriceCategories { publicKey name } } }"}'Response
{
"data": {
"products": {
"salePriceCategories": [
{
"publicKey": "00000000-0000-0000-0000-000000000061",
"name": "Standard price list"
},
{
"publicKey": "00000000-0000-0000-0000-000000000062",
"name": "Delivery"
}
]
}
}
}Get Products by Sale Price Category
Returns the products of a price list, with the price from that list.
Query
query getProducts ($salePriceCategory: Guid!) {
products {
products(salePriceCategory: $salePriceCategory) {
items {
publicKey
name
productCategory {
publicKey
name
}
measureUnit
salePrice
}
}
}
}Variables
{
"salePriceCategory": "<salePriceCategoryKey>"
}cURL
curl --location 'https://sandbox.expressoft.eu/connect/api/interopgql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{"query": "query getProducts ($salePriceCategory: Guid!) { products { products(salePriceCategory: $salePriceCategory) { items { publicKey name productCategory { publicKey name } measureUnit salePrice } } } }", "variables": {"salePriceCategory": "<salePriceCategoryKey>"}}'Response
{
"data": {
"products": {
"products": {
"items": [
{
"publicKey": "00000000-0000-0000-0000-000000000071",
"name": "Margherita Pizza",
"productCategory": {
"publicKey": "00000000-0000-0000-0000-000000000072",
"name": "Pizza"
},
"measureUnit": "portion",
"salePrice": 32.5
}
]
}
}
}
}Get Products by Product Category
Returns the products of a product category, with the price from a price list and the stock status for one location.
Query
query getProductsPerCategories ($salePriceCategory: Guid!, $location: Guid!, $productCategory: Guid)
{
products {
productCategories(productCategory: $productCategory) {
publicKey
name
active
products(salePriceCategory: $salePriceCategory) {
totalCount
items {
publicKey
name
code
measureUnit
salePrice
outOfStock(location: $location)
}
}
}
}
}Variables
{
"salePriceCategory": "<salePriceCategoryKey>",
"location": "<locationKey>",
"productCategory": "<productCategoryKey>"
}cURL
curl --location 'https://sandbox.expressoft.eu/connect/api/interopgql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{"query": "query getProductsPerCategories ($salePriceCategory: Guid!, $location: Guid!, $productCategory: Guid) { products { productCategories(productCategory: $productCategory) { publicKey name active products(salePriceCategory: $salePriceCategory) { totalCount items { publicKey name code measureUnit salePrice outOfStock(location: $location) } } } } }", "variables": {"salePriceCategory": "<salePriceCategoryKey>", "location": "<locationKey>", "productCategory": "<productCategoryKey>"}}'Response
{
"data": {
"products": {
"productCategories": [
{
"publicKey": "00000000-0000-0000-0000-000000000072",
"name": "Desserts",
"active": true,
"products": {
"totalCount": 1,
"items": [
{
"publicKey": "00000000-0000-0000-0000-000000000081",
"name": "Apple pie",
"code": "252",
"measureUnit": "portion",
"salePrice": 18.9,
"outOfStock": false
}
]
}
}
]
}
}
}outOfStock(location: ...) is resolved per location. Always pass the locationKey of the location that prepares the order.
Get Company Categories
Returns the company categories. Use a category publicKey when you create a company.
Query
query getCompanyCategories
{
organization {
companyCategories {
publicKey
name
active
}
}
}cURL
curl --location 'https://sandbox.expressoft.eu/connect/api/interopgql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{"query": "query getCompanyCategories { organization { companyCategories { publicKey name active } } }"}'Response
{
"data": {
"organization": {
"companyCategories": [
{
"publicKey": "00000000-0000-0000-0000-000000000091",
"name": "Customers",
"active": true
},
{
"publicKey": "00000000-0000-0000-0000-000000000092",
"name": "Suppliers",
"active": true
}
]
}
}
}