Another "Required parameter missing or invalid" thread /order.json with API

Solved
Highlighted
New Member
3 0 0

I'm trying to programmatically create orders for this dummy item here. Here's the curl I used:

 

curl -X POST 'https://key:secret@exe-test-store.myshopify.com/admin/api/2019-07/products.json' \
  -H 'Content-Type: application/json' \
  -d '{
    "order": {
      "line_items": [
        {
          "product_id": 1884330262574,
          "variant_id": 16960861732910,
          "quantity": 1
        }
      ],
      "financial_status": "pending"
    }
  }
  '

Axios is having the same issues... It seems from the documentation you can just use a variant ID and not even a product ID but I'm still seeing the following error:

 

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

I feel like I'm this close to cracking the case. In fact, I managed to programmatically add the order ONCE but not since then (I'm not sure if lack of customer prevented it from being created as a duplicate or what but I lost the working code.)

 

It feels like I'm not getting the IDs right - please refer to the item xml link.

 

Thank you much in advance 🙏

0 Likes

Success.

Shopify Partner
48 3 11

One quick thing, I've noticed.

You want to create an order https://help.shopify.com/en/api/reference/orders/order#create-2019-07, but in your code it says you are using the products.json, but instead it should be the orders.json.

ui-gab
Vancouver, BC Canada
https://www.uiavenue.ca
uiavenue.help@gmail.com
We specialize in Shopify App Development. If you need help just reach out.
0 Likes