Updating Order - 200 Status Response w/ HTML Body & Order not updated?

Solved
Highlighted
New Member
2 1 1

Hi! I'm trying to update an order via the API. Basically, I am just trying to attach a URL as a string to the order details.

I am receiving a valid 200 response from the API, but the response body is an HTML document, not JSON as the API specifies. Additionally, the order is not being updated with the data that I am sending.

 

My code:

 

photo_url = input_data.get('photo_url')
order_id = input_data.get('order_id')
order_id_num = int(order_id)
api_url = 'https://[api-key]:[api-secret]@myclient.myshopify.com/admin/api/2019-10/orders/#'+order_id+'.json'

data = {
    "order": {
        "id": order_id_num,
        "note_attributes": [
            {
                "name": "Photo Upload URL",
                "value": photo_url
            }
        ]
    }
}

updated_order = requests.put(api_url, json=data)

Any ideas?

 

Thanks!

0 Likes

Success.

New Member
2 1 1

I figured it out...

 

The hash in the request URL before the order id is unnecessary. 

 

I found that confusing in the docs. Hopefully, this helps anyone else who does also!

1 Like