Headers
This endpoint allows users to retrieve a JSON response of the headers their application is sending, aiding in troubleshooting authentication issues, particularly with the Authorization header.
tip
The values in sensitive headers such as Authorization are partially redacted in the response for security purposes.
Endpoint
https://api.marketdata.app/headers/
Method
GET
Request Example
- HTTP
- JavaScript
- TypeScript
- Python
- PHP
- Java
- Kotlin
headersCheck.js
import { MarketDataClient } from "@marketdata/sdk";
const client = new MarketDataClient();
try {
const h = await client.utilities.headers();
console.log(h["user-agent"]);
console.log(h["accept-encoding"]);
} catch (error) {
console.error(error);
}
headersCheck.ts
import { MarketDataClient } from "@marketdata/sdk";
import type { HeadersResponse } from "@marketdata/sdk";
const client = new MarketDataClient();
try {
const h: HeadersResponse = await client.utilities.headers();
console.log(h["user-agent"]);
console.log(h["accept-encoding"]);
} catch (error) {
console.error(error);
}
headersCheck.py
import requests
url = "https://api.marketdata.app/headers/"
response = requests.get(url)
print(response.text)
headersCheck.php
use MarketDataApp\Client;
$client = new Client();
$headers = $client->utilities->headers();
// Display all headers
echo $headers;
HeadersCheck.java
import com.marketdata.sdk.MarketDataClient;
public class HeadersCheck {
public static void main(String[] args) {
try (MarketDataClient client = new MarketDataClient()) {
System.out.println(client.utilities().headers().values());
}
}
}
HeadersCheck.kt
import com.marketdata.sdk.MarketDataClient
fun main() {
MarketDataClient().use { client ->
println(client.utilities().headers().values())
}
}
Response Example
{
"accept": "*/*",
"accept-encoding": "gzip",
"authorization": "Bearer *******************************************************YKT0",
"cache-control": "no-cache",
"cf-connecting-ip": "132.43.100.7",
"cf-ipcountry": "US",
"cf-ray": "85bc0c2bef389lo9",
"cf-visitor": "{\"scheme\":\"https\"}",
"connection": "Keep-Alive",
"host": "api.marketdata.app",
"postman-token": "09efc901-97q5-46h0-930a-7618d910b9f8",
"user-agent": "PostmanRuntime/7.36.3",
"x-forwarded-proto": "https",
"x-real-ip": "53.43.221.49"
}
Response Attributes
- Success
- Error
-
Headers
objectA JSON object representing the headers received from the user's request. This object includes standard and custom headers along with their respective values.
-
s
stringStatus will be
errorif the request produces an error response. -
errmsg
stringAn error message.
This endpoint is particularly useful for debugging issues related to authentication by allowing users to see exactly what headers are being sent to the API.