Skip to content

Images

POST /images

Uploads photos for use throughout the app.

Required scopes: images

Params

attribute type required options description version
type String true product, account, user, category Type of image by its purpose. V3 and later
image file true - Binary file V8 and later. Replaces product_image
product_image string true - Binary file V7 and earlier. Replaces image.

VERSIONING

This example uses version > 7

Request

curl -X POST \
  https://app.inventorum.com/api/images/ \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {{oauth_token}}' \
  -H 'X-Api-Version: 12' \
  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
  -F 'image=image-file.jpg' \
  -F type=product

Response

Status 200 OK
{
    "id": 752729,
    "urls": {
        "ipad": "https://app.inventorum.com/uploads/1627/product/ipad.png",
        "thumb": "https://app.inventorum.com/uploads/1627/product/thumb.png",
        "image": "https://app.inventorum.com/uploads/1627/product/ipad.png",
        "ipad_retina": "https://app.inventorum.com/uploads/1627/product/ipad_retina.png",
        "ebay": "https://app.inventorum.com/uploads/1627/product/ebay.png",
        "thumb_retina": "https://app.inventorum.com/uploads/1627/product/thumb_retina.png",
        "original": "https://app.inventorum.com/uploads/1627/product/original.png"
    },
    "type": 0,
    "new": true
}

Bug

API VERSION <=7 returns a negative id field. E.g. "id": -780773

Note

  1. Created image instance always contains attribute new that equals true. This denotes the way the image is handled on the backend side and it's not relevant from the API user perspective.
  2. Created image instance also contains a type value that is a number which is a derivative of value index in type array, starting from 0:
    • "product" = 0
    • "account" = 1
    • "user" = 2
    • "category" = 3

Error

Status 400 Bad Request
{
    "error": {
        "fields": {
            "image": [
                "This field is required."
            ]
        },
        "description": "Serialization error",
        "key": "common.serializer_error"
    }
}