Post tracking number of order using Rest API version 2023-01

Post tracking number of order using Rest API version 2023-01

BAMKO
Shopify Partner
2 0 1

Hello,

 

Trying to post tracking number to my order using Rest Api version 2023-01 but getting following error:

 

Url :: 

https://bamko-testing.myshopify.com/admin/api/2023-01/fulfillments.json

Data Array  :: 

Array
(
    [fulfillment] => Array
        (
            [location_id] => 56945246371
            [tracking_info] => Array
                (
                    [number] => 12345678
                    [url] => http://www.royalmail.com/portal/rm/track?trackNumber=12345678
                    [company] => Royal Mail
                )

            [fulfillment_order_id] => Array
                (
                    [fulfillment_order_id] => 4898168701091
                )

            [line_items_by_fulfillment_order] => Array
                (
                    [0] => Array
                        (
                            [id] => 7176085340323
                            [quantity] => 1
                        )

                )

            [notify_customer] => 1
        )

)

 

Error : 

"errors":["Fulfillment payloads fulfillment order must be greater than 0"]

 

Also if I am trying to get order fulfillment json getting following issue : 

 

Url :: https://bamko-testing.myshopify.com/admin/api/2022-10/orders/4898168701091/fulfillment_orders.json

 

Error :: 

{"errors":"The api_client does not have the required permission(s)."}

Even in my custom /private app, I have given all the permission 

BAMKO_0-1679403898976.png

 

 

Please help with the issue.

 

Kind Regards

 

Replies 4 (4)

atlasQED
Shopify Partner
4 1 2

The models are _not_ the same between the deprecated /orders/{{id}}/fulfillments POST and the newly-forced /fulfillments POST.

- In /fulfillments, "tracking_info" is _not_ an array. Only one tracking number per fulfillment.

- For /fulfillments, the fulfillment_order_id is embedded inside the line_items_by_fulfillment_order array.

 

And careful with those line ids. You must use the "fulfillment_order.line_items.id", not the "order.line_items.id" or "fulfillment_order.line_items.line_item_id".

Alwani
Shopify Partner
13 0 1

Hello Sir,

Can you share with me a sample payload with tracking info and 2 item lines, I am getting a sort of error when loading multiple items fulfillment, it does work for a single item though.

Thanks

 

Fleurist
New Member
9 0 0

Hi ,Is this problem being solved yet?

Alwani
Shopify Partner
13 0 1

Yes, I solved the issue myself. no support was provided.