Edit a Quote

Editing a Quote

To edit a quote, please follow the steps outlined below:

  1. Create a Basket from the desired Quote using the Create a Basket based on an Quote endpoint

  2. List the Basket-Lines using the List Basket-Lines endpoint

  3. Perform the desired changes to the Basket-Lines using the Update a Basket-Line endpoint

  4. Create a new Quote from the Basket using the Create a Quote based on a Basket (edit mode) endpoint

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"}, )

Python Example

Edit the attribute of a Basket-Line

Below there are examples of how to edit some of the attributes of a Basket-Line.

How to change the price of a Basket-Line

data = { "unitPrintPrice": "46.50", } url = f"https://my-platform.com/api/v2.0/service-panel/services/1/baskets/1/lines/1/" requests.patch( url, json=data, headers={"Authorization": "Token my-super-secure-token"}, )

Python Example

How to change the material of a Basket-Line

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.

# 1. List the available Material-Offers # In this example, the desired material will be chosen using it's name url = f"https://my-platform.com/api/v2.0/service-panel/services/1/offers/" material_offers = requests.get( url, headers={"Authorization": "Token my-super-secure-token"}, ) desired_material_offer = next( ( offer for offer in material_offers.json() if offer["materialName"] == "Accura Xtreme" ) ) desired_material_offer_id = desired_material_offer["id"] # 2. Send the update request data = { "offerId": desired_material_offer_id, "autoSetPrice": True, } url = f"https://my-platform.com/api/v2.0/service-panel/services/1/baskets/1/lines/1/" requests.patch( url, json=data, headers={"Authorization": "Token my-super-secure-token"}, )

Python Example

Change the post-processings of a Basket-Line

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.

Python Example