Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Unable to create a fulfillment_event through rest api

Unable to create a fulfillment_event through rest api

Agam1997
Shopify Partner
3 0 0

Hi All, 

 

We are trying to programmatically mark order as delivered. To successfully do that we must make fulfillment events as the order is shipped (status = in_transit) to delivered (status = delivered) 

Using this endpoint, the POST request must have order_id, fulfillment_id and status. Here's my body and URL that I'm hitting:

 

POST URL: https://ondc-testing.myshopify.com/admin/api/2022-01/orders/4936841101539/fulfillments/4424364359907...

 

where 4936841101539 is the order_id and 4424364359907 is the fulfillment_id

body :
{
    "fulfillment_event":{
    "order_id": 4936841101539,
    "fulfillment_id": 4424364359907,
    "status": "IN_TRANSIT"
    }
}
I am getting the following error:
{
    "errors": {
        "event": "Required parameter missing or invalid"
    }
}
I have tried with the following body as well, same endpoint:
{
    "order_id": 4936841101539,
    "fulfillment_id": 4424364359907,
    "status": "IN_TRANSIT"
}
Same error:
{
    "errors": {
        "event": "Required parameter missing or invalid"
    }
}
As per the docs, I'm passing both the order_id and fulfillment_id the required parameters.
 
Here's the response from the orders API for verification of the ids mentioned above:
 
 
Response:
{
    "order": {
        "id": 4936841101539,
        "admin_graphql_api_id": "gid://shopify/Order/4936841101539",
        "app_id": 1999142913,
        "browser_ip": null,
        "buyer_accepts_marketing": false,
        "cancel_reason": null,
        "cancelled_at": null,
        "cart_token": null,
        "checkout_id": null,
        "checkout_token": null,
        "closed_at": null,
        "confirmed": true,
        "contact_email": "agam.dubey@schbang.com",
        "created_at": "2022-09-23T16:57:22+05:30",
        "currency": "INR",
        "current_subtotal_price": "255.00",
        "current_subtotal_price_set": {
            "shop_money": {
                "amount": "255.00",
                "currency_code": "INR"
            },
            "presentment_money": {
                "amount": "255.00",
                "currency_code": "INR"
            }
        },
        "current_total_discounts": "0.00",
        "current_total_discounts_set": {
            "shop_money": {
                "amount": "0.00",
                "currency_code": "INR"
            },
            "presentment_money": {
                "amount": "0.00",
                "currency_code": "INR"
            }
        },
        "current_total_duties_set": null,
        "current_total_price": "330.00",
        "current_total_price_set": {
            "shop_money": {
                "amount": "330.00",
                "currency_code": "INR"
            },
            "presentment_money": {
                "amount": "330.00",
                "currency_code": "INR"
            }
        },
        "current_total_tax": "0.00",
        "current_total_tax_set": {
            "shop_money": {
                "amount": "0.00",
                "currency_code": "INR"
            },
            "presentment_money": {
                "amount": "0.00",
                "currency_code": "INR"
            }
        },
        "customer_locale": null,
        "device_id": null,
        "discount_codes": [],
        "email": "agam.dubey@schbang.com",
        "estimated_taxes": false,
        "financial_status": "paid",
        "fulfillment_status": "fulfilled",
        "gateway": "manual",
        "landing_site": null,
        "landing_site_ref": null,
        "location_id": null,
        "name": "#1081",
        "note": null,
        "note_attributes": [],
        "number": 81,
        "order_number": 1081,
        "order_status_url": "https://ondc-testing.myshopify.com/65211859171/orders/b8ee6055e7f964d97de9b579a3e3743c/authenticate?key=6183e2da2610da6c213b2312dfe5458e",
        "original_total_duties_set": null,
        "payment_gateway_names": [
            "",
            "manual"
        ],
        "phone": "+919399452347",
        "presentment_currency": "INR",
        "processed_at": "2022-09-23T16:57:22+05:30",
        "processing_method": "",
        "reference": null,
        "referring_site": null,
        "source_identifier": null,
        "source_name": "1999142913",
        "source_url": null,
        "subtotal_price": "255.00",
        "subtotal_price_set": {
            "shop_money": {
                "amount": "255.00",
                "currency_code": "INR"
            },
            "presentment_money": {
                "amount": "255.00",
                "currency_code": "INR"
            }
        },
        "tags": "",
        "tax_lines": [],
        "taxes_included": false,
        "test": false,
        "token": "b8ee6055e7f964d97de9b579a3e3743c",
        "total_discounts": "0.00",
        "total_discounts_set": {
            "shop_money": {
                "amount": "0.00",
                "currency_code": "INR"
            },
            "presentment_money": {
                "amount": "0.00",
                "currency_code": "INR"
            }
        },
        "total_line_items_price": "255.00",
        "total_line_items_price_set": {
            "shop_money": {
                "amount": "255.00",
                "currency_code": "INR"
            },
            "presentment_money": {
                "amount": "255.00",
                "currency_code": "INR"
            }
        },
        "total_outstanding": "0.00",
        "total_price": "330.00",
        "total_price_set": {
            "shop_money": {
                "amount": "330.00",
                "currency_code": "INR"
            },
            "presentment_money": {
                "amount": "330.00",
                "currency_code": "INR"
            }
        },
        "total_price_usd": "4.07",
        "total_shipping_price_set": {
            "shop_money": {
                "amount": "75.00",
                "currency_code": "INR"
            },
            "presentment_money": {
                "amount": "75.00",
                "currency_code": "INR"
            }
        },
        "total_tax": "0.00",
        "total_tax_set": {
            "shop_money": {
                "amount": "0.00",
                "currency_code": "INR"
            },
            "presentment_money": {
                "amount": "0.00",
                "currency_code": "INR"
            }
        },
        "total_tip_received": "0.00",
        "total_weight": 0,
        "updated_at": "2022-09-24T13:33:03+05:30",
        "user_id": null,
        "billing_address": {
            "first_name": "Agam",
            "address1": "modi kirana,Agam Dubey,modi kirana,my street",
            "phone": "9399452347",
            "city": "Bilaspur",
            "zip": "495001",
            "province": "Chandigarh",
            "country": "India",
            "last_name": "Dubey",
            "address2": null,
            "company": "",
            "latitude": null,
            "longitude": null,
            "name": "Agam Dubey",
            "country_code": "IN",
            "province_code": "CH"
        },
        "customer": {
            "id": 6406775472355,
            "email": "agam.dubey@schbang.com",
            "accepts_marketing": false,
            "created_at": "2022-09-05T17:40:41+05:30",
            "updated_at": "2022-09-23T16:57:23+05:30",
            "first_name": "Agam",
            "last_name": "Dubey",
            "orders_count": 30,
            "state": "disabled",
            "total_spent": "8546.50",
            "last_order_id": 4936841101539,
            "note": null,
            "verified_email": true,
            "multipass_identifier": null,
            "tax_exempt": false,
            "tags": "",
            "last_order_name": "#1081",
            "currency": "INR",
            "phone": null,
            "accepts_marketing_updated_at": "2022-09-05T17:40:41+05:30",
            "marketing_opt_in_level": null,
            "tax_exemptions": [],
            "sms_marketing_consent": null,
            "admin_graphql_api_id": "gid://shopify/Customer/6406775472355",
            "default_address": {
                "id": 7904465551587,
                "customer_id": 6406775472355,
                "first_name": "Agam",
                "last_name": "Dubey",
                "company": "",
                "address1": "modi kirana,Agam Dubey,modi kirana,My street",
                "address2": null,
                "city": "Bilaspur",
                "province": "Chandigarh",
                "country": "India",
                "zip": "495001",
                "phone": "9399452347",
                "name": "Agam Dubey",
                "province_code": "CH",
                "country_code": "IN",
                "country_name": "India",
                "default": true
            }
        },
        "discount_applications": [],
        "fulfillments": [
            {
                "id": 4424364359907,
                "admin_graphql_api_id": "gid://shopify/Fulfillment/4424364359907",
                "created_at": "2022-09-24T12:55:53+05:30",
                "location_id": 69792530659,
                "name": "#1081.1",
                "order_id": 4936841101539,
                "origin_address": {},
                "receipt": {},
                "service": "manual",
                "shipment_status": null,
                "status": "success",
                "tracking_company": "Delhivery",
                "tracking_number": "1669811347581",
                "tracking_numbers": [
                    "1669811347581"
                ],
                "tracking_url": "https://www.delhivery.com/track/package/1669811347581",
                "tracking_urls": [
                    "https://www.delhivery.com/track/package/1669811347581"
                ],
                "updated_at": "2022-09-24T13:33:03+05:30",
                "line_items": [
                    {
                        "id": 12487074578659,
                        "admin_graphql_api_id": "gid://shopify/LineItem/12487074578659",
                        "fulfillable_quantity": 0,
                        "fulfillment_service": "manual",
                        "fulfillment_status": "fulfilled",
                        "gift_card": false,
                        "grams": 0,
                        "name": "Body Lotion - Oil in Lotion Cherry Blossom & Jojoba Oil - 400ml",
                        "price": "255.00",
                        "price_set": {
                            "shop_money": {
                                "amount": "255.00",
                                "currency_code": "INR"
                            },
                            "presentment_money": {
                                "amount": "255.00",
                                "currency_code": "INR"
                            }
                        },
                        "product_exists": true,
                        "product_id": 7730138087651,
                        "properties": [],
                        "quantity": 1,
                        "requires_shipping": true,
                        "sku": "88441-09820-37",
                        "taxable": false,
                        "title": "Body Lotion - Oil in Lotion Cherry Blossom & Jojoba Oil",
                        "total_discount": "0.00",
                        "total_discount_set": {
                            "shop_money": {
                                "amount": "0.00",
                                "currency_code": "INR"
                            },
                            "presentment_money": {
                                "amount": "0.00",
                                "currency_code": "INR"
                            }
                        },
                        "variant_id": 43001177440483,
                        "variant_inventory_management": "shopify",
                        "variant_title": "400ml",
                        "vendor": "NIVEA Shop",
                        "tax_lines": [
                            {
                                "channel_liable": null,
                                "price": "0.00",
                                "price_set": {
                                    "shop_money": {
                                        "amount": "0.00",
                                        "currency_code": "INR"
                                    },
                                    "presentment_money": {
                                        "amount": "0.00",
                                        "currency_code": "INR"
                                    }
                                },
                                "rate": 0.18,
                                "title": "IGST"
                            }
                        ],
                        "duties": [],
                        "discount_allocations": []
                    }
                ]
            }
        ],
        "line_items": [
            {
                "id": 12487074578659,
                "admin_graphql_api_id": "gid://shopify/LineItem/12487074578659",
                "fulfillable_quantity": 0,
                "fulfillment_service": "manual",
                "fulfillment_status": "fulfilled",
                "gift_card": false,
                "grams": 0,
                "name": "Body Lotion - Oil in Lotion Cherry Blossom & Jojoba Oil - 400ml",
                "price": "255.00",
                "price_set": {
                    "shop_money": {
                        "amount": "255.00",
                        "currency_code": "INR"
                    },
                    "presentment_money": {
                        "amount": "255.00",
                        "currency_code": "INR"
                    }
                },
                "product_exists": true,
                "product_id": 7730138087651,
                "properties": [],
                "quantity": 1,
                "requires_shipping": true,
                "sku": "88441-09820-37",
                "taxable": false,
                "title": "Body Lotion - Oil in Lotion Cherry Blossom & Jojoba Oil",
                "total_discount": "0.00",
                "total_discount_set": {
                    "shop_money": {
                        "amount": "0.00",
                        "currency_code": "INR"
                    },
                    "presentment_money": {
                        "amount": "0.00",
                        "currency_code": "INR"
                    }
                },
                "variant_id": 43001177440483,
                "variant_inventory_management": "shopify",
                "variant_title": "400ml",
                "vendor": "NIVEA Shop",
                "tax_lines": [
                    {
                        "channel_liable": null,
                        "price": "0.00",
                        "price_set": {
                            "shop_money": {
                                "amount": "0.00",
                                "currency_code": "INR"
                            },
                            "presentment_money": {
                                "amount": "0.00",
                                "currency_code": "INR"
                            }
                        },
                        "rate": 0.18,
                        "title": "IGST"
                    }
                ],
                "duties": [],
                "discount_allocations": []
            }
        ],
        "payment_terms": null,
        "refunds": [],
        "shipping_address": {
            "first_name": "Agam",
            "address1": "modi kirana,Agam Dubey,modi kirana,my street",
            "phone": "9399452347",
            "city": "Bilaspur",
            "zip": "495001",
            "province": "Chandigarh",
            "country": "India",
            "last_name": "Dubey",
            "address2": null,
            "company": "",
            "latitude": null,
            "longitude": null,
            "name": "Agam Dubey",
            "country_code": "IN",
            "province_code": "CH"
        },
        "shipping_lines": [
            {
                "id": 4072868217059,
                "carrier_identifier": null,
                "code": "INT.TP",
                "delivery_category": null,
                "discounted_price": "75.00",
                "discounted_price_set": {
                    "shop_money": {
                        "amount": "75.00",
                        "currency_code": "INR"
                    },
                    "presentment_money": {
                        "amount": "75.00",
                        "currency_code": "INR"
                    }
                },
                "phone": null,
                "price": "75.00",
                "price_set": {
                    "shop_money": {
                        "amount": "75.00",
                        "currency_code": "INR"
                    },
                    "presentment_money": {
                        "amount": "75.00",
                        "currency_code": "INR"
                    }
                },
                "requested_fulfillment_service_id": null,
                "source": "Manual",
                "title": "Manual",
                "tax_lines": [],
                "discount_allocations": []
            }
        ]
    }
}
I am unsure as this could be a bug so tagging as bug in the labels as well. Kindly let me know if it's not and if I'm making a mistake here.
 
I have been stuck creating this for 2 days 😞
 
The get endpoint with similar parameters gives me an empty fulfillment_events array like below:
 
Response: 
{
    "fulfillment_events": []
}
Appreciate your help and please feel free to let me know if any more information is required.
Thanks for reading.
 
Agam1997
Replies 0 (0)