Chilkat Online Tools

Unicode C++ / PrestaShop Webservice Product Resource A-Z / 6 - Upload image

Back to Collection Items

void ChilkatSample(void)
    {
    http.put_BasicAuth(true);    http.put_Login(L"{{webservice_key}}");    http.put_Password(L"password");    req.put_HttpVerb(L"POST");    req.put_Path(L"/api/images/products/1");    req.put_ContentType(L"multipart/form-data");    success = req.AddFileForUpload2(L"image",L" path to file",L"application/octet-stream");
    }

Curl Command

curl -X POST
	-u '{{webservice_key}}:password'
	-H "Content-Type: application/json"
	--form 'image=@"/path/to/file"'
https://localhost:8080/api/images/products/1

Postman Collection Item JSON

{
  "name": "6 - Upload image",
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "exec": [
          "",
          ""
        ],
        "type": "text/javascript"
      }
    }
  ],
  "request": {
    "method": "POST",
    "header": [
      {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
      }
    ],
    "body": {
      "mode": "formdata",
      "formdata": [
        {
          "key": "image",
          "type": "file",
          "src": [
          ]
        }
      ]
    },
    "url": {
      "raw": "{{webservice_url}}/api/images/products/{{product_id}}",
      "host": [
        "{{webservice_url}}"
      ],
      "path": [
        "api",
        "images",
        "products",
        "{{product_id}}"
      ]
    }
  },
  "response": [
  ]
}