Skip to main content

Change Product Bundle

This API allows you to change the product bundle associated with an existing case.

HTTP Request

POST <BASE_URL>/api/v1/cases/:caseId

ParameterTypeDescription
caseIdstringRequired. The unique identifier (UUID) of the case.

Headers

HeaderTypeDescription
cv-api-keystringRequired. Your unique API key for authentication.
Content-TypestringRequired. Must be application/json.

Request Body

The request body is a JSON object with a top-level action field and a productBundle object containing the product bundle details.

FieldTypeDescription
actionstringRequired. The action to be performed. This must be CHANGE_PRODUCT_BUNDLE.
productBundleobjectAn object containing the product bundle details.

productBundle Object

FieldTypeDescription
idstringRequired. The unique identifier (UUID) of the product bundle to assign to the case.

Example Request

curl --location '<BASE_URL>/api/v1/cases/:caseId' \
--header 'cv-api-key: <redacted>' \
--header 'Content-Type: application/json' \
--data-raw '{
"action": "CHANGE_PRODUCT_BUNDLE",
"productBundle": {
"id": "a1b2c3d4-5e6f-7g8h-9i0j-k1l2m3n4o5p6"
}
}

Responses

Success Response

A successful request returns a 200 status code with a message confirming the product bundle was changed and includes the product bundle details.

{
"status": 200,
"success": true,
"message": "Case product bundle changed successfully",
"data": {
"productBundle": {
"id": "a1b2c3d4-5e6f-7g8h-9i0j-k1l2m3n4o5p6",
"name": "Premium Bundle"
}
}
}

Failure Responses

A request can fail for several reasons, returning a 400 Bad Request or a specific error message.

Invalid action in the request body:

If the action field is not a recognized value like CHANGE_PRODUCT_BUNDLE, the API will return a bad request error.

{
"status": 400,
"success": false,
"message": "Invalid request",
"error": "Invalid action"
}

Missing required fields

If the productBundle.id field is missing or empty, the API will return a specific error message.

{
"status": 400,
"success": false,
"message": "Invalid request",
"error": "Product Bundle is required"
}

Case Not Found

This response is returned if no case exists with the provided caseId.

{
"status": 404,
"success": false,
"message": "Invalid request",
"error": "No Case found for provided details!"
}

Permission Denied

This response occurs if the case exists but belongs to a different organization, indicating that the cv-api-key does not have permission to access it.

{
"status": 403,
"success": false,
"message": "Invalid request",
"error": "Permission denied!"
}

Invalid Product Bundle

If the provided product bundle ID does not exist or is invalid, the API will return a 400 Bad Request error.

{
"status": 400,
"success": false,
"message": "Invalid request",
"error": "Invalid product bundle ID"
}