Get a request log
curl --request GET \
--url https://api.context.dev/v1/logs/{request_id}import requests
url = "https://api.context.dev/v1/logs/{request_id}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.context.dev/v1/logs/{request_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.context.dev/v1/logs/{request_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.context.dev/v1/logs/{request_id}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.context.dev/v1/logs/{request_id}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.context.dev/v1/logs/{request_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"data": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"method": "GET",
"path": "/v1/brand/retrieve",
"status_code": 500,
"error_code": "WEBSITE_ACCESS_ERROR",
"latency_ms": 123,
"credits_used": 123,
"key_id": "<string>",
"tags": [
"<string>"
],
"zdr": true,
"input": {
"query": {},
"body": "<unknown>"
},
"user_agent": "<string>",
"response": "<unknown>",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
},
"request_id": "3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"request_id": "3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91",
"message": "<string>",
"error_code": "INTERNAL_ERROR",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"request_id": "3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91",
"message": "<string>",
"error_code": "INTERNAL_ERROR",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"request_id": "3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91",
"message": "<string>",
"error_code": "INTERNAL_ERROR",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"request_id": "3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91",
"message": "<string>",
"error_code": "INTERNAL_ERROR",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"request_id": "3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91",
"message": "<string>",
"error_code": "INTERNAL_ERROR",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}Request Logs
Retrieve a Request Log
Get one logged API call, including its request input and response body.
GET
/
logs
/
{request_id}
Get a request log
curl --request GET \
--url https://api.context.dev/v1/logs/{request_id}import requests
url = "https://api.context.dev/v1/logs/{request_id}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.context.dev/v1/logs/{request_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.context.dev/v1/logs/{request_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.context.dev/v1/logs/{request_id}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.context.dev/v1/logs/{request_id}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.context.dev/v1/logs/{request_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"data": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"method": "GET",
"path": "/v1/brand/retrieve",
"status_code": 500,
"error_code": "WEBSITE_ACCESS_ERROR",
"latency_ms": 123,
"credits_used": 123,
"key_id": "<string>",
"tags": [
"<string>"
],
"zdr": true,
"input": {
"query": {},
"body": "<unknown>"
},
"user_agent": "<string>",
"response": "<unknown>",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
},
"request_id": "3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"request_id": "3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91",
"message": "<string>",
"error_code": "INTERNAL_ERROR",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"request_id": "3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91",
"message": "<string>",
"error_code": "INTERNAL_ERROR",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"request_id": "3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91",
"message": "<string>",
"error_code": "INTERNAL_ERROR",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"request_id": "3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91",
"message": "<string>",
"error_code": "INTERNAL_ERROR",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"request_id": "3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91",
"message": "<string>",
"error_code": "INTERNAL_ERROR",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}0 Credits
Find the
request_id in List Request Logs, in the request_id field of any API response, or in the X-Request-Id response header.Path Parameters
The request ID of the logged API call.
Response
Log entry
Show child attributes
Show child attributes
Unique id of this API call, also sent in the X-Request-Id response header. Quote it when contacting support about a failed request.
Example:
"3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91"
Credit usage, included whenever a valid API key is provided.
Show child attributes
Show child attributes
Was this page helpful?