Response Structure
Find about the common response and data types used across Firstock.
The API response structure for the Firstock Connect platform typically consists of a header and a body. The header contains information about the status of the API request, including the HTTP status code. The body of the API response contains the data returned by the API in response to the request.
Common code table
Exchanges | Products | Price Types | Transaction Types |
---|---|---|---|
BSE BSE Equity |
C Cash & Carry |
MKT Market Order |
B Buy |
NSE NSE Equity |
I Intraday |
LMT Limit Order |
S Sell |
NFO NSE Futures & Options |
M Market |
SL-LMT Stop Loss Limit Order |
|
BFO BSE Futures & Options |
SL-MKT Stop Loss Market |
||
Successful request
HTTP/1.1 200 OK
Content-Type: application/json
{
"Status": "success",
"data": {}
}
All responses from the API server are JSON with the content-type application/json unless explicitly stated otherwise. A successful 200 OK response always has a JSON response body with a status key with the value success. The data key contains the full response payload.
Failed request
HTTP/1.1 500 Server error
Content-Type: application/json
{
"status": "failed",
"code": "401",
"name": "INVALID_USERID",
"error": {
"field": "userid",
"message": "userid parameter is invalid"
}
}
This JSON structure provides a standardized way of communicating error information from an API, allowing developers to easily understand and handle errors that occur when making API requests. By having a consistent format for error responses, developers can write code to handle errors in a consistent and efficient manner, regardless of the API they are using. The status key indicates the overall status of the request, with a value of failed indicating that the request was not successful. The code key provides a more specific error code, in this case an HTTP status code will be provided. The name key provides an additional error code that is specific to the API being used.
The error key provides further information about the error, including the field that caused the problem ("field" key with a value of the request response) and a description of the problem ("message" key with a value of the error)
Data types
In the JSON response format, the values can be of several different data types, including string, integer, floating-point, or boolean. The specific data type of a value is determined by the context in which it is used and the type of data it represents.
Parameter | Description | Example |
---|---|---|
Timestamp String |
Timestamp string in the request is in the format dd/mm/YYYY hh:mm:ss |
25/08/2022 10:58:00 |