I am receiving a 422 error from the Shopify API. I've created a simplified version of the Javascript that I am using:
let response = await axios.get((`${ shopify_url }/admin/api/2022-04/orders/${ order_id }/fulfillment_orders.json`), shopify_config)
let fulfillment = {
fulfillment: {
message: fulfillment_notify_customer,
notify_customer: fulfillment_notify_customer,
tracking_info: null,
line_items_by_fulfillment_order: [{
fulfillment_order_id: response.data.fulfillment_orders[0].id,
fulfillment_order_line_items: [{
id: line_item_id,
quantity: line_item_qty
}]
}]
}
};
response = await axios.post((`${ shopify_url }/admin/api/2022-04/fulfillments.json`), fulfillment, shopify_config);
The response is: (422) ERR_BAD_REQUEST
I have confirmed all the values although I believe this error is solely related to syntax/structure of the object, rather than ID values.
As an FYI: I know this is ugky code. My actual code has error-checking, logging, and is promise-based (not using async/await).