WooCommerce API - If I send order data to a custom API and the API sends back the data how do I associate it to the correct Order ID?

Viewed 13

I'm currently working on a WooCommere site which I need to update orders on via an API.

I'm a total novice when it comes to working with API's. I have created a webhook that fires when an order is created, this works fine.

I can also update the JSON to change meta such as the customer name and POST the data back and I can see it updated in the back end when using the following url https://xxxxx/wp-json/wc/v3/orders/5858

My question is how do I associate the response to an order? For example, if I send over 20 orders to the api how can I send them back to my site and get the orders updated?

eg order ID 001,002,003 etc

Do I use the following url:

https://xxxxx/wp-json/wc/v3/orders/

If I append the url with the order ID the single 001 order updates no problem https://xxxxx/wp-json/wc/v3/orders/001

I've read a couple of tutorials but they all seem to work by updating 1 order. I don't understand how to do this with multiple orders surely I don't need to manually create the URL for each order so the API can update them?

I'm totally lost and feel like I'm missing something totally basic.

Any pointers would be very much appreciated.

0 Answers
Related