Have your say in Community Polls: What was/is your greatest motivation to start your own business?
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.

Re: fulfillment: Required parameter missing or invalid

fulfillment: Required parameter missing or invalid

Janpaweł
Shopify Partner
3 0 0

Hello, i'm trying to fulfill an order:

 

POST https://xxx.myshopify.com/admin/api/2022-10/fulfillments.json HTTP/1.1
Authorization: Basic xxx=
Host: xxx.myshopify.com
Content-Type: application/json

{"fulfillment":{"notify_customer":false,"line_items_by_fulfillment_order":[{"fulfillment_order_id":4610371354793}]}}

but it always ends up with an error:

HTTP/1.1 400 Bad Request
Date: Mon, 12 Dec 2022 11:15:38 GMT
Content-Type: application/json; charset=utf-8
Connection: keep-alive
X-Sorting-Hat-PodId: 168
X-Sorting-Hat-ShopId: 54921035945
Referrer-Policy: origin-when-cross-origin
X-Frame-Options: DENY
X-ShopId: 54921035945
X-ShardId: 168
X-Stats-UserId: 
X-Stats-ApiClientId: 20011515905
X-Stats-ApiPermissionId: 386349203625
X-Shopify-API-Terms: By accessing or using the Shopify API you agree to the Shopify API License and Terms of Use at https://www.shopify.com/legal/api-terms
X-Shopify-API-Version: 2022-10
HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT: 1/40
X-Shopify-Shop-Api-Call-Limit: 1/40
Strict-Transport-Security: max-age=7889238
X-Shopify-Stage: production
Content-Security-Policy: default-src 'self' data: blob: 'unsafe-inline' 'unsafe-eval' https://* shopify-pos://*; block-all-mixed-content; child-src 'self' https://* shopify-pos://*; connect-src 'self' wss://* https://*; frame-ancestors 'none'; img-src 'self' data: blob: https:; script-src https://cdn.shopify.com https://cdn.shopifycdn.net https://checkout.shopifycs.com https://api.stripe.com https://mpsnare.iesnare.com https://appcenter.intuit.com https://www.paypal.com https://js.braintreegateway.com https://c.paypal.com https://maps.googleapis.com https://www.google-analytics.com https://v.shopify.com 'self' 'unsafe-inline' 'unsafe-eval'; upgrade-insecure-requests; report-uri /csp-report?source%5Baction%5D=create&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Ffulfillments&source%5Bsection%5D=admin_api&source%5Buuid%5D=5cfc6b9b-995c-4c58-bd07-03eb41176b34
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Permitted-Cross-Domain-Policies: none
X-XSS-Protection: 1; mode=block; report=/xss-report?source%5Baction%5D=create&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Ffulfillments&source%5Bsection%5D=admin_api&source%5Buuid%5D=5cfc6b9b-995c-4c58-bd07-03eb41176b34
X-Dc: gcp-europe-west4,gcp-us-central1,gcp-us-central1
X-Request-ID: 5cfc6b9b-995c-4c58-bd07-03eb41176b34
CF-Cache-Status: DYNAMIC
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=P92OqEpW0bgIPEDEVWslGipy%2FaQP%2FoHa9acYJGkfSO%2FyPRIqiSWasXHZOYLItARLDyCdiIFytHXo1iM2DYdPHCQFzQwg9W3nlSbQKOlzXawXoH%2BSDcLBeqK3Gw2J%2FgriphIgYAGWvACwNU4LK6rXJ5DjlN79EOk%3D"}],"group":"cf-nel","max_age":604800}
NEL: {"success_fraction":0.01,"report_to":"cf-nel","max_age":604800}
Server-Timing: cfRequestDuration;dur=277.999878
Server: cloudflare
CF-RAY: 77860b122c8858ea-TXL
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400
Content-Length: 66

{"errors":{"fulfillment":"Required parameter missing or invalid"}}

Can you please tell me what am i doing wrong?

Replies 4 (4)

ShopifyDevSup
Shopify Staff
1453 238 525

Hi @Janpaweł 👋

The `line_items_by_fulfillment_order` parameter should include `fulfillment_order_id` and each `fulfillment_order_line_items` should have the `id` and `quantity` properties. Your payload would look something like the below: 

 

{
    "fulfillment": {
          ...
        "line_items_by_fulfillment_order": [
            {
                "fulfillment_order_id": 1234,
                "fulfillment_order_line_items": [
                    {
                        "id": 4321,
                        "quantity": 10
                    }
                ]
            },
            {
                "fulfillment_order_id": 5678,
                "fulfillment_order_line_items": [
                    {
                        "id": 8765,
                        "quantity": 11
                    }
                ]
            }
        ]
    }
}

 

Hope that helps!

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Janpaweł
Shopify Partner
3 0 0

Hello, thank you for your help.

Your documentation (https://shopify.dev/api/admin-rest/2022-10/resources/fulfillment#post-fulfillments) says fulfillment_order_line_items is not mandatory:

 

> fulfillment_order_line_items: (array) The fulfillment order line items and the quantity of each which should be fulfilled. If this property is undefined, then all of the fulfillment order line items of the associated fulfillment order are fulfilled. 

Anyway, i followed your tips and now i have an 404.

Request:

 

POST https://skleptestowyintegratory.myshopify.com/admin/api/2020-04/fulfillments.json HTTP/1.1
Authorization: Basic xxx
Accept: application/json, text/json, text/x-json, text/javascript, application/xml, text/xml
User-Agent: RestSharp/106.6.10.0
Content-Type: application/json
Host: skleptestowyintegratory.myshopify.com
Content-Length: 160
Accept-Encoding: gzip, deflate

{"fulfillment":{"line_items_by_fulfillment_order":[{"fulfillment_order_id":4610371354793,"fulfillment_order_line_items":[{"id":11533833568425,"quantity":1}]}]}}

 

Response:

 

HTTP/1.1 404 Not Found
Date: Tue, 13 Dec 2022 08:46:38 GMT
Content-Type: application/json; charset=utf-8
Connection: keep-alive
X-Sorting-Hat-PodId: 168
X-Sorting-Hat-ShopId: 54921035945
Vary: Accept-Encoding
Referrer-Policy: origin-when-cross-origin
X-Frame-Options: DENY
X-ShopId: 54921035945
X-ShardId: 168
X-Stats-UserId: 
X-Stats-ApiClientId: 20011515905
X-Stats-ApiPermissionId: 386349203625
X-Shopify-API-Terms: By accessing or using the Shopify API you agree to the Shopify API License and Terms of Use at https://www.shopify.com/legal/api-terms
X-Shopify-API-Version: 2022-01
X-Shopify-API-Version-Warning: https://shopify.dev/concepts/about-apis/versioning
HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT: 1/40
X-Shopify-Shop-Api-Call-Limit: 1/40
Strict-Transport-Security: max-age=7889238
X-Shopify-Stage: production
Content-Security-Policy: default-src 'self' data: blob: 'unsafe-inline' 'unsafe-eval' https://* shopify-pos://*; block-all-mixed-content; child-src 'self' https://* shopify-pos://*; connect-src 'self' wss://* https://*; frame-ancestors 'none'; img-src 'self' data: blob: https:; script-src https://cdn.shopify.com https://cdn.shopifycdn.net https://checkout.shopifycs.com https://api.stripe.com https://mpsnare.iesnare.com https://appcenter.intuit.com https://www.paypal.com https://js.braintreegateway.com https://c.paypal.com https://maps.googleapis.com https://www.google-analytics.com https://v.shopify.com 'self' 'unsafe-inline' 'unsafe-eval'; upgrade-insecure-requests; report-uri /csp-report?source%5Baction%5D=create&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Ffulfillments&source%5Bsection%5D=admin_api&source%5Buuid%5D=7c843ccd-c628-4791-a8ad-a9bdfeb2781c
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Permitted-Cross-Domain-Policies: none
X-XSS-Protection: 1; mode=block; report=/xss-report?source%5Baction%5D=create&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Ffulfillments&source%5Bsection%5D=admin_api&source%5Buuid%5D=7c843ccd-c628-4791-a8ad-a9bdfeb2781c
X-Dc: gcp-europe-west4,gcp-us-central1,gcp-us-central1
X-Request-ID: 7c843ccd-c628-4791-a8ad-a9bdfeb2781c
CF-Cache-Status: DYNAMIC
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=OPxVzVFBw%2BnwDALuwTHdaxScCcDhHiVZ%2FdfnY8TMvVC6R%2FGVRHiXx4tsEDY2mEMMs0ewdLsBCFDEImv6a5fdkfSe8TS%2F2pAAtP4qQSSZBpqWnpZCw6bqg8%2FzQ7aPAhHGdPffSW8PAvoPFjL9O23se9kAXMAKDZo%3D"}],"group":"cf-nel","max_age":604800}
NEL: {"success_fraction":0.01,"report_to":"cf-nel","max_age":604800}
Server-Timing: cfRequestDuration;dur=230.999947
Server: cloudflare
CF-RAY: 778d6e2f0bd9266d-TXL
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400
Content-Length: 22

{"errors":"Not Found"}

 

Janpaweł
Shopify Partner
3 0 0

My previous reply disappeared?

Anyway, now i got 404:

 

POST https://skleptestowyintegratory.myshopify.com/admin/api/2020-04/fulfillments.json HTTP/1.1
Authorization: Basic xxx
Accept: application/json, text/json, text/x-json, text/javascript, application/xml, text/xml
User-Agent: RestSharp/106.6.10.0
Content-Type: application/json
Host: skleptestowyintegratory.myshopify.com
Content-Length: 160
Accept-Encoding: gzip, deflate

{"fulfillment":{"line_items_by_fulfillment_order":[{"fulfillment_order_id":4610371354793,"fulfillment_order_line_items":[{"id":11533833568425,"quantity":1}]}]}}

 

resonse:

HTTP/1.1 404 Not Found
Date: Tue, 13 Dec 2022 11:07:42 GMT
Content-Type: application/json; charset=utf-8
Connection: keep-alive
X-Sorting-Hat-PodId: 168
X-Sorting-Hat-ShopId: 54921035945
Vary: Accept-Encoding
Referrer-Policy: origin-when-cross-origin
X-Frame-Options: DENY
X-ShopId: 54921035945
X-ShardId: 168
X-Stats-UserId: 
X-Stats-ApiClientId: 20011515905
X-Stats-ApiPermissionId: 386349203625
X-Shopify-API-Terms: By accessing or using the Shopify API you agree to the Shopify API License and Terms of Use at https://www.shopify.com/legal/api-terms
X-Shopify-API-Version: 2022-01
X-Shopify-API-Version-Warning: https://shopify.dev/concepts/about-apis/versioning
HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT: 1/40
X-Shopify-Shop-Api-Call-Limit: 1/40
Strict-Transport-Security: max-age=7889238
X-Shopify-Stage: production
Content-Security-Policy: default-src 'self' data: blob: 'unsafe-inline' 'unsafe-eval' https://* shopify-pos://*; block-all-mixed-content; child-src 'self' https://* shopify-pos://*; connect-src 'self' wss://* https://*; frame-ancestors 'none'; img-src 'self' data: blob: https:; script-src https://cdn.shopify.com https://cdn.shopifycdn.net https://checkout.shopifycs.com https://api.stripe.com https://mpsnare.iesnare.com https://appcenter.intuit.com https://www.paypal.com https://js.braintreegateway.com https://c.paypal.com https://maps.googleapis.com https://www.google-analytics.com https://v.shopify.com 'self' 'unsafe-inline' 'unsafe-eval'; upgrade-insecure-requests; report-uri /csp-report?source%5Baction%5D=create&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Ffulfillments&source%5Bsection%5D=admin_api&source%5Buuid%5D=83871a3a-050d-4946-adfd-78e3096dc572
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Permitted-Cross-Domain-Policies: none
X-XSS-Protection: 1; mode=block; report=/xss-report?source%5Baction%5D=create&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Ffulfillments&source%5Bsection%5D=admin_api&source%5Buuid%5D=83871a3a-050d-4946-adfd-78e3096dc572
X-Dc: gcp-europe-west4,gcp-us-central1,gcp-us-central1
X-Request-ID: 83871a3a-050d-4946-adfd-78e3096dc572
CF-Cache-Status: DYNAMIC
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=yHeDMO57gYYe8g0SNPeKQwiNeNnBuHwclKCBY%2FbjCgjpA96QG%2Bhupf0y5jlPgIsVNMAItNYkpCgt2RB4fboIYl%2FuWmxP9WV9pHVoKW%2B79uxDHgrxO2hX%2FOwrUgXjtt%2BnkbODLAqF0cAVs1M3vGGBjG2q2Aq7YEs%3D"}],"group":"cf-nel","max_age":604800}
NEL: {"success_fraction":0.01,"report_to":"cf-nel","max_age":604800}
Server-Timing: cfRequestDuration;dur=262.000084
Server: cloudflare
CF-RAY: 778e3cd3690658d8-TXL
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400
Content-Length: 22

{"errors":"Not Found"}

 

ofc order an line ID's are valid 😉

ShopifyDevSup
Shopify Staff
1453 238 525

Thanks for the new  X-Request-ID! 

 

The logs show that fulfillment order ID 4610371354793 is not found on the store "skleptestowyintegratory.myshopify.com". I'd recommend using the `AssignedFulfillmentOrder` endpoint to verify this as well. Alternatively, you can contact us here with your authenticated parter account with permissions to this store/app and we'd be happy to take a closer look. Please be sure to provide the team with the same X-Request-ID (+timestamp) and reference this thread as well. 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog