Skip to main content

How to assign order to partner

GraphQL mutation

The AssignToCarrier mutation assigns an order to a partner carrier by taking the order and carrier IDs as inputs. It updates the order to reflect the assigned partner carrier, streamlining order management within the system.

const fetch = require('node-fetch');

fetch("https://backend.impargo.eu/", {
method: "POST",
headers: {
"authorization": token,
"content-type": "application/json",
},
body: JSON.stringify([{
"operationName": "AssignToCarrier",
"variables": {
"order": "6367c8997aa0d835c36d3129",
"carrier": "5fda2b6f7846dd8841bcdea9"
},
"query": `mutation AssignToCarrier($order: ObjectId!, $carrier: ObjectId!) {
assignToCarrier(order: $order, carrier: $carrier) {
...CompanyOrder
__typename
}
}

fragment Takeover on Takeover {
_id
company
companyName
status
decliningComment
__typename
}

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

fragment Event 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
files {
orderFileType
fileDetails {
name
url
__typename
}
__typename
}
fileDetails {
name
url
__typename
}
companyId
user {
_id
company
firstname
lastname
email
__typename
}
__typename
}
... on OrderStatusDetails {
sourceId
orderStatus
driverId
companyId
user {
_id
company
firstname
lastname
email
__typename
}
location {
...DriverLocation
__typename
}
__typename
}
... on StopStatusDetails {
sourceId
orderId
stopStatus
driverId
companyId
statusUpdateComment
stopFiles: files {
orderFileType
fileDetails {
name
url
__typename
}
__typename
}
user {
_id
company
firstname
lastname
email
__typename
}
location {
...DriverLocation
__typename
}
__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 OffersRequestedDetails {
companyId
user {
firstname
lastname
company
email
__typename
}
bids {
_id
companyName
status
amount
expiresAt
comment
receivingUser {
firstname
lastname
telephone
__typename
}
__typename
}
__typename
}
... on OrderFusedDetails {
sourceId
user {
firstname
lastname
company
email
__typename
}
resultingOrder {
_id
reference
__typename
}
__typename
}
__typename
}
__typename
}

fragment AdditionalFieldData on AdditionalField {
customFieldId
value
label
visibility
__typename
}

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

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

fragment Stop on Stop {
_id
status
operationType
waitingTimeMinutes
events {
sourceId
items {
...Event
__typename
}
__typename
}
address {
...Address
__typename
}
location {
country
coordinates {
lat
lon
__typename
}
zipcode
city
__typename
}
date {
from
to
__typename
}
time {
from
to
__typename
}
comment
__typename
}

fragment LoadingUnit on OrderLoadingUnits {
pickupStopIndex
dropStopIndex
unloadingReference
type
customType
reference
length
loadingMeters
width
height
weight
quantity
stackable
name
template {
_id
__typename
}
loadingMeters
__typename
}

fragment Driver on Driver {
status
__typename
}

fragment File on File {
_id
url
name
size
contentType
type
company
stop {
_id
__typename
}
__typename
}

fragment ChangeRequest on ChangeRequest {
_id
status
update {
load {
type
price
length
weight
value
bodyType
equipmentExchange
__typename
}
route {
stops {
_id
location {
coordinates {
lat
lon
__typename
}
country
zipcode
city
__typename
}
operationType
comment
address {
...Address
__typename
}
date {
from
to
__typename
}
time {
from
to
__typename
}
waitingTimeMinutes
__typename
}
viapoints {
coordinates {
lat
lon
__typename
}
__typename
}
loaded
distance
time
__typename
}
reference
comment
files {
url
name
size
type
company
contentType
stop
__typename
}
loadingUnits {
pickupStopIndex
dropStopIndex
type
reference
customType
unloadingReference
length
loadingMeters
width
height
weight
quantity
stackable
name
template
loadingMeters
__typename
}
additionalDetails {
...AdditionalFieldData
__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 {
...Address
__typename
}
__typename
}
viapoints {
coordinates {
lat
lon
__typename
}
__typename
}
loaded
distance
time
__typename
}
load {
length
type
weight
bodyType
value
price
equipmentExchange
__typename
}
reference
comment
files {
...File
__typename
}
additionalDetails {
...AdditionalFieldData
__typename
}
loadingUnits {
...LoadingUnit
__typename
}
__typename
}
__typename
}

fragment CompanyOrder on Order {
_id
company
reference
type
route {
stops {
...Stop
__typename
}
loaded
distance
time
viapoints {
coordinates {
lat
lon
__typename
}
__typename
}
__typename
}
driver {
...Driver
__typename
}
comments
status
changeRequests {
...ChangeRequest
__typename
}
files {
...File
__typename
}
additionalDetails {
...AdditionalFieldData
__typename
}
loadingUnits {
...LoadingUnit
__typename
}
__typename
}`
}])
})
[
{
"data":{
"assignToCarrier":null
}
}
]