Adding products
const url = 'https://api-admin.billz.ai/v2/supplier-order/add-item?Billz-Response-Channel=HTTP';const options = { method: 'PUT', headers: { 'platform-id': '7d4a4c38-dd84-4902-b744-0488b80a4c01', 'Billz-Response-Channel': 'HTTP', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"ordered_measurement_value":1,"product_id":"aba9d9ad-5d37-4836-81a4-9a60648d087e","retail_price":110000,"supplier_order_id":"e8f19b80-6b2c-41ec-ad0f-0f4fe60aa191","supply_price":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url 'https://api-admin.billz.ai/v2/supplier-order/add-item?Billz-Response-Channel=HTTP' \ --header 'Authorization: Bearer <token>' \ --header 'Billz-Response-Channel: HTTP' \ --header 'Content-Type: application/json' \ --header 'platform-id: 7d4a4c38-dd84-4902-b744-0488b80a4c01' \ --data '{ "ordered_measurement_value": 1, "product_id": "aba9d9ad-5d37-4836-81a4-9a60648d087e", "retail_price": 110000, "supplier_order_id": "e8f19b80-6b2c-41ec-ad0f-0f4fe60aa191", "supply_price": 1 }'Asynchronous method. To receive the result synchronously over HTTP, pass the Billz-Response-Channel: HTTP header — otherwise the response will be 200 {"message": "<correlation_id>"}. Maximum wait is 600 seconds, after which 408 with error.code = TIMEOUT is returned. > ⚠️ A synchronous successful response is unreachable. With the Billz-Response-Channel: HTTP header the request ends with 408 TIMEOUT after 600 seconds, although the operation is performed. The result must be checked with a separate read request.
Error codes: 400 — input validation error; 404 — object not found; 408 — timed out waiting for the asynchronous result; 401, 403, 429, 500 — shared by all methods. Body formats and semantics: Response codes and errors.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Platform identifier. A static value is used for integrations.
HTTP — wait for the event processing result and return it in the HTTP response. Without the header the method returns only the correlation_id of the published event.
Query Parameters
Section titled “Query Parameters”Same as the Billz-Response-Channel header — for clients that cannot send a custom header. If both are passed, the header applies.
Request Bodyrequired
Section titled “Request Bodyrequired”object
From 0 to 10^15, otherwise 400
Wholesale price
Example
{ "ordered_measurement_value": 1, "product_id": "aba9d9ad-5d37-4836-81a4-9a60648d087e", "retail_price": 110000, "supplier_order_id": "e8f19b80-6b2c-41ec-ad0f-0f4fe60aa191", "supply_price": 1}Responses
Section titled “Responses”Event accepted: {"message": "<correlation_id>"}. With the Billz-Response-Channel: HTTP header there is no success response — the request ends with 408 even though the operation is performed; only errors arrive synchronously.
Response of an asynchronous method without the Billz-Response-Channel header — the event has been published.
object
Correlation_id of the published event
Examplegenerated
{ "message": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}