...
Create a Basket from the desired Quote using the Create a Basket based on an Quote endpoint
List the Basket-Lines using the List Basket-Lines endpoint
Perform the desired changes to the Basket-Lines using the Update a Basket-Line endpoint
Create a new Quote from the Basket using the Create a Quote based on a Basket (edit mode) endpoint
Code Block |
---|
import requests # 1. Create a Basket from the desired Quote url = "https://my-platform.com/api/v2.0/service-panel/services/1/baskets/from-quote/1/" created_basket = requests.post( url, headers={"Authorization": "Token my-super-secure-token"}, ) customer_id = created_basket.json()["customer"]["id"] basket_id = created_basket.json()["id"] # 2. List the Basket-Lines # In this example, the desired line will be chosen using the filename url = ( f"https://my-platform.com/api/v2.0/service-panel/services/1/baskets/{basket_id}/lines/" ) lines = requests.get( url, headers={"Authorization": "Token my-super-secure-token"}, ) desired_basket_line = next( ( line for line in lines.json() if line["file"]["originalFileName"] == "Drone_V2_Print_Arm_A_x6.stl" ) ) desired_basket_line_id = desired_basket_line["id"] # 3. Perform the desired changes to the Basket-Lines # In this example, the unitPrice will be changed data = { "unitPrintPrice": "46.50", } url = f"https://my-platform.com/api/v2.0/service-panel/services/1/baskets/{basket_id}/lines/{desired_basket_line_id}/" requests.patch( url, json=data, headers={"Authorization": "Token my-super-secure-token"}, ) # 4. Create a new Quote from the Basket data = { "basketId": basket_id, "userId": customer_id, } url = f"https://my-platform.com/api/v2.0/service-panel/services/1/edit-quote/" requests.post( url, json=data, headers={"Authorization": "Token my-super-secure-token"}, ) |
...
List the available Material-Offers using the List Material-Offers endpoint. Get the ID of the desired offer, and then use it in the payload body of the update request. Make sure to set autoSetPrice
to True
in the payload body, so that the price of the material is calculated.
...
List the available Post-Processings for a material that is assigned to a given Basket-Line, using the List Post-Processings for a Material-Offer endpoint. Get the ID of the desired Post-Processing, and then use it in the payload body of the update request. Make sure to set autoSetPrice
to True
in the payload body, so that the price of the Post-Processing is calculated.
...