Create Product Unit
Create a new product unit in the system. Product units represent individual instances of products that can be tracked and managed independently.
π Request Structureβ
Required Fieldsβ
- Either
productIdORproductExternalIdmust be provided (not both)productId: Internal product IDproductExternalId: External product ID
Optional Fieldsβ
description- Description of the product unitexternalId- External identifier for the product unitproductVariantId- ID of a specific product variantextraFields- Additional fields as key-value pairsimages- Array of image URLs for the product unitdisabled- Whether the unit is disabled (default: false)tags- Tags associated with the product unituserGroupId- UUID of the user group to associate with the unit
π Field Interpretationβ
- URLs in
imagesmust be valid HTTPS URLs externalIdmust follow title string formattagsmust be an array of title stringsuserGroupIdmust be a valid UUIDdisableddefaults to false if not providedextraFieldsaccepts any key-value pairs
π€ Request Formatβ
POST /api/v1/units
Content-Type: application/json
Authorization: ONLIVESITE Credential:ONLIVEAccessKeyId, Signature=CalculatedSignature
{
"productId": "PROD-12345",
"description": "A high-quality wireless mouse",
"externalId": "EXT-UNIT-12345",
"productVariantId": "VARIANT-001",
"images": [
"https://example.com/image1.jpg",
"https://example.com/image2.jpg"
],
"disabled": false,
"tags": ["electronics", "wireless", "mouse"],
"extraFields": {
"color": "red",
"size": "L"
},
"userGroupId": "550e8400-e29b-41d4-a716-446655440000"
}
π₯ Response Formatβ
Success Responseβ
HTTP/1.1 201 Created
Content-Type: application/json
{
"externalId": "EXT-UNIT-12345",
"productId": "PROD-12345",
"productVariantId": "VARIANT-001",
"productExternalId": null,
"description": "A high-quality wireless mouse",
"images": [
"https://example.com/image1.jpg",
"https://example.com/image2.jpg"
],
"organizationId": "123e4567-e89b-12d3-a456-426614174000",
"disabled": false,
"userGroupId": "550e8400-e29b-41d4-a716-446655440000",
"extraFields": {
"color": "red",
"size": "L"
}
}
β Error Responsesβ
This endpoint follows the standard error format.
π Required Permissionsβ
units:createproducts:read(for product validation)
π‘ Tipsβ
- Provide either
productIdorproductExternalId, not both - Ensure all image URLs use HTTPS protocol
- Use meaningful external IDs for better tracking
- Include relevant tags for easier filtering
- Validate UUID format for userGroupId
- Keep descriptions concise but informative