How to update orders
Edit your company order details, timing, and assignments effortlessly.
- NodeJS
const fetch = require("node-fetch")
const graphqlQuery = [{
"operationName": "UpdateCompanyOrder",
"variables": {
"companyOrder": order_id,
"data": {
"order": {
"route": {
"stops": [{
"_id": stop1_id,
"location": {
"city": "Nattheim",
"country": "de",
"zipcode": "89564",
"streetAndHouseNumber": "116",
"coordinates": {
"lat": 48.69247,
"lon": 10.21415
}
},
"date": {
"from": "2024-02-08T00:00:00.000Z",
"to": "2024-02-09T00:00:00.000Z"
},
"time": {
"from": "00:00",
"to": "23:59"
},
"additionalTimeWindows": [],
"waitingTimeMinutes": 0,
"address": "65a3ae6970e2f29ad2f1451b",
"referenceStops": [],
"plannedArrivalTime": null
},
{
"_id": stop2_id,
"location": {
"city": "Berlin",
"country": "de",
"zipcode": "12099",
"streetAndHouseNumber": "Stadtring Berlin",
"coordinates": {
"lat": 52.46397,
"lon": 13.40313
}
},
"date": {
"from": "2024-02-13T00:00:00.000Z",
"to": "2024-02-13T00:00:00.000Z"
},
"time": {
"from": "08:00",
"to": "17:00"
},
"additionalTimeWindows": [],
"waitingTimeMinutes": 0,
"address": "659fc431b909ce84c64073dd",
"referenceStops": [],
"plannedArrivalTime": null
}
],
"legViapoints": [],
"time": 7,
"distance": 576.794,
"loaded": null,
"routeDetailsId": "65f763f3bc5b065f2bdf9936"
},
"reference": "240115 / DE 89564 - DE 12099 copy copy",
"load": {
"length": 13.6,
"type": null,
"weight": 24,
"bodyType": "ANY",
"value": null,
"price": 6694.95,
"equipmentExchange": false
},
"comment": null,
"offerComment": null,
"files": [],
"additionalDetails": null,
"loadingUnits": []
},
"quote": "65f763f3fdab0055b671c34e",
"quotexSettings": {
"pricePerKm": 11.60717709794621
},
"subcontractor": null,
"vehicle": vehicle_id,
"driver": driver_id,
"trailer": trailer_id,
"customer": customer_id,
"cost": 808.35
}
},
"query": `
mutation UpdateCompanyOrder($companyOrder: ObjectId!, $data: CompanyOrderUpdateInput) {
updateCompanyOrder(companyOrder: $companyOrder, data: $data) {
...CompanyOrderData
__typename
}
}
fragment QuoteRoutingData on QuoteRouting {
id
routes {
distance
time
tollCountries
__typename
}
tolls
__typename
}
fragment QuoteValuesData on QuoteValues {
avgSpeed
checktoll
subcontractor
driver
vehicle
trailer
additionalCharges
stopsAdditionalTime
waitingtime
loaded
overwriteDays
__typename
}
fragment QuoteSettingsData on QuoteSettings {
routing {
...QuoteRoutingData
__typename
}
values {
...QuoteValuesData
__typename
}
__typename
}
fragment CalculatedQuoteData on CalculatedQuote {
costsPerKm
total
trailer
vehicle
driver
additionalCharges
premiums
fuel
costsPerTime
costsPerDistance
priceFactor
subs
toll
route {
profile
distance
time
drivingTime
emptydistance
fulldistance
days
waitingtimeLeft
__typename
}
__typename
}
fragment QuoteData on Quote {
_id
company
settings {
...QuoteSettingsData
__typename
}
quote {
...CalculatedQuoteData
__typename
}
__typename
}
fragment CostprofilesSubcontractorData on CostprofilesSubcontractor {
_id
name
email
pricing
price
waitingrate
pricefull
priceempty
pricedaily
maxempty
distanceinc
includetolls
__typename
}
fragment CostprofilesVehicleData on CostprofilesVehicle {
_id
costsPerDistance
costsPerTime
name
profileType
licensePlate
finance
price
leasing
duration
distance
restvalue
days
hours
usage
consumption
lubricants
wheels
tax
insurance
repair
trailer
weight
axis
euronorm
co2EmissionClass
fuelType
__typename
}
fragment CostprofilesTrailerData on CostprofilesTrailer {
_id
costsPerDistance
costsPerTime
name
profileType
finance
price
duration
wheels
tax
insurance
repair
distance
days
hours
usage
leasing
axis
__typename
}
fragment CostprofilesDriverData on CostprofilesDriver {
_id
costsPerTime
name
profileType
wage
socialsecurity
days
hours
additional
__typename
}
fragment ShipperConnectionData on ShipperConnection {
_id
shipperCompany {
_id
company
email
telephone
__typename
}
invitingShipperUser {
_id
firstname
lastname
email
telephone
__typename
}
status
__typename
}
fragment CostprofilesCustomerData on CostprofilesCustomer {
_id
name
firstname
lastname
telephone
email
skype
shipperConnection {
...ShipperConnectionData
__typename
}
additionalDetails {
value
label
customFieldId
visibility
__typename
}
linkedInvoiceIntegrationContactId
__typename
}
fragment SharedByUserData on ContactInfo {
_id
firstname
lastname
company
companyLogo
skype
telephone
email
__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 RoutingOptionsData on RoutingOptions {
routingMode
considerTraffic
departureDate
maxHeight
maxAxle
shippedHazardousGoods
tunnelCategory
excludeCountries
__typename
}
fragment FileDetailsData on FileDetails {
name
url
__typename
}
fragment DriverLocationData on DriverLocation {
timestamp
lat
lon
heading
speed
battery
__typename
}
fragment EventData on Event {
_id
timestamp
eventType
eventDetails {
... on OrderDetails {
sourceId
companyId
user {
_id
company
firstname
lastname
email
__typename
}
fusedOrders {
_id
reference
__typename
}
__typename
}
... on OrderDocumentDetails {
sourceId
orderFileType
stopRef
driverId
fileDetails {
...FileDetailsData
__typename
}
files {
orderFileType
stopRef
fileDetails {
name
url
__typename
}
__typename
}
companyId
user {
_id
company
firstname
lastname
email
__typename
}
__typename
}
... on OrderStatusDetails {
sourceId
orderStatus
driverId
companyId
user {
_id
company
firstname
lastname
email
__typename
}
location {
...DriverLocationData
__typename
}
orderInvoiceUrl
__typename
}
... on OrderChangeRequestDetails {
sourceId
companyId
changeRequestId
changeRequestComment
user {
_id
company
firstname
lastname
email
__typename
}
__typename
}
... on OrderChangeRequestStatusDetails {
sourceId
companyId
changeRequestId
changeRequestStatus
changeRequestDeclineComment
user {
_id
company
firstname
lastname
email
__typename
}
__typename
}
... on StopStatusDetails {
sourceId
orderId
stopStatus
driverId
companyId
statusUpdateComment
user {
_id
company
firstname
lastname
email
__typename
}
stopFiles: files {
orderFileType
stopRef
fileDetails {
name
url
__typename
}
__typename
}
location {
...DriverLocationData
__typename
}
__typename
}
... on OrderConfirmationDetails {
sourceId
companyId
user {
_id
company
firstname
lastname
email
__typename
}
toEmails
ccEmails
__typename
}
... on OrderFusedDetails {
sourceId
companyId
resultingOrder {
_id
reference
__typename
}
user {
_id
company
firstname
lastname
email
__typename
}
__typename
}
__typename
}
__typename
}
fragment AddressesCategoryData on AddressesCategory {
_id
name
color
icon
isDefault
__typename
}
fragment AddressData on Address {
_id
companyName
label
country
zipcode
city
street
contactPerson
phoneNumber
comment
email
coordinates {
lat
lon
__typename
}
category {
...AddressesCategoryData
__typename
}
isOneTimeAddress
__typename
}
fragment ViapointData on Viapoint {
coordinates {
lat
lon
snapRadiusMeters
__typename
}
__typename
}
fragment LegViapointsData on LegViapoints {
viapoints {
...ViapointData
__typename
}
__typename
}
fragment FileData on File {
_id
url
name
size
contentType
type
company
stop {
_id
__typename
}
__typename
}
fragment LoadingUnitData on OrderLoadingUnits {
pickupStopIndex
dropStopIndex
unloadingReference
type
reference
length
width
height
weight
quantity
stackable
loadingMeters
icon
name
template {
_id
__typename
}
__typename
}
fragment ContactPersonData on ContactInfo {
firstname
lastname
company
skype
telephone
email
__typename
}
fragment DriverDeviceSettingsData on DriverDeviceSettings {
activityRecognition
locationProviderStatus
locationProviderEnabled
isIgnoringBatteryOptimization
isPowerSaveMode
powerManagerNeeded
powerManagerLastSeenAt
appVersion
androidVersion
device
isPowerSaveMode
updatedAt
__typename
}
fragment DriverData on Driver {
_id
displayName
telephone
company
firebaseUid
integration {
_id
type
__typename
}
trackingEnabled
deviceSettings {
...DriverDeviceSettingsData
__typename
}
status
activated
__typename
}
fragment ChangeRequestData on ChangeRequest {
_id
status
update {
load {
type
price
length
weight
value
bodyType
equipmentExchange
__typename
}
route {
stops {
location {
coordinates {
lat
lon
__typename
}
country
zipcode
city
__typename
}
operationType
comment
address {
...AddressData
__typename
}
date {
from
to
__typename
}
time {
from
to
__typename
}
waitingTimeMinutes
__typename
}
legViapoints {
...LegViapointsData
__typename
}
loaded
distance
time
__typename
}
reference
comment
files {
url
name
size
type
company
contentType
stop
__typename
}
loadingUnits {
pickupStopIndex
dropStopIndex
type
reference
unloadingReference
length
width
height
weight
quantity
stackable
__typename
}
additionalDetails {
value
label
customFieldId
visibility
__typename
}
__typename
}
snapshot {
route {
stops {
_id
status
operationType
waitingTimeMinutes
comment
location {
country
coordinates {
lat
lon
__typename
}
zipcode
city
__typename
}
date {
from
to
__typename
}
time {
from
to
__typename
}
address {
...AddressData
__typename
}
__typename
}
legViapoints {
...LegViapointsData
__typename
}
loaded
distance
time
__typename
}
load {
length
type
weight
bodyType
value
price
equipmentExchange
__typename
}
reference
comment
files {
...FileData
__typename
}
loadingUnits {
...LoadingUnitData
__typename
}
additionalDetails {
value
label
customFieldId
visibility
__typename
}
__typename
}
requestingCompany
requestingUserDetails {
firstname
lastname
email
company
__typename
}
requestComment
declineComment
createdAt
__typename
}
fragment OrderData on Order {
_id
isFused
...OrderFirstLastStopData
route {
routeDetails {
_id
legs {
calculatedRoute {
time
__typename
}
routingOptions {
...RoutingOptionsData
__typename
}
__typename
}
__typename
}
stopsCount
stops {
_id
status
operationType
waitingTimeMinutes
comment
referenceStops
events {
sourceId
items {
...EventData
__typename
}
__typename
}
location {
country
coordinates {
lat
lon
__typename
}
zipcode
city
__typename
}
date {
from
to
__typename
}
time {
from
to
__typename
}
additionalTimeWindows {
from
to
__typename
}
address {
...AddressData
__typename
}
isTrackingEmailSent
__typename
}
legViapoints {
...LegViapointsData
__typename
}
loaded
distance
time
departureDate
__typename
}
load {
length
type
weight
bodyType
value
price
equipmentExchange
__typename
}
reference
comment
status
files {
...FileData
__typename
}
loadingUnits {
...LoadingUnitData
__typename
}
contactPerson {
...ContactPersonData
__typename
}
events {
sourceId
items {
...EventData
__typename
}
__typename
}
offerComment
createdAt
updatedAt
assignment {
driver {
...DriverData
__typename
}
__typename
}
changeRequests {
...ChangeRequestData
__typename
}
additionalDetails {
value
label
customFieldId
visibility
__typename
}
__typename
}
fragment BidData on Bid {
_id
companyName
status
amount
expiresAt
comment
archived
createdAt
__typename
}
fragment CompanyOrderData on CompanyOrder {
_id
company
archived
isEditable
isConfirmationEmailSent
isSubOrder
cost
quotexSettings {
pricePerKm
__typename
}
quote {
...QuoteData
__typename
}
subcontractorDetails {
... on CostprofilesSubcontractor {
...CostprofilesSubcontractorData
__typename
}
__typename
}
vehicleDetails {
...CostprofilesVehicleData
__typename
}
trailerDetails {
...CostprofilesTrailerData
__typename
}
driverDetails {
...CostprofilesDriverData
__typename
}
customerDetails {
...CostprofilesCustomerData
__typename
}
dispatcher {
...SharedByUserData
__typename
}
createdAt
updatedAt
order {
...OrderData
__typename
}
bids {
...BidData
receivingUser {
...ContactPersonData
__typename
}
__typename
}
takeover {
companyName
receivingUser {
...ContactPersonData
__typename
}
createdAt
updatedAt
__typename
}
fusedOrder {
_id
order {
reference
__typename
}
__typename
}
subOrders {
_id
order {
_id
status
reference
__typename
}
customerDetails {
_id
name
__typename
}
__typename
}
__typename
}
`
}];
fetch('https://backend.impargo.eu/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': token
},
body: JSON.stringify(graphqlQuery),
})
.then(response => response.json())
.then(data => {
console.log("Output:", JSON.stringify(data));
})
.catch(error => {
console.error("Error:", JSON.parse(error));
});
- Response
[
{
"data": {
"updateCompanyOrder": {
"_id": "65c7f1a5e6688870613c213b",
"company": "602cea807c960264eeb20a98",
"archived": false,
"isEditable": true,
"isConfirmationEmailSent": false,
"isSubOrder": false,
"cost": 2646.673256186885,
"quotexSettings": {
"pricePerKm": 1.1428006220118134,
"__typename": "QuotexSettings"
},
"quote": {
"_id": "65c7f1b257a40e809d220956",
"company": "602cea807c960264eeb20a98",
"settings": {
"routing": {
"id": null,
"routes": [
{
"distance": 723375,
"time": 32716,
"tollCountries": [],
"__typename": "QuoteRoute"
},
{
"distance": 1128373,
"time": 54966,
"tollCountries": [],
"__typename": "QuoteRoute"
},
{
"distance": 695801,
"time": 34535,
"tollCountries": [],
"__typename": "QuoteRoute"
}
],
"tolls": 589.7583999999999,
"__typename": "QuoteRouting"
},
"values": {
"avgSpeed": null,
"checktoll": false,
"subcontractor": null,
"driver": "63271ce05b1dc6c284de5ac8",
"vehicle": "63135a94a78b34015694ae13",
"trailer": "63271ce05b1dc6c284de5ace",
"additionalCharges": [],
"stopsAdditionalTime": 0,
"waitingtime": 0,
"loaded": [],
"overwriteDays": null,
"__typename": "QuoteValues"
},
"__typename": "QuoteSettings"
},
"quote": {
"costsPerKm": 1.0389096563743758,
"total": 2646.673256186885,
"trailer": 148.23005182021825,
"vehicle": 635.1837562305554,
"driver": 774.564382986111,
"additionalCharges": 0,
"premiums": 0,
"fuel": 1088.6950651500001,
"costsPerTime": 30.63235416666667,
"costsPerDistance": 0.2033465476190476,
"priceFactor": 1.1,
"subs": null,
"toll": 0,
"route": {
"profile": "truck",
"distance": 2547.549,
"time": 33.94916666666666,
"drivingTime": 33.94916666666666,
"emptydistance": 2547.549,
"fulldistance": 0,
"days": 5,
"waitingtimeLeft": 6.050833333333337,
"__typename": "CalculatedQuoteRoute"
},
"__typename": "CalculatedQuote"
},
"__typename": "Quote"
},
"subcontractorDetails": null,
"vehicleDetails": {
"_id": "63135a94a78b34015694ae13",
"costsPerDistance": 0.5898,
"costsPerTime": 6.519583333333333,
"name": "E.g. 40t tanker",
"profileType": "advanced",
"licensePlate": null,
"finance": "buy",
"price": 105000,
"leasing": 1800,
"duration": 3,
"distance": 140000,
"restvalue": 47250,
"days": 240,
"hours": 10,
"usage": "long",
"consumption": 33,
"lubricants": 1,
"wheels": 2205,
"tax": 670,
"insurance": 5800,
"repair": 7000,
"trailer": "63135a94a78b34863094ae10",
"weight": "40",
"axis": "5",
"euronorm": "6",
"co2EmissionClass": "1",
"__typename": "CostprofilesVehicle"
},
"trailerDetails": {
"_id": "63271ce05b1dc6c284de5ace",
"costsPerDistance": 0.04089654761904762,
"costsPerTime": 1.2973541666666668,
"name": "E.g. Standard",
"profileType": "advanced",
"finance": "buy",
"price": 24000,
"duration": 6,
"wheels": 1727,
"tax": 380,
"insurance": 900,
"repair": 1400,
"distance": 140000,
"days": 240,
"hours": 10,
"usage": "long",
"leasing": null,
"axis": null,
"__typename": "CostprofilesTrailer"
},
"driverDetails": {
"_id": "63271ce05b1dc6c284de5ac8",
"costsPerTime": 22.815416666666668,
"name": "E.g. Germany (long haul)",
"profileType": "advanced",
"wage": 31000,
"socialsecurity": 25.76,
"days": 240,
"hours": 8,
"additional": 4820,
"__typename": "CostprofilesDriver"
},
"customerDetails": {
"_id": "6508074f5a5d7d8858dd0367",
"name": "impargo",
"firstname": "david",
"lastname": "paulus",
"telephone": "123456",
"email": "mikavom280@viicard.com",
"skype": null,
"shipperConnection": {
"_id": "650807365a8da6a62b14566f",
"shipperCompany": {
"_id": "6507f6bd084f2e236518a0db",
"company": "impargo",
"email": null,
"telephone": "123456",
"__typename": "Company"
},
"invitingShipperUser": {
"_id": "6507f6bd084f2e236518a0da",
"firstname": "david",
"lastname": "paulus",
"email": "mikavom280@viicard.com",
"telephone": "123456",
"__typename": "User"
},
"status": "ACTIVE",
"__typename": "ShipperConnection"
},
"additionalDetails": [],
"linkedInvoiceIntegrationContactId": null,
"__typename": "CostprofilesCustomer"
},
"createdAt": "2024-02-10T21:59:01.280Z",
"updatedAt": "2024-02-10T21:59:21.391Z",
"order": {
"_id": "65c7f1a5e6688870613c2135",
"isFused": false,
"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",
"route": {
"routeDetails": {
"_id": "65c7f1b2c3c846c3e2922893",
"legs": [
{
"calculatedRoute": {
"time": 32716,
"__typename": "LegRoute"
},
"routingOptions": {
"routingMode": "fastest",
"considerTraffic": false,
"departureDate": null,
"maxHeight": 4,
"maxAxle": 8,
"shippedHazardousGoods": [],
"tunnelCategory": null,
"excludeCountries": [],
"__typename": "RoutingOptions"
},
"__typename": "Leg"
},
{
"calculatedRoute": {
"time": 54966,
"__typename": "LegRoute"
},
"routingOptions": {
"routingMode": "fastest",
"considerTraffic": false,
"departureDate": null,
"maxHeight": 4,
"maxAxle": 8,
"shippedHazardousGoods": [],
"tunnelCategory": null,
"excludeCountries": [],
"__typename": "RoutingOptions"
},
"__typename": "Leg"
},
{
"calculatedRoute": {
"time": 34535,
"__typename": "LegRoute"
},
"routingOptions": {
"routingMode": "fastest",
"considerTraffic": false,
"departureDate": null,
"maxHeight": 4,
"maxAxle": 8,
"shippedHazardousGoods": [],
"tunnelCategory": null,
"excludeCountries": [],
"__typename": "RoutingOptions"
},
"__typename": "Leg"
}
],
"__typename": "RouteDetails"
},
"stopsCount": 4,
"stops": [
{
"_id": "65c7f1a5e6688870613c211f",
"status": "PENDING",
"operationType": null,
"waitingTimeMinutes": null,
"comment": null,
"referenceStops": [],
"events": {
"sourceId": "65c7f1a5e6688870613c211f",
"items": [],
"__typename": "Events"
},
"location": {
"country": "fr",
"coordinates": {
"lat": 43.34991,
"lon": 1.86602,
"__typename": "Coordinates"
},
"zipcode": "11320",
"city": "Berline",
"streetAndHouseNumber": "Labastide-d'Anjou, Lieu-dit Berline",
"__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"
},
"additionalTimeWindows": [],
"address": null,
"isTrackingEmailSent": false,
"__typename": "Stop"
}
],
"legViapoints": [
{
"viapoints": [],
"__typename": "LegViapoints"
}
],
"loaded": null,
"distance": 2547.549,
"time": 33.94916666666666,
"departureDate": null,
"__typename": "Route"
},
"load": {
"length": 13.6,
"type": null,
"weight": 24,
"bodyType": "ANY",
"value": null,
"price": null,
"equipmentExchange": false,
"__typename": "Load"
},
"reference": "240211 / FR 11320 - NL 1011 MG",
"comment": null,
"status": "OPEN",
"files": [],
"loadingUnits": [],
"contactPerson": {
"firstname": "Joe",
"lastname": "Duo",
"company": "Trading Co.",
"skype": "ddn",
"telephone": "012845323",
"email": "cfkeuiiv@sharklasers.com",
"__typename": "ContactInfo"
},
"events": {
"sourceId": "65c7f1a5e6688870613c2135",
"items": [
{
"_id": "65c7f1a5bd4598394357a441",
"timestamp": "2024-02-10T21:59:01.277Z",
"eventType": "ORDER_CREATED",
"eventDetails": {
"sourceId": "65c7f1a5e6688870613c2135",
"companyId": "602cea807c960264eeb20a98",
"user": {
"_id": "602cea807c9602436cb20a97",
"company": "Trading Co.",
"firstname": "Joe",
"lastname": "Duo",
"email": "cfkeuiiv@sharklasers.com",
"__typename": "ContactInfo"
},
"fusedOrders": null,
"__typename": "OrderDetails"
},
"__typename": "Event"
}
],
"__typename": "Events"
},
"offerComment": null,
"createdAt": "2024-02-10T21:59:01.237Z",
"updatedAt": "2024-02-10T21:59:21.391Z",
"assignment": {
"driver": null,
"__typename": "OrderAssignment"
},
"changeRequests": [],
"additionalDetails": null
},
"bids": [],
"takeover": null,
"fusedOrder": null,
"subOrders": null,
"__typename": "CompanyOrder"
}
}
}
]