Delete Basket
DELETE basket/deleteBasket
This API endpoint allows users to delete a specified trading basket from their account. By removing the trading basket identified by the given basket ID, all associated trades and configurations will be permanently deleted from the system.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
basketId | string | true | The unique identifier of the trading basket to be deleted. |
Sample Request Body
json
requestBody={
"basketId" : "65"
}Sample Code
bash
curl -X DELETE 'https://tradeapi.samco.in/basket/deleteBasket' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'x-session-token: <SESSION_TOKEN>' \
-d '{"basketId":"65"}'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": "65"
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://tradeapi.samco.in/basket/deleteBasket"))
.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: "65"
};
const response = await fetch('https://tradeapi.samco.in/basket/deleteBasket', {
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": "65"
}
r = requests.delete('https://tradeapi.samco.in/basket/deleteBasket',
data=json.dumps(requestBody),
headers=headers)
print(r.json())Sample Responses
json
{
"serverTime": "08/08/24 19:08:35",
"msgId": "b591eeb5-3214-4b0e-b892-81d1ef0e0f01",
"status": "Success",
"statusMessage": "Baskets Deleted Successfully"
}json
{
"serverTime": "08/08/24 19:24:29",
"msgId": "d38debfc-22bd-4faa-8e1c-e5e156aa4a94",
"status": "Failure",
"statusMessage": "The provided BasketIds are invalid: [basketId]"
}Response Schema
Status Code 200
| Name | Type | Description |
|---|---|---|
serverTime | string | Time at Server. |
msgId | string | This is a unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request. |
status | string | Status of the order cancellation request. Can be 'success' or 'failure'. |
statusMessage | string | Status message for the order cancellation request. |