Skip to main content

How to change stop status

GraphQL mutation

You can update the stop's status with ease. Whether marking the stop as driver arrived, start or finished status.


const fetch = require("node-fetch")

fetch("https://backend.impargo.eu/", {
method: "POST",
headers: {
"authorization": token,
"content-type": "application/json",
},
body: JSON.stringify([
{
"operationName": "ChangeStopStatus",
"variables": {
"stopId": stop_id,
"status": "DRIVER_ARRIVED"
},
"query": `mutation ChangeStopStatus($stopId: ObjectId!, $status: EnumStopStatus!) {
changeStopStatus(stopId: $stopId, status: $status) {
...ReusableStopData
__typename
}
}

fragment AddressesCategoryData on AddressesCategory {
_id
name
color
icon
isDefault
__typename
}

fragment ReusableAddressData on Address {
_id
companyName
label
contactPerson
phoneNumber
email
comment
isOneTimeAddress
category {
...AddressesCategoryData
__typename
}
country
city
street
zipcode
coordinates {
lat
lon
__typename
}
__typename
}

fragment OrderDetails on OrderDetails {
sourceId
companyId
user {
_id
company
firstname
lastname
email
__typename
}
__typename
}

fragment OrderDocumentDetails on OrderDocumentDetails {
sourceId
orderFileType
stopRef
driverId
files {
orderFileType
fileDetails {
name
url
__typename
}
__typename
}
fileDetails {
name
url
__typename
}
companyId
user {
_id
company
firstname
lastname
email
__typename
}
__typename
}

fragment DriverLocationData on DriverLocation {
timestamp
lat
lon
heading
speed
battery
__typename
}

fragment OrderStatusDetails on OrderStatusDetails {
sourceId
orderStatus
driverId
companyId
orderInvoiceUrl
user {
_id
company
firstname
lastname
email
__typename
}
location {
...DriverLocationData
__typename
}
__typename
}

fragment StopStatusDetails on StopStatusDetails {
sourceId
orderId
stopStatus
driverId
companyId
statusUpdateComment
stopFiles: files {
orderFileType
fileDetails {
name
url
__typename
}
__typename
}
user {
_id
company
firstname
lastname
email
__typename
}
location {
...DriverLocationData
__typename
}
__typename
}

fragment OrderChangeRequestDetails on OrderChangeRequestDetails {
sourceId
companyId
changeRequestId
changeRequestComment
user {
_id
company
firstname
lastname
email
__typename
}
__typename
}

fragment OrderChangeRequestStatusDetails on OrderChangeRequestStatusDetails {
sourceId
companyId
changeRequestId
changeRequestStatus
changeRequestDeclineComment
user {
_id
company
firstname
lastname
email
__typename
}
__typename
}

fragment OffersRequestedDetails on OffersRequestedDetails {
companyId
user {
firstname
lastname
company
email
__typename
}
bids {
_id
companyName
status
amount
expiresAt
comment
receivingUser {
firstname
lastname
telephone
__typename
}
__typename
}
__typename
}

fragment OrderFusedDetails on OrderFusedDetails {
sourceId
companyId
user {
_id
firstname
lastname
__typename
}
resultingOrder {
_id
reference
__typename
}
__typename
}

fragment OrderConfirmationDetails on OrderConfirmationDetails {
ccEmails
toEmails
user {
_id
firstname
lastname
email
__typename
}
sourceId
driverId
__typename
}

fragment EventData on Event {
_id
timestamp
eventType
eventDetails {
... on OrderDetails {
...OrderDetails
__typename
}
... on OrderDocumentDetails {
...OrderDocumentDetails
__typename
}
... on OrderStatusDetails {
...OrderStatusDetails
__typename
}
... on StopStatusDetails {
...StopStatusDetails
__typename
}
... on OrderChangeRequestDetails {
...OrderChangeRequestDetails
__typename
}
... on OrderChangeRequestStatusDetails {
...OrderChangeRequestStatusDetails
__typename
}
... on OffersRequestedDetails {
...OffersRequestedDetails
__typename
}
... on OrderFusedDetails {
...OrderFusedDetails
__typename
}
... on OrderConfirmationDetails {
...OrderConfirmationDetails
__typename
}
__typename
}
__typename
}

fragment ReusableStopData on Stop {
_id
status
operationType
waitingTimeMinutes
address {
...ReusableAddressData
__typename
}
location {
country
coordinates {
lat
lon
__typename
}
zipcode
city
__typename
}
date {
from
to
__typename
}
time {
from
to
__typename
}
additionalTimeWindows {
from
to
__typename
}
comment
events {
items {
...EventData
__typename
}
__typename
}
__typename
}`
}
])
})
.then(response => response.json())
.then(data => {
console.log("Output:", data);
})
.catch(error => {
console.error("Error:", error);
});

[
{
"data": {
"changeStopStatus": {
"_id": "65caa58113d41ca2e97801b6",
"status": "DRIVER_ARRIVED",
"operationType": null,
"waitingTimeMinutes": null,
"address": null,
"location": {
"country": "pl",
"coordinates": {
"lat": 52.50068,
"lon": 18.2751,
"__typename": "Coordinates"
},
"zipcode": "88-324",
"city": "Berlinek",
"streetAndHouseNumber": "Alexanrplatz 23",
"__typename": "Location"
},
"date": {
"from": "2024-02-13T23:10:23.500Z",
"to": "2024-02-13T23:10:23.500Z",
"__typename": "FromToDate"
},
"time": {
"from": "08:00",
"to": "17:00",
"__typename": "FromToTime"
},
"additionalTimeWindows": [],
"comment": null,
"events": {
"items": [
{
"_id": "65caa9ce1bc54961c18f24bd",
"timestamp": "2024-02-12T23:29:18.178Z",
"eventType": "STOP_STATUS_CHANGED",
"eventDetails": {
"sourceId": "65caa58113d41ca2e97801b6",
"orderId": "65caa58113d41ca2e97801bd",
"stopStatus": "DRIVER_ARRIVED",
"driverId": null,
"companyId": "602cea807c960264eeb20a98",
"statusUpdateComment": null,
"stopFiles": null,
"user": {
"_id": "602cea807c9602436cb20a97",
"company": "Trading Co.",
"firstname": "Joe",
"lastname": "Duo",
"email": "cfkeuiiv@sharklasers.com",
"__typename": "ContactInfo"
},
"location": null,
"__typename": "StopStatusDetails"
},
"__typename": "Event"
}
],
"__typename": "Events"
},
"__typename": "Stop"
}
}
}
]