Login Code
GET /webSecretCode
The Web Login Secret Code API provides a secure and efficient way to authenticate users without the need for traditional username and password credentials. This API allows users to request a One-Time Password (OTP) that can be used for logging into the web portal at Samco.
Sample Code
bash
curl -X GET 'https://tradeapi.samco.in/webSecretCode' \
-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/webSecretCode"))
.header("Content-Type", "application/json")
.header("Accept", "application/json")
.header("x-session-token", "<SESSION_TOKEN>")
.GET()
.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/webSecretCode', {
method: 'GET',
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.get('https://tradeapi.samco.in/webSecretCode',
headers=headers)
print(r.json())Sample Response
json
{
"serverTime": "15/10/24 09:16:36",
"msgId": "40c5b113-0aa6-4399-b9e0-ab5e243ae683",
"status": "Success",
"statusMessage": "Secret code genererated successfully.",
"data": {
"timeRemainingInSeconds": 120,
"OTP": "QOHG6854"
}
}Response Schema
Status Code 200
| Name | Type | Description |
|---|---|---|
serverTime | string | The date and time when the server generated the response. |
msgId | string | A unique identifier for the API response message. Useful for tracking or debugging purposes. |
status | string | The status of the API response. Possible values are 'Success', 'Error', or 'Failure'. |
statusMessage | string | A message describing the result of the API call. |
data | Object | An object containing specific data related to the OTP request. |
timeRemainingInSeconds | Integer | Specifies the remaining time (in seconds) for which the OTP is valid. This helps users understand how long they have to use the OTP before it expires. |
OTP | string | The generated One-Time Password (OTP) that the user must enter to complete the login process. This code is unique and time-sensitive, ensuring secure access to the system. |