Skip to main content

Update Product Unit

Update an existing product unit's properties. All fields are optional in update requests - only provided fields will be modified.

πŸ“ Request Structure​

Updatable Fields​

  • description - Description of the product unit
  • externalId - External identifier for the product unit
  • productVariantId - ID of the product variant
  • extraFields - Additional fields as key-value pairs
  • images - Array of image URLs for the product unit
  • disabled - Whether the unit is disabled
  • tags - Tags associated with the unit
  • userGroupId - UUID of the user group

πŸ“˜ Field Interpretation​

  • Omitted fields remain unchanged
  • All fields are optional in update requests
  • Arrays replace existing values
  • Objects (extraFields) are merged with existing
  • Images must be valid HTTPS URLs
  • Tags must be valid title strings

πŸ“€ Request Format​

PUT /api/v1/units/UNIT-123
Content-Type: application/json
Authorization: ONLIVESITE Credential:ONLIVEAccessKeyId, Signature=CalculatedSignature

{
"description": "Updated demo unit for display",
"externalId": "EXT-UNIT-12345",
"productVariantId": "VARIANT-002",
"images": [
"https://example.com/unit1-updated.webp",
"https://example.com/unit2-updated.webp"
],
"disabled": false,
"tags": ["electronics", "updated"],
"extraFields": {
"location": "Store B",
"condition": "Excellent"
},
"userGroupId": "550e8400-e29b-41d4-a716-446655440000"
}

πŸ“₯ Response Format​

Success Response​

HTTP/1.1 200 OK
Content-Type: application/json

{
"externalId": "EXT-UNIT-12345",
"productId": "123e4567-e89b-12d3-a456-426614174000",
"productVariantId": "VARIANT-002",
"productExternalId": "PROD-EXT-123",
"description": "Updated demo unit for display",
"images": [
"https://example.com/unit1-updated.webp",
"https://example.com/unit2-updated.webp"
],
"organizationId": "123e4567-e89b-12d3-a456-426614174000",
"disabled": false,
"userGroupId": "550e8400-e29b-41d4-a716-446655440000",
"extraFields": {
"location": "Store B",
"condition": "Excellent"
}
}

Error Responses​

Invalid Request (400 Bad Request)​

{
"statusCode": 400,
"message": "Invalid update parameters",
"errors": [
{
"field": "externalId",
"message": "Must be a valid title string"
}
]
}

Unit Not Found (404 Not Found)​

{
"statusCode": 404,
"message": "Product unit not found"
}

Invalid User Group (422 Unprocessable Entity)​

{
"statusCode": 422,
"message": "Invalid user group ID",
"errors": [
{
"field": "userGroupId",
"message": "User group not found"
}
]
}

πŸ”’ Required Permissions​

  • units:update
  • units:manage (for certain fields)

πŸ’‘ Tips​

  • Only include fields that need updating
  • Validate all URLs and UUIDs
  • Keep descriptions concise
  • Update tags thoughtfully
  • Consider impact on related systems
  • Document significant changes