Skip to content

Link a video to a product

POST
/stores/{storeRef}/products/{productId}/videos/link
curl --request POST \
--url https://apibase.ecomweb.app/api/v1/stores/example/products/1/videos/link \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '{ "asset_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "sort_order": 0, "is_primary": true }'

Attaches a video that is already uploaded to the store’s media library to the product. Linking the same video again updates the existing link.

Required scopes: write:products

productId
required
integer

The product ID.

storeRef
required
string

The store’s ref, as returned by GET /stores.

Media typeapplication/json
object
asset_id
required

ID of a video already uploaded to the store’s media library.

string format: uuid
sort_order

Position among the product’s videos. Defaults to 0.

number
0
is_primary

Whether this is the product’s primary video. Defaults to true.

boolean
default: true
Media typeapplication/json
object
links
required

The links that were created or updated.

Array<object>
object
extra

Extra link data, or null.

object
key
additional properties
any
id
required

Link ID.

string
asset_id
required

ID of the linked asset.

string
entity_type
required

Always product.

string
entity_id
required

ID of the product.

string
field
required

Always video.

string
sort_order
required

Sort order among the product’s videos.

number
is_primary
required

Whether this is the product’s primary video.

boolean
created_by
required

ID of the user that created the link, or null.

string
nullable
created_at
required

When the link was created, as an ISO 8601 timestamp.

string
message
required

A readable result message.

string

Example generated

{
"links": [
{
"extra": {},
"id": "example",
"asset_id": "example",
"entity_type": "example",
"entity_id": "example",
"field": "example",
"sort_order": 1,
"is_primary": true,
"created_by": "example",
"created_at": "example"
}
],
"message": "example"
}

The request is malformed or failed validation.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}

The key is missing, invalid, revoked or expired.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}

The key may not do this: a missing scope, a readonly key, a publishable key on a Store API route, or a disallowed origin.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}

The resource does not exist in this store.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}