state_codestringerforderlich
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-stateReturns the price change (delta) for a state between the current price and historical averages (day, week, month, year) for all fuel grades. Positive values indicate prices have risen; negative values indicate prices.
Ihre Ausgabe wird hier angezeigt
Vervollständigen Sie die Eingaben und klicken Sie dann auf Ausführen.
Returns how AAA fuel prices in one US state have changed over the last day, week, month and year. The response covers Regular, Mid-Grade, Premium and Diesel. It needs a two-letter state_code.
Regular prices moved the most over the past month.curl -X POST "https://api.sandbase.ai/v1/api/aaa/price-change-by-state" \
-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": {
"price_changes": {
"Diesel": {
"day_change": -0.017,
"month_change": -0.123,
"week_change": -0.013,
"year_change": 2.272
},
"Mid-Grade": {
"day_change": -0.013,
"month_change": -0.32,
"week_change": -0.114,
"year_change": 0.879
},
"Premium": {
"day_change": -0.01,
"month_change": -0.309,
"week_change": -0.093,
"year_change": 0.896
},
"Regular": {
"day_change": -0.011,
"month_change": -0.297,
"week_change": -0.112,
"year_change": 0.907
}
},
"state_code": "WA",
"state_name": "Washington"
},
"status": "success"
}
| Field | Meaning |
|---|---|
data.state_code / data.state_name | The two-letter code and full name of the state the changes apply to. |
data.price_changes.Regular | Price changes for Regular gas. Other grades use the same structure: Mid-Grade, Premium and Diesel. |
data.price_changes.Regular.day_change | Change between the current price and the price one day ago. A negative value means the price fell. |
data.price_changes.Regular.week_change | Change between the current price and the price one week ago. |
data.price_changes.Regular.month_change | Change between the current price and the price one month ago. |
data.price_changes.Regular.year_change | Change between the current price and the price one year ago. A positive value means the price rose. |
data.price_changes.Diesel.day_change / week_change / month_change / year_change | The same four changes for Diesel. |
status | Shows success when the call worked. |
state_code as a two-letter US state code such as WA. DC is also supported.$0.02 per successful call. Failed calls are not charged.
Jetzt loslegen
Plattform-API-Endpunkt mit einheitlicher Authentifizierung und Nutzungsnachverfolgung.
curl -X POST "https://api.sandbase.ai/v1/api/aaa/price-change-by-state" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"state_code": "WA"
}'Legen Sie Ihren SandBase API-Schlüssel in Ihrer Serverumgebung fest. Anfragen verwenden Bearer-Authentifizierung.
export SANDBASE_API_KEY="YOUR_API_KEY"Bewahren Sie Ihren Schlüssel auf dem Server auf. Geben Sie ihn nicht in Browser-Code preis.
state_codestringerforderlichTwo-letter US state code (e.g. TX, CA, NY, FL). All 50 states and DC are supported.
Gespeicherte Beispielantwort für diese API; beim Anzeigen wird keine Live-Anfrage gesendet.
Es wurde keine gespeicherte Antwort veröffentlicht. Führen Sie die API in Playground aus, um die Antwort zu prüfen.
Mehr entdecken
| API | Preis | Antwort |
|---|---|---|
AAA Price Change By StateDiese API AAA | $0.02 pro Aufruf | Asynchrones JSON |
AAA | $0.01 pro Aufruf | Asynchrones JSON |
AAA | $0.01 pro Aufruf | Asynchrones JSON |
AAA | $0.01 pro Aufruf | Asynchrones JSON |
AAA | $0.01 pro Aufruf | Asynchrones JSON |
AAA | $0.01 pro Aufruf | Asynchrones JSON |
Fragen
Senden Sie eine POST-Anfrage an https://api.sandbase.ai/v1/api/aaa/price-change-by-state mit Ihrem SandBase API-Schlüssel im Authorization-Header (Bearer) und den Parametern als JSON-Body. Sie können das auch ohne Code direkt auf dieser Seite im Playground testen.
$0.02 pro Aufruf, abgerechnet von Ihrem SandBase-Guthaben. Es werden nur die von Ihnen getätigten Aufrufe berechnet; es gibt kein Abo.
Erforderlich: state_code (string). Die Parametertabelle und der Playground auf dieser Seite listen jedes Feld auf.
Ein JSON-Ergebnis. Dieser Endpunkt läuft asynchron, daher zeigt die Antwort, wie Sie das fertige Ergebnis abrufen. Die README auf dieser Seite enthält eine Beispielantwort.
Nein. AAA Price Change By State läuft über SandBase, daher deckt ein SandBase API-Schlüssel diesen Endpunkt und jede andere API sowie jedes Modell im Katalog ab. Sie müssen keinen separaten Zugang für AAA API beantragen.