How to upload images to a POST request

Good afternoon,

I am relatively new to APIs and Postman and whilst I have been able to nut out most things, there is something I cannot quite understand.

Take the CURL command below:

curl -X POST https://example.com/site/products \
    -u consumer_key:consumer_secret \
    -H "Content-Type: application/json" \
    -d '{
  "name": "Product name",
  "sale_price": "25.50",
  "description": "Body of text",
  "images": [
    {
      "src": "http://site.com/images/image1.jpg"
    },
    {
      "src": "http://site.com/images/image2.jpg"
    }
  ]
}'

Using Postman, I can easily create a new product in the receiving system (called “Product name” or any other information that doesn’t have ‘deeper’ levels), but I am not sure how to use the “image” syntax within Postman to upload 1 or 2 or however-many images to the system.

What format do I use for the key and value, please?

Could somebody point me in the right direction - any help much appreciated.

Greg

1 Like