state_codestringobbligatorio
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.
Il tuo output apparirà qui
Completa gli input, poi fai clic su Esegui.
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.
Inizia a costruire
Endpoint API della piattaforma con autenticazione unificata e tracciamento dell'utilizzo.
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"
}'Imposta la tua SandBase API key nell'ambiente del server. Le richieste usano l'autenticazione Bearer.
export SANDBASE_API_KEY="YOUR_API_KEY"Conserva la tua key sul server. Non esporla nel codice del browser.
state_codestringobbligatorioTwo-letter US state code (e.g. TX, CA, NY, FL). All 50 states and DC are supported.
Risposta di esempio salvata per questa API; durante la visualizzazione non viene eseguita alcuna richiesta live.
Nessuna risposta salvata è stata pubblicata. Esegui l'API in Playground per ispezionarne la risposta.
Esplora altro
| API | Prezzo | Risposta |
|---|---|---|
AAA Price Change By StateQuesta API AAA | $0.02 per chiamata | JSON asincrono |
AAA | $0.01 per chiamata | JSON asincrono |
AAA | $0.01 per chiamata | JSON asincrono |
AAA | $0.01 per chiamata | JSON asincrono |
AAA | $0.01 per chiamata | JSON asincrono |
AAA | $0.01 per chiamata | JSON asincrono |
Domande
Invia una richiesta POST a https://api.sandbase.ai/v1/api/aaa/price-change-by-state con la tua chiave API di SandBase nell'header Authorization (Bearer) e i parametri nel body JSON. Puoi anche provarla nel Playground di questa pagina senza scrivere codice.
$0.02 per chiamata, addebitato dal tuo saldo SandBase. Paghi solo le chiamate che effettui; non c'è alcun abbonamento.
Richiesti: state_code (string). La tabella dei parametri e il Playground di questa pagina elencano tutti i campi.
Un risultato JSON. Questo endpoint viene eseguito in modo asincrono, quindi la risposta indica come recuperare il risultato completato. Il README di questa pagina include una risposta di esempio.
No. AAA Price Change By State funziona tramite SandBase, quindi una sola chiave API SandBase copre questo endpoint e tutte le altre API e modelli del catalogo. Non è necessario richiedere separatamente l'accesso alle API AAA.