Fulfill an order using API / "fulfillment": "Required parameter missing or invalid"

Solved
AlecMartin3
New Member
4 0 0

Hi there, 

PROBLEM:

I am trying to use the Shopify 2020-04 API to change the fulfillment status of an order, so that it becomes fulfilled using an external server. I don't actually want to pass in information into the fufillment, although that seems like a step that would be impossible to skip so I don't mind using dummy data, but every time I try and do so I get the response :Postman_ryOeFdE3c6.pngI've tried many variations, put my POST request seems to alway get back this (in both console and Postman)

X-REQUST-ID of one of many attempts.

'X-Request-Id': bd1daffa-b093-4cc2-abb8-0226688b7b93

WHAT I'VE DONE:

So inorder to get this response I've done this.

InkedhN8UbFG_LI.jpg

With the last inked out thing being the order id, and I gave it this information 

 {
     fulfillments: {
        location_id: 905684977,
        tracking_number:[1234567],
        line_items: [
            {
            id: 5562096287911,
            quantity: 1
            },
        ],
    }
 }

 

Or the Node version:

 

    return new Promise((resolve, reject) => {
      request.post(
        {
          url: `https://${SHOPIFY_API_KEY}:${SHOPIFY_API_PASSWORD}@${SHOPIFY_STORE}.myshopify.com/admin/api/2020-04/orders/${id}/fulfillments.json`,
          fulfillments: {
            location_id: 905684977,
            tracking_number: [123456],
            line_items: [
              {
                id: 5562096287911,
                quantity: 1,
              },
            ],
          },
        },
        function (err, body) {
          if (err) {
            console.log(err);
            return reject(err);
          }
          resolve(body.body);
        }
      );
    });

I have tried other variations on this but this is my most recent version that I've made after scouring the internet for a long while. Both of them return some variation of:

 

Postman_ryOeFdE3c6.png

I've also tried to do:

 

    return new Promise((resolve, reject) => {
      request.put(
        {
          url: `https://${SHOPIFY_API_KEY}:${SHOPIFY_API_PASSWORD}@${SHOPIFY_STORE}.myshopify.com/admin/api/2020-04/orders/2520974033063.json`,
          orders: {
            fulfillment_status: "fulfilled"
          },
        },
        function (err, body) {
          if (err) {
            console.log(err);
            return reject(err);
          }
          resolve(body.body);
        }
      );
    }

But unfortunately although put works with email, it does not work with fulfillment status.

RESOURCES:

There was this shopify tutorial for fufillments, but it went over my head:

https://shopify.dev/tutorials/manage-fulfillments-with-fulfillment-and-fulfillmentorder-resources

Here are also some of the other questions people have asked are that are similar to mine, but that I either didn't find too helpful, or couldn't glean the correct answer out of:

https://shopify.dev/tutorials/manage-fulfillments-with-fulfillment-and-fulfillmentorder-resources

https://community.shopify.com/c/Shopify-APIs-SDKs/Fullfillment-API-Error-quot-fulfillment-quot-quot-...

https://community.shopify.com/c/Shopify-APIs-SDKs/Manually-Fulfilling-Orders-via-REST-Admin-API/td-p...

https://community.shopify.com/c/Shopify-APIs-SDKs/Fullfillment-API-Error-Required-parameter-missing-...

https://community.shopify.com/c/Shopify-APIs-SDKs/REST-API-How-to-update-order-fulfillment-status/m-... - very similar to mine

 

A working example, or example code would be best, but any and all help is always apreciated.

Thanks

 

 

 

0 Likes
SBD_
Shopify Staff
Shopify Staff
1043 141 183

This is an accepted solution.

Hey @AlecMartin3 

request.post expects url, body and json values. Try something like this (also take note of fulfillment vs fulfillments):

 

request.post({
    url: '...',
    body: { fulfillment: { ... } },
    json: true
  }, function(error, response, body){
  console.log(body);
})

 

AlecMartin3
New Member
4 0 0

Hey @SBD_!

Thanks for the help. I eventually got it to work. I implemented the json: true, as well as the body: tag and it gave a { errors: 'Not Found' } exception, but then I realized I used the wrong location id, and eventually it worked.

Again, thanks!

0 Likes