Skip to main content

Update Product Link

Replace the variants on a linked Easycart product. null links every current and future variant. A non-empty list restricts the link to those variants. The product is the path and cannot change. The change is live immediately, including on a published course, and this call does not publish. Narrowing the list cuts off buyers of the variants you removed. See Product Link Object and Paywall.

Request​

PATCH /players/{playerId}/products/{productId}

Path Parameters​

ParameterTypeRequiredDescription
playerIdstringYesCourse UUID. See Identifiers.
productIdstringYesEasycart product UUID

Request Body​

variant_ids is required. Do not send draft_version. A product_id in the body is ignored.

ParameterTypeRequiredDescription
variant_idsarray|nullYesEasycart variant UUIDs of that product, at most 100. null clears the restriction. [] is 422.

Example Request​

curl -X PATCH "https://app.easy.tools/api/v1/players/8f3c1a62-d047-4e89-9b25-1c6a4d8e0f71/products/2f1c0a2e-7b3d-4e1a-9c55-0a1b2c3d4e5f" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"variant_ids": ["9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d"]
}'

Send null to link every current and future variant:

curl -X PATCH "https://app.easy.tools/api/v1/players/8f3c1a62-d047-4e89-9b25-1c6a4d8e0f71/products/2f1c0a2e-7b3d-4e1a-9c55-0a1b2c3d4e5f" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"variant_ids": null
}'

Response​

Success Response (200)​

The first request returns the restricted link:

{
"data": {
"product_id": "2f1c0a2e-7b3d-4e1a-9c55-0a1b2c3d4e5f",
"product_name": "Course",
"variant_ids": ["9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d"],
"missing": false
}
}

variant_ids null comes back as variant_ids null and missing false.

Response Fields​

See Product Link Object. The response has no preview_url, draft_version, or draft_updated_at.

Error Responses​

Not Found Error (404)​

The course is missing or not a UUID, productId is not a UUID, or the product resolves in Easycart and is not linked to the course. See Identifiers.

{
"error": {
"code": "RESOURCE_NOT_FOUND",
"message": "Resource not found"
}
}

Validation Error (422 Unprocessable Entity)​

[] is 422. A product UUID that Easycart does not resolve is 422. A variant UUID that is unknown, or that belongs to a different product, is 422. A row with missing true has no product UUID, so it cannot be updated. A workspace that is not connected to an Easycart store is 422. Nothing is saved.

{
"error": {
"code": "VALIDATION_ERROR",
"message": "The given data was invalid",
"details": {
"variant_ids": ["variant_ids must not be empty. Send null to link every variant"]
}
}
}

An unknown product UUID uses the same status and message, with details.product_id set to product_id is not a product in this workspace. A variant that is missing or that belongs to another product uses details.variant_ids set to variant_ids is not a price of this product. A variant id that is not a UUID uses variant_ids must be a UUID. More than 100 variants uses variant_ids must contain no more than 100 elements. Omitting variant_ids uses variant_ids must be an array.

Bad Gateway Error (502)​

Easycart answered, but not with a result the API can use. Nothing is saved.

{
"error": {
"code": "UPSTREAM_ERROR",
"message": "EasyCart rejected the request"
}
}

Service Unavailable Error (503)​

Easycart is unreachable or failing. Nothing is saved. Retry later.

{
"error": {
"code": "SERVICE_UNAVAILABLE",
"message": "EasyCart is unavailable"
}
}

Authentication, permission, and rate-limit errors are described in Authorization.