Hi everyone,
currently, I try to migrate our fulfillment creation job from
the old REST API (fulfillments.json) to the new GraphQL API.
I created in my dev shop an order, which I marked as paid.
Now I’ll get the FulfillmentOrder and the corresponding OrderLineItem
via the following GraphQL Request.
URL: https://my-dev-shop.myshopify.com/admin/api/2025-01/graphql.json
Payload:
{
orders(first: 1, query: "id:11974872990075") {
nodes {
id
name
fulfillmentOrders(first: 250) {
nodes {
id
lineItems(first: 250) {
nodes {
id,
remainingQuantity
}
}
}
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
Response:
{
"data": {
"orders": {
"nodes": [
{
"id": "gid://shopify/Order/11974872990075",
"name": "#1027",
"fulfillmentOrders": {
"nodes": [
{
"id": "gid://shopify/FulfillmentOrder/12868499603835",
"lineItems": {
"nodes": [
{
"id": "gid://shopify/FulfillmentOrderLineItem/35376656843131",
"remainingQuantity": 1
}
]
}
}
]
}
}
],
"pageInfo": {
"hasNextPage": false,
"endCursor": "eyJsYXN0X2lkIjoxMTk3NDg3Mjk5MDA3NSwibGFzdF92YWx1ZSI6IjIwMjUtMDctMTcgMTM6MTU6NDAuNDU0ODk4In0="
}
}
},
"extensions": {
"cost": {
"requestedQueryCost": 159,
"actualQueryCost": 9,
"throttleStatus": {
"maximumAvailable": 2000.0,
"currentlyAvailable": 1991,
"restoreRate": 100.0
}
}
}
}
Now I got the IDs of the order and the orderline to create the mutation for the fulfillment as follows.
URL: https://my-dev-shop.myshopify.com/admin/api/2025-01/graphql.json
Payload:
{
"query": "mutation fulfillmentCreate($fulfillment: FulfillmentInput!, $message: String) { fulfillmentCreate(fulfillment: $fulfillment, message: $message) { fulfillment { status } userErrors { field message } }}",
"variables": {
"fulfillment": {
"lineItemsByFulfillmentOrder": [
{
"fulfillmentOrderId": "gid://shopify/FulfillmentOrder/12868499603835",
"fulfillmentOrderLineItems": [
{
"id": "gid://shopify/FulfillmentOrderLineItem/35376656843131",
"quantity": 1
}
]
}],
"notifyCustomer": false,
"trackingInfo": {
"number": "1234567890",
"url": "https://tracking.example.com/1234567890",
"company": "DHL"
}
},
"message": "1"
}
}
Response:
{
"data": {
"fulfillmentCreate": {
"fulfillment": null,
"userErrors": [
{
"field": [
"fulfillment"
],
"message": "The api_client does not have access to the fulfillment order."
}
]
}
},
"extensions": {
"cost": {
"requestedQueryCost": 10,
"actualQueryCost": 10,
"throttleStatus": {
"maximumAvailable": 2000.0,
"currentlyAvailable": 1990,
"restoreRate": 100.0
}
}
}
}
Now I got an rights error, that the api_client does not have the necessary rights.
I tried the complete day to solve this issue. But I don’t get around the upper error.
As follows my current scopes of the api_client:
‘read_orders’,
‘read_all_orders’,
‘write_orders’,
‘read_merchant_managed_fulfillment_orders’,
‘write_merchant_managed_fulfillment_orders’,
‘write_third_party_fulfillment_orders’,
‘read_third_party_fulfillment_orders’,
‘read_customers’,
‘read_locations’,
‘read_products’,
‘read_discounts’,
The old rest api works without any issues with the same scopes. I tried to solve the issue
with the Shopify AI Assistant, but it keeps haluscinating, that I could send as payload “OrderID”,
but the documentation doesn’t show any option about that. Or the AI suggests to create a fulfillment
service, but this should be only made if we have other fulfillment services set.
Maybe you could help me?
Thank you very much!