Skip to main content

How to retrieve orders

GraphQL query

View all your orders at a glance for quick reference and management.


const fetch = require("node-fetch")

fetch("https://backend.impargo.eu/", {
method: "POST",
headers: {
"authorization": token,
"content-type": "application/json",
},
body: JSON.stringify([
{
"operationName": "GetCompanyOrders",
"variables": {
"paginate": {
"limit": 20
},
"query": {
"archived": false
}
},
"query": `query GetCompanyOrders($query: CompanyOrderQuery, $paginate: Pagination, $sortBy: CompanyOrderSortBy) {
companyOrders(query: $query, paginate: $paginate, sortBy: $sortBy) {
items {
...CompanyOrderOverview
__typename
}
hasNext
__typename
}
}

fragment OrderFirstLastStopData on Order {
firstStop {
location {
country
city
zipcode
coordinates {
lat
lon
__typename
}
__typename
}
date {
from
to
__typename
}
time {
from
to
__typename
}
__typename
}
lastStop {
location {
country
city
zipcode
coordinates {
lat
lon
__typename
}
__typename
}
date {
from
to
__typename
}
time {
from
to
__typename
}
__typename
}
__typename
}

fragment OrderOverview on Order {
_id
load {
length
weight
bodyType
price
__typename
}
reference
status
isFused
assignment {
driver {
_id
__typename
}
__typename
}
route {
distance
time
stopsCount
__typename
}
changeRequests {
_id
status
__typename
}
comment
...OrderFirstLastStopData
__typename
}

fragment BidData on Bid {
_id
companyName
status
amount
expiresAt
comment
archived
createdAt
__typename
}

fragment ContactPersonData on ContactInfo {
firstname
lastname
company
skype
telephone
email
__typename
}

fragment CompanyOrderOverview on CompanyOrder {
_id
archived
isConfirmationEmailSent
cost
vehicleDetails {
_id
name
__typename
}
subcontractorDetails {
... on CostprofilesSubcontractor {
_id
name
email
__typename
}
__typename
}
driverDetails {
_id
name
__typename
}
customerDetails {
_id
name
email
linkedInvoiceIntegrationContactId
__typename
}
dispatcher {
_id
firstname
__typename
}
quote {
quote {
costsPerKm
total
toll
route {
distance
__typename
}
__typename
}
__typename
}
quotexSettings {
pricePerKm
__typename
}
order {
...OrderOverview
__typename
}
subOrders {
_id
__typename
}
bids {
...BidData
receivingUser {
...ContactPersonData
__typename
}
__typename
}
__typename
}`
}
])
})
.then(response => response.json())
.then(data => {
console.log("Output:", data);
})
.catch(error => {
console.error("Error:", error);
});


[
{
"data": {
"companyOrders": {
"items": [
{
"_id": "65c7f1a5e6688870613c213b",
"archived": false,
"isConfirmationEmailSent": false,
"cost": 2646.673256186885,
"vehicleDetails": {
"_id": "63135a94a78b34015694ae13",
"name": "E.g. 40t tanker",
"__typename": "CostprofilesVehicle"
},
"subcontractorDetails": null,
"driverDetails": {
"_id": "63271ce05b1dc6c284de5ac8",
"name": "E.g. Germany (long haul)",
"__typename": "CostprofilesDriver"
},
"customerDetails": {
"_id": "6508074f5a5d7d8858dd0367",
"name": "impargo",
"email": "mikavom280@viicard.com",
"linkedInvoiceIntegrationContactId": null,
"__typename": "CostprofilesCustomer"
},
"quote": {
"quote": {
"costsPerKm": 1.0389096563743758,
"total": 2646.673256186885,
"toll": 0,
"route": {
"distance": 2547.549,
"__typename": "CalculatedQuoteRoute"
},
"__typename": "CalculatedQuote"
},
"__typename": "Quote"
},
"quotexSettings": {
"pricePerKm": 1.1428006220118134,
"__typename": "QuotexSettings"
},
"order": {
"_id": "65c7f1a5e6688870613c2135",
"load": {
"length": 13.6,
"weight": 24,
"bodyType": "ANY",
"price": null,
"__typename": "Load"
},
"reference": "240211 / FR 11320 - NL 1011 MG",
"status": "OPEN",
"isFused": false,
"assignment": {
"driver": null,
"__typename": "OrderAssignment"
},
"route": {
"distance": 2547.549,
"time": 33.94916666666666,
"stopsCount": 4,
"__typename": "Route"
},
"changeRequests": [],
"comment": null,
"firstStop": {
"location": {
"country": "fr",
"city": "Berline",
"streetAndHouseNumber": "Labastide-d'Anjou 1",
"zipcode": "11320",
"coordinates": {
"lat": 43.34991,
"lon": 1.86602,
"__typename": "Coordinates"
},
"__typename": "Location"
},
"date": {
"from": "2024-02-11T20:21:26.092Z",
"to": "2024-02-11T20:21:26.092Z",
"__typename": "FromToDate"
},
"time": {
"from": "00:00",
"to": "23:59",
"__typename": "FromToTime"
},
"__typename": "MainStopInfo"
},
"lastStop": {
"location": {
"country": "nl",
"city": "Netherlands",
"zipcode": null,
"coordinates": {
"lat": 52.36993,
"lon": 4.90787,
"__typename": "Coordinates"
},
"__typename": "Location"
},
"date": {
"from": "2024-02-11T20:52:16.458Z",
"to": "2024-02-11T20:52:16.458Z",
"__typename": "FromToDate"
},
"time": {
"from": "08:00",
"to": "17:00",
"__typename": "FromToTime"
},
"__typename": "MainStopInfo"
},
"__typename": "Order"
},
"subOrders": null,
"bids": [],
"__typename": "CompanyOrder"
}
],
"hasNext": false,
"__typename": "CompanyOrders"
}
}
}
]