Skip to content

Modify Basket

PUT basket/modifyBasket

The modifyBasket API allows users to update the name of an existing trading basket identified by its unique basket ID.

Parameters

NameTypeRequiredDescription
basketNamestringtrueThe new name for the basket. This is the only modifiable parameter.
basketIdstringtrueThe unique identifier of the basket that you want to modify.

Sample Request Body

json
requestBody={
    "basketName" : "Testing basket for 37283",
    "basketId": "55"
}

Sample Code

bash
curl -X PUT 'https://tradeapi.samco.in/basket/modifyBasket' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'x-session-token: <SESSION_TOKEN>' \
  -d '{"basketName":"Testing basket for 37283","basketId":"55"}'
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 = """
        {
          "basketName": "Testing basket for 37283",
          "basketId": "55"
        }
        """;

    HttpClient client = HttpClient.newHttpClient();

    HttpRequest request = HttpRequest.newBuilder()
        .uri(URI.create("https://tradeapi.samco.in/basket/modifyBasket"))
        .header("Content-Type", "application/json")
        .header("Accept", "application/json")
        .header("x-session-token", "<SESSION_TOKEN>")
        .PUT(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 = {
    basketName: "Testing basket for 37283",
    basketId: "55"
  };

  const response = await fetch('https://tradeapi.samco.in/basket/modifyBasket', {
    method: 'PUT',
    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 = {
  "basketName": "Testing basket for 37283",
  "basketId": "55"
}

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

print(r.json())

Sample Responses

json
{
    "serverTime": "08/08/24 19:19:34",
    "msgId": "80c30a7b-77e1-4231-a0c7-102e1c6ad9f4",
    "status": "Success",
    "statusMessage": "Basket name updated successfully",
    "basketDetails": {
        "basketId": 55,
        "basketName": "Testing basket for 37283"
    }
}
json
{
    "serverTime": "08/08/24 19:19:54",
    "msgId": "dfa4cb48-a042-4c75-90fd-2f2cd4b7a912",
    "status": "Failure",
    "statusMessage": "Basket name already exists"
}

Response Schema

Status Code 200

NameTypeDescription
serverTimestringTime at Server.
msgIdstringThis 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.
statusstringStatus of the order cancellation request. Can be 'success' or 'failure'.
statusMessagestringStatus message for the order cancellation request.
basketDetailsstringAn object that contains information about a specific trading basket.
basketIdstringA unique identifier for the basket. It is typically a numeric value that allows for easy reference and management of the basket within the trading system.
basketNamestringThe name of the basket. This string provides a human-readable identifier for the basket, helping users understand its purpose or the assets it contains.