Create / update BIG pricelists

Create / update BIG pricelists

Contents

Info

Add a BIG price list in one single call. This call must be asynchronous. The request will be added to a job queue and picked up by a background worker.

Step 1 - Make call

URL

PUT /api/origin/CLOUDSUITE/pricelist/PrijslijstA/

HTTP Header

If the PUT, POST, or request has a header X-CS-HANDLE-ASYNC with a value of 'yes', '1', or 'true' (case insensitive), the request will be added to a job queue and picked up by a background worker.

Name: X-CS-HANDLE-ASYNC Value: true

Request

{ "key": "PrijslijstA", "origin": "CLOUDSUITE", "type": "group", "name": "PrijslijstA", "rounding": "0.01", "kind": "sale", "active": true, "currency": "EUR", "company": "CLOUDSUITEBV", "product_contracts": [ { "key": "PrijslijstA_contract", "origin": "CLOUDSUITE", "active": true, "start_date": "2023-10-01", "end_date": "2023-10-20", "lines": [ { "product": "PRODUCTID1", "base": "list_price", "tiers": [ { "quantity": 1, "value": "90.00" }, { "quantity": 100, "value": "80.00" } ] }, { "product": "PRODUCTID2", "base": "list_price", "tiers": [ { "quantity": 1, "value": "91.00" }, { "quantity": 100, "value": "81.00" } ] } ] }, { "key": "PrijslijstA_contract2", "origin": "CLOUDSUITE", "active": true, "start_date": "2023-11-01", "end_date": "2023-12-20", "lines": [ { "product": "PRODUCTID3", "base": "list_price", "tiers": [ { "quantity": 1, "value": "90.00" }, { "quantity": 100, "value": "80.00" } ] }, { "product": "PRODUCTID4", "base": "list_price", "tiers": [ { "quantity": 1, "value": "91.00" }, { "quantity": 100, "value": "81.00" } ] } ] } ] }

Response

The response to this request is an HTTP code 202 Accepted and contains a Location header with a URI where the job status can be queried.

Location: https://test.cloudsuite.io/api/task/{guid}

Step 2 - Get status

The location value of the previous call must be stored and periodically called. The response will be a status message or the result of the pricelist (the actual pricelist or the errors)

The location value of the response must be fetched with the same credentials as the API

URL

GET /task/{task_id}/

Result

This will return the status of the task.

{ "task": "73adec49-77e9-4181-8650-aa852ff6a9e6\n", "status": "PENDING" }

As long as the task returns a status PENDING, it will not be finished. You must fetch the status periodically until it is finished.

After 24 hours, the status is undefined. The price list will always be handled within this timeframe.

If the task is finished, it will redirect you to the return the result of the pricelist. Just like you send the pricelist in the sync method

© 2024 CloudSuite BV, All rights reserved