diff --git a/postman/collections/Fleetbase Storefront API/Cart/Add Item to Cart.request.yaml b/postman/collections/Fleetbase Storefront API/Cart/Add Item to Cart.request.yaml index 0f56d26..cf296eb 100644 --- a/postman/collections/Fleetbase Storefront API/Cart/Add Item to Cart.request.yaml +++ b/postman/collections/Fleetbase Storefront API/Cart/Add Item to Cart.request.yaml @@ -14,4 +14,15 @@ body: "quantity": 1, "variants": [] } +scripts: + - type: afterResponse + code: |- + // Update item in Cart and Remove item from cart address {{line_item_id}} — + // the cart ITEM id (cart_item_*), not the product id. Nothing set it. + var json_response = pm.response.json(); + + if (Array.isArray(json_response.items) && json_response.items.length) { + pm.environment.set("line_item_id", json_response.items[0].id); + } + language: text/javascript order: 1000 diff --git a/postman/collections/Fleetbase Storefront API/Cart/Remove item from cart.request.yaml b/postman/collections/Fleetbase Storefront API/Cart/Remove item from cart.request.yaml index cb799b0..9cd4647 100644 --- a/postman/collections/Fleetbase Storefront API/Cart/Remove item from cart.request.yaml +++ b/postman/collections/Fleetbase Storefront API/Cart/Remove item from cart.request.yaml @@ -1,9 +1,6 @@ $kind: http-request description: |- Removes a line item or product from a cart. The response returns the updated cart after the item is removed. -url: "{{base_url}}/{{api_prefix}}/{{namespace}}/carts/{id}/{line_item_id}" +url: "{{base_url}}/{{api_prefix}}/{{namespace}}/carts/{{cart_id}}/{{line_item_id}}" method: DELETE -pathVariables: - id: "" - line_item_id: "" order: 4000 diff --git a/postman/collections/Fleetbase Storefront API/Cart/Update item in Cart.request.yaml b/postman/collections/Fleetbase Storefront API/Cart/Update item in Cart.request.yaml index 1718829..2e50339 100644 --- a/postman/collections/Fleetbase Storefront API/Cart/Update item in Cart.request.yaml +++ b/postman/collections/Fleetbase Storefront API/Cart/Update item in Cart.request.yaml @@ -1,10 +1,17 @@ $kind: http-request -description: |+ - You can update all properties of the Zone. - -url: "{{base_url}}/{{api_prefix}}/{{namespace}}/carts/{id}/{line_item_id}" +description: |- + Updates a line item already in the cart. Send any of `quantity`, `variants`, + `addons` or `scheduled_at`; omitted fields are left unchanged. The response + returns the updated cart. +url: "{{base_url}}/{{api_prefix}}/{{namespace}}/carts/{{cart_id}}/{{line_item_id}}" method: PUT -pathVariables: - id: "" - line_item_id: "" +headers: + - key: Content-Type + value: application/json +body: + type: json + content: |- + { + "quantity": 2 + } order: 3000