state_codestringwymagane
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.
Twój wynik pojawi się tutaj
Uzupełnij dane wejściowe, a następnie kliknij Uruchom.
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.
Zacznij tworzyć
Punkt końcowy API platformy z jednolitym uwierzytelnianiem i śledzeniem użycia.
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"
}'Ustaw klucz API SandBase w środowisku serwera. Żądania używają uwierzytelniania Bearer.
export SANDBASE_API_KEY="YOUR_API_KEY"Przechowuj klucz na serwerze. Nie ujawniaj go w kodzie przeglądarkowym.
state_codestringwymaganeTwo-letter US state code (e.g. TX, CA, NY, FL). All 50 states and DC are supported.
Zapisany przykładowy response dla tego API; podczas wyświetlania nie jest wykonywane żadne żądanie na żywo.
Nie opublikowano zapisanego response. Uruchom API w Playground, aby sprawdzić jego odpowiedź.
Odkryj więcej
| API | Cena | Odpowiedź |
|---|---|---|
AAA | $0.01 za wywołanie | Asynchroniczny JSON |
AAA | $0.01 za wywołanie | Asynchroniczny JSON |
AAA | $0.01 za wywołanie | Asynchroniczny JSON |
AAA | $0.01 za wywołanie | Asynchroniczny JSON |
AAA | $0.01 za wywołanie | Asynchroniczny JSON |
AAA | $0.01 za wywołanie | Asynchroniczny JSON |
Pytania
Wyślij żądanie POST do https://api.sandbase.ai/v1/api/aaa/price-change-by-metro z kluczem API SandBase w nagłówku Authorization (Bearer) oraz parametrami w treści JSON. Możesz też wypróbować je w Playground na tej stronie bez pisania kodu.
$0.01 za wywołanie, rozliczane z salda SandBase. Płacisz tylko za wykonane wywołania; nie ma subskrypcji.
Wymagane: state_code (string). Tabela Parameters oraz Playground na tej stronie zawierają wszystkie pola.
Wynik JSON. Ten endpoint działa asynchronicznie, więc odpowiedź informuje, jak pobrać gotowy wynik. README na tej stronie zawiera przykładową odpowiedź.
Nie. AAA Price Change By Metro działa przez SandBase, więc jeden klucz API SandBase obejmuje ten endpoint i każde inne API oraz model w katalogu. Nie musisz osobno ubiegać się o dostęp do API AAA.