Admin REST API 2023-01 - Fulfillment 404 Not Found

Hi,

I’ve been trying to create fulfillments with the admin REST API and I always get “Not found” error.

Already looked to some related posts here but none was able to fix the issue.

  1. [GET] to https://{shop}/admin/api/2023-01/orders/{order_id}/fulfillment_orders.json

This is the response (with data masked) - Looks fine to me:

{
    "fulfillment_orders": [
        {
            "id": ID,
            "shop_id": SHOP_ID,
            "order_id": ORDER_ID,
            "assigned_location_id": LOCATION_ID,
            "request_status": "unsubmitted",
            "status": "open",
            "supported_actions": [
                "create_fulfillment",
                "hold"
            ],
            "destination": {
                "id": DESTINATION_ID,
                "address1": null,
                "address2": null,
                "city": null,
                "company": null,
                "country": null,
                "email": null,
                "first_name": null,
                "last_name": null,
                "phone": null,
                "province": null,
                "zip": null
            },
            "line_items": [
                {
                    "id": LINE_ID,
                    "shop_id": SHOP_ID,
                    "fulfillment_order_id": FULFILLMENT_ORDER_ID,
                    "quantity": 1,
                    "line_item_id": LINE_ITEM_ID,
                    "inventory_item_id": INVENTORY_ITEM_ITEM,
                    "fulfillable_quantity": 1,
                    "variant_id": VARIANT_ID
                }
            ],
.......
  1. [POST] https://{shop}/admin/api/2023-01/fulfillments.json

X-Request-Id: 879051bd-9286-4a79-af7f-4ae505c1c3f9

{
    "fulfillment": {
        "message":"The package was shipped this morning.",
        "notify_customer":false,
        "tracking_info": {
            "number":1562678,
            "url":"https://www.my-shipping-company.com",
            "company":"my-shipping-company"
        },
        "line_items_by_fulfillment_order":[
            {
                "fulfillment_order_id": ID, // field 'ID' from last response
                "fulfillment_order_line_items":[
                    { "id": LINE_ID, "quantity":1 } // Field 'LINE_ID' from last response
                ]
            }
        ]
    }
}

HEADERS:

X-Shopify-Access-Token: {SHP_TOKEN}

I get the following response:

{
    "errors": "Not Found"
}

If I try:

[POST] https://{shop}/admin/api/2023-01/orders/{ORDER_ID}/fulfillments.json

X-Request-Id: 6a8502aa-5701-4f6e-ba32-cd4afa4ceb19

{
	"fulfillment": {
		"message": "The package was shipped this morning.",
		"notify_customer": false,
		"tracking_info": {
			"number": 1562678,
			"url": "https://www.my-shipping-company.com",
			"company": "my-shipping-company"
		},
		"line_items_by_fulfillment_order": [
			{
				"fulfillment_order_id": FULFILLMENT_ORDER_ID,
				"fulfillment_order_line_items": [
					{
						"id": FULFILLMENT_LINE_ITEM_ID_1,
						"quantity": 1
					},
                    {
						"id": FULFILLMENT_LINE_ITEM_ID_1,
						"quantity": 1
					}
				]
			}
		]
	}
}

Response:

{
    "fulfillments": []
}

I’ve already checked permissions and I have:

  • write_fulfillments / read_fulfillments
  • write_inventory / read_inventory
  • write_locations / read_locations
  • write_third_party_fulfillment_orders / read_third_party_fulfillment_orders
  • write_custom_fulfillment_services / read_custom_fulfillment_services

I’m not really sure what I’m missing. Any help would be welcome.

Thanks!

For anyone having the same issue, I’ve solved it by fixing the base URL.

I was using the base URL ending in *.com which works fine with most endpoint, but not with fulfillments.

I had to use the one ending in *.myshopify.com.

I’ve finally found out the problem by checking logs on POSTMAN and I noticed that every request to fulfillment endpoints were being redirected to my *.myshopify.com domain as a GET request.

This took me several hours to find out and I think the API documentation (or the error codes returned) should be a bit more clear regarding this. If all endpoints were failing I would have noticed sooner, but since most were working I didn’t even imagine the problem to be with the base URL.

Hi Kevinamorim,

We encountered the same issue as your second problem.

We request ‘POST /admin/api/2023-01/fulfiliments.json’ but it returned a 404 error. We were using the URL ending in *.myshopify.com. Any thought what the problem might be?

Thank you in advance.

BR.

Sophia

Hi! Have you checked that you have all the permissions for the API? If not, then that can be the cause.