No items found.
curl -X GET 'https://api.example.com/data' \
-H 'Authorization: Bearer YOUR_API_KEY'
fetch('https://api.example.com/data', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error(error));
import requests
headers = {
'Authorization': 'Bearer YOUR_API_KEY'
}
response = requests.get('https://api.example.com/data', headers=headers)
print(response.json())
{
"status": "success",
"data": {
"id": "12345",
"name": "Example Item",
"price": 49.99,
"available": true
}
}
{
"status": "error",
"message": "Unauthorized. Please provide a valid API key."
}
{
"status": "error",
"message": "Resource not found. Double-check the endpoint or ID."
}
No items found.