Chilkat Online Tools

Delphi (DLL) / PrestaShop Webservice Product Resource A-Z / 6 - Upload image

Back to Collection Items

var

begin
CkHttp_putBasicAuth(http,True);CkHttp_putLogin(http,'{{webservice_key}}');CkHttp_putPassword(http,'password');CkHttpRequest_putHttpVerb(req,'POST');CkHttpRequest_putPath(req,'/api/images/products/1');CkHttpRequest_putContentType(req,'multipart/form-data');success := CkHttpRequest_AddFileForUpload2(req,'image',' path to file','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": [
  ]
}