Foreca Weather API · Documentation
Usage Endpoint
Query how many API requests your account has made over a given day or month. Authenticate with your access token in the Authorization: Bearer <token> header — the same token used for data calls.
Pass the optional group_by query parameter (one of endpoint or status_code) to additionally receive a breakdown array splitting the total across that dimension. Each breakdown entry is keyed by the dimension you grouped on plus its hits.
Endpoints
Month's usage
Total requests for a single month, with a per-day breakdown. Add group_by to also split the total by endpoint or status code.
Path Parameters
monthType: stringrequiredMonth in YYYY-MM format (e.g. "2021-03").
Query Parameters
group_byType: stringOptional. Split the total into a breakdown array along one dimension. One of: endpoint, status_code.
/usage/month/{month}Shell Curlcurl 'https://weatherapi.foreca.net/usage/month/{month}' \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN'{
"apis": [
{
"name": "Weather API",
"hits": 32529
}
],
"hits": 32529,
"daily": [
{
"date": "2021-03-01",
"apis": [
{
"name": "Weather API",
"hits": 1042
}
]
}
],
"breakdown": [
{
"endpoint": "point",
"hits": 31044
}
]
}{
"type": "object",
"properties": {
"apis": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"example": "Weather API"
},
"hits": {
"type": "number",
"example": 32529
}
}
}
},
"hits": {
"type": "number",
"example": 32529
},
"daily": {
"type": "array",
"items": {
"type": "object",
"properties": {
"date": {
"type": "string",
"example": "2021-03-01"
},
"apis": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"example": "Weather API"
},
"hits": {
"type": "number",
"example": 1042
}
}
}
}
}
}
},
"breakdown": {
"type": "array",
"items": {
"type": "object",
"properties": {
"endpoint": {
"type": "string",
"example": "point"
},
"hits": {
"type": "number",
"example": 31044
}
}
}
}
}
}Day's usage
Total requests for a single day. Add group_by to also split the total by endpoint or status code.
Path Parameters
dayType: stringrequiredDay in YYYY-MM-DD format (e.g. "2021-03-15").
Query Parameters
group_byType: stringOptional. Split the total into a breakdown array along one dimension. One of: endpoint, status_code.
/usage/day/{day}Shell Curlcurl 'https://weatherapi.foreca.net/usage/day/{day}' \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN'{
"apis": [
{
"name": "Weather API",
"hits": 380
}
],
"hits": 380,
"breakdown": [
{
"endpoint": "point",
"hits": 365
}
]
}{
"type": "object",
"properties": {
"apis": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"example": "Weather API"
},
"hits": {
"type": "number",
"example": 380
}
}
}
},
"hits": {
"type": "number",
"example": 380
},
"breakdown": {
"type": "array",
"items": {
"type": "object",
"properties": {
"endpoint": {
"type": "string",
"example": "point"
},
"hits": {
"type": "number",
"example": 365
}
}
}
}
}
}