state_codestringobligatoire
Two-letter US state code (e.g. TX, CA, NY, FL). All 50 states and DC are supported.
https://api.sandbase.ai/v1/api/aaa/price-change-by-metroReturns price changes for all metro areas within a given state, showing the difference between current and historical prices for each fuel grade. Includes yesterday_change, week_ago_change, month_ago_change, and.
Votre sortie apparaîtra ici
Complétez les entrées, puis cliquez sur Exécuter.
Returns gas and diesel changes since yesterday, last week, last month and last year for every metro area in a US state. It needs a two-letter state_code such as WA. Each metro lists changes for Regular, Mid-Grade, Premium and Diesel.
yesterday_change shows a sudden jump or drop.curl -X POST "https://api.sandbase.ai/v1/api/aaa/price-change-by-metro" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"state_code": "WA"}'
The result is returned in outputs[0].data.
| Name | Type | Required | Description |
|---|---|---|---|
state_code | string | Yes | Two-letter US state code (e.g. TX, CA, NY, FL). All 50 states and DC are supported. |
Real response for the request above, trimmed: lists keep their first item and long strings are cut.
{
"data": {
"metro_price_changes": [
{
"changes": {
"Diesel": {
"month_ago_change": -0.179,
"week_ago_change": -0.04,
"year_ago_change": 2.101,
"yesterday_change": -0.064
},
"Mid-Grade": {
"month_ago_change": -0.349,
"week_ago_change": 0.069,
"year_ago_change": 1.144,
"yesterday_change": -0.039
},
"Premium": {
"month_ago_change": -0.332,
"week_ago_change": 0.039,
"year_ago_change": 0.995,
"yesterday_change": 0.042
},
"Regular": {
"month_ago_change": -0.356,
"week_ago_change": -0.124,
"year_ago_change": 1.012,
"yesterday_change": -0.012
}
},
"metro": "Bellingham"
}
],
"state": "Washington"
},
"status": "success"
}
| Field | Meaning |
|---|---|
data.state | Full name of the state the metros belong to, such as Washington. |
data.metro_price_changes[].metro | Name of the metro area. |
data.metro_price_changes[].changes | Changes for this metro, keyed by fuel grade: Regular, Mid-Grade, Premium and Diesel. |
data.metro_price_changes[].changes.Regular.yesterday_change | Difference between the current Regular value and yesterday's value for this metro. |
data.metro_price_changes[].changes.Regular.week_ago_change / month_ago_change / year_ago_change | Difference between the current Regular value and the value one week, one month or one year ago. |
data.metro_price_changes[].changes.Diesel.yesterday_change / week_ago_change / month_ago_change / year_ago_change | The same set of changes for Diesel. |
data.metro_price_changes[].changes.Mid-Grade | Same four change fields for Mid-Grade gas. |
data.metro_price_changes[].changes.Premium | Same four change fields for Premium gas. |
status | Shows success when the call worked. |
state_code. The response returns the full state name in data.state.changes, and Mid-Grade includes a hyphen.-0.012. Negative values mean the current value is lower than the earlier one.$0.01 per successful call. Failed calls are not charged. It is included in the daily free quota of each organization.
Commencer à construire
Point de terminaison de l'API de la plateforme avec authentification unifiée et suivi de l'utilisation.
curl -X POST "https://api.sandbase.ai/v1/api/aaa/price-change-by-metro" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"state_code": "WA"
}'Définissez votre clé API SandBase dans l'environnement de votre serveur. Les requêtes utilisent l'authentification Bearer.
export SANDBASE_API_KEY="YOUR_API_KEY"Conservez votre clé côté serveur. Ne l'exposez pas dans le code du navigateur.
state_codestringobligatoireTwo-letter US state code (e.g. TX, CA, NY, FL). All 50 states and DC are supported.
Exemple de réponse enregistré pour cette API ; aucune requête en direct n'est effectuée lors de l'affichage.
Aucune réponse enregistrée n'a été publiée. Exécutez l'API dans Playground pour inspecter sa réponse.
Explorer plus
| API | Prix | Réponse |
|---|---|---|
AAA Price Change By MetroCette API AAA | $0.01 par appel | JSON asynchrone |
AAA | $0.01 par appel | JSON asynchrone |
AAA | $0.01 par appel | JSON asynchrone |
AAA | $0.01 par appel | JSON asynchrone |
AAA | $0.01 par appel | JSON asynchrone |
AAA | $0.01 par appel | JSON asynchrone |
Questions
Envoyez une requête POST à https://api.sandbase.ai/v1/api/aaa/price-change-by-metro avec votre clé API SandBase dans l’en-tête Authorization (Bearer) et les paramètres dans un corps JSON. Vous pouvez aussi l’essayer dans le Playground sur cette page sans écrire de code.
$0.01 par appel, facturé depuis votre solde SandBase. Vous ne payez que les appels que vous effectuez ; aucun abonnement.
Obligatoire : state_code (string). Le tableau des paramètres et le Playground sur cette page listent tous les champs.
Un résultat JSON. Ce point de terminaison s’exécute de manière asynchrone, donc la réponse vous indique comment récupérer le résultat final. Le README sur cette page inclut un exemple de réponse.
Non. AAA Price Change By Metro fonctionne via SandBase, donc une seule clé API SandBase couvre ce point de terminaison ainsi que toutes les autres API et tous les modèles du catalogue. Vous n’avez pas besoin de demander un accès API AAA séparément.