Skip to content

User Logout

Logging out user from the application DELETE /logout

Sample Code

bash
curl -X DELETE 'https://tradeapi.samco.in/logout' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'x-session-token: <SESSION_TOKEN>'
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 {
    HttpClient client = HttpClient.newHttpClient();

    HttpRequest request = HttpRequest.newBuilder()
        .uri(URI.create("https://tradeapi.samco.in/logout"))
        .header("Content-Type", "application/json")
        .header("Accept", "application/json")
        .header("x-session-token", "<SESSION_TOKEN>")
        .DELETE()
        .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 response = await fetch('https://tradeapi.samco.in/logout', {
    method: 'DELETE',
    headers,
  });

  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>',
}

r = requests.delete('https://tradeapi.samco.in/logout',
  headers=headers)

print(r.json())

Sample Response

json
{
  "serverTime": "12/12/19 16:20:11",
  "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
  "status": "Success",
  "statusMessage": "Request successful"
}

Response Schema

Status Code 200

NameTypeDescription
serverTimestringTime at the server when the response is generated.
msgIdstringUnique identifier for each request. Quote this identifier to the support team if you face issues.
statusstringResponse status. Indicates whether the request was successful (Success) or failed (Failure).
statusMessagestringStatus message providing additional details about the response or any errors encountered.