MobiariDocs
Admin APIProducts

Add a library file to a product's gallery

POST
/stores/{store_id}/products/{product_id}/images/associate

Copies an image from the tenant's file library into the product's gallery, with resized renditions.

Authorization

bearer_auth
AuthorizationBearer <token>

Authorization: Bearer <token>. Either a session access token from POST /auth/login (refresh it with POST /auth/refresh) or a store API token (mobi_st_…). A store API token works only for the store it was issued in, and can do at most what its issuing user can there, narrowed to the scopes it was issued with.

In: header

Path Parameters

store_id*string

Store id

Formatuuid
product_id*string

Product id

Formatuuid

Header Parameters

Idempotency-Key?string

A unique value (e.g. a UUID) per logical request. Retrying with the same key within 24 hours replays the first response instead of repeating the side effect; the replay carries Idempotent-Replayed: true. Reusing a key for a different request is a 422 idempotency_key_reused; retrying while the first is still running is a 409 idempotency_request_in_progress. JSON bodies up to 1 MB.

Lengthlength <= 255

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/stores/497f6eca-6276-4993-bfeb-53cbbbba6f08/products/497f6eca-6276-4993-bfeb-53cbbbba6f08/images/associate" \  -H "Content-Type: application/json" \  -d '{    "file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767"  }'
{
  "image": {
    "alt_text": "string",
    "cdn_url": "string",
    "created_at": "2019-08-24T14:15:22Z",
    "extra_variant_ids": [
      "b2141a49-c616-47cb-817a-ab59b7d403de"
    ],
    "file_path": "string",
    "file_size_bytes": 0,
    "filename": "string",
    "height": 0,
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "image_kind": "string",
    "image_size": "string",
    "is_active": true,
    "is_primary": true,
    "media_type": "string",
    "mime_type": "string",
    "original_filename": "string",
    "position": 0,
    "poster_url": "string",
    "product_id": "0d012afa-f885-4e65-aeca-37e27701e2d1",
    "product_variant_id": "3346b03a-4660-4dfb-b5d0-e13608e6ced8",
    "provider": "string",
    "updated_at": "2019-08-24T14:15:22Z",
    "width": 0,
    "variants": [
      {
        "cdn_url": "string",
        "created_at": "2019-08-24T14:15:22Z",
        "file_path": "string",
        "file_size_bytes": 0,
        "height": 0,
        "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
        "mime_type": "string",
        "product_image_id": "54609007-3ca2-40c6-ae53-a6ebd6da0a5e",
        "quality": 0,
        "variant_name": "string",
        "width": 0
      }
    ]
  },
  "upload_url": "string"
}
{
  "code": "not_found",
  "details": {},
  "error": "Order not found"
}
{
  "code": "not_found",
  "details": {},
  "error": "Order not found"
}
{
  "code": "not_found",
  "details": {},
  "error": "Order not found"
}
{
  "code": "not_found",
  "details": {},
  "error": "Order not found"
}
{
  "code": "not_found",
  "details": {},
  "error": "Order not found"
}
{
  "code": "not_found",
  "details": {},
  "error": "Order not found"
}