Skip to content

Delete Basket Order

DELETE basket/deleteBasketOrder

The Delete Basket Order API endpoint allows you to remove a specific order from a basket. To use this API, you need to provide the basketId and basketOrderId in the request body. Upon successful deletion of the order, the server responds with a confirmation message indicating the operation was successful, including a timestamp and a unique message ID for tracking purposes.

Parameters

NameTypeRequiredDescription
basketIdIntegertrueThe unique identifier for the basket from which an order needs to be deleted.
basketOrderIdIntegertrueThe unique identifier for the order within the basket that needs to be deleted.

Sample Code

bash
curl -X DELETE 'https://tradeapi.samco.in/basket/deleteBasketOrder' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'x-session-token: <SESSION_TOKEN>' \
  -d '{"basketId":6,"basketOrderId":12}'
java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Sample {
  public static void main(String[] args) throws Exception {
    String requestBody = """
        {
          "basketId": 6,
          "basketOrderId": 12
        }
        """;

    HttpClient client = HttpClient.newHttpClient();

    HttpRequest request = HttpRequest.newBuilder()
        .uri(URI.create("https://tradeapi.samco.in/basket/deleteBasketOrder"))
        .header("Content-Type", "application/json")
        .header("Accept", "application/json")
        .header("x-session-token", "<SESSION_TOKEN>")
        .method("DELETE", HttpRequest.BodyPublishers.ofString(requestBody))
        .build();

    HttpResponse<String> response =
        client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(response.body());
  }
}
js
(async () => {
  const headers = {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'x-session-token': '<SESSION_TOKEN>',
  };

  const requestBody = {
    basketId: 6,
    basketOrderId: 12
  };

  const response = await fetch('https://tradeapi.samco.in/basket/deleteBasketOrder', {
    method: 'DELETE',
    headers,
    body: JSON.stringify(requestBody),
  });

  const data = await response.json();
  console.log(data);
})();
py
import requests
import json

headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'x-session-token': '<SESSION_TOKEN>',
}

requestBody = {
  "basketId": 6,
  "basketOrderId": 12
}

r = requests.delete('https://tradeapi.samco.in/basket/deleteBasketOrder',
  data=json.dumps(requestBody),
  headers=headers)

print(r.json())

Sample Responses

json
{
    "serverTime": "21/08/24 15:43:38",
    "msgId": "8e9f3c6f-ee6a-440b-a1a6-9ef9e46edc58",
    "status": "Success",
    "statusMessage": "Basket Order Deleted Successfully"
}
json
{
    "serverTime": "21/08/24 15:56:10",
    "msgId": "f4411c2d-20f7-4fa1-90e7-94aeedc527bf",
    "status": "Failure",
    "statusMessage": "The provided BasketIds are invalid: [2]"
}

Response Schema

Status Code 200

NameTypeDescription
serverTimestringThe timestamp indicating when the server processed the request.
msgIdstringA unique identifier for the message or transaction. Useful for tracking or debugging.
statusstringStatus of the order cancellation request. Can be success, error, or failure.
statusMessagestringA descriptive message about the status of the operation.