state_codestringzorunlu
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.
Çıktınız burada görünecek
Girdileri tamamlayın, ardından Çalıştır'a tıklayın.
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.
Geliştirmeye başlayın
Birleşik kimlik doğrulama ve kullanım takibi sunan Platform API uç noktası.
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"
}'SandBase API anahtarınızı sunucu ortamınıza ayarlayın. İstekler Bearer kimlik doğrulaması kullanır.
export SANDBASE_API_KEY="YOUR_API_KEY"Anahtarınızı sunucuda tutun. Tarayıcı kodunda açığa çıkarmayın.
state_codestringzorunluTwo-letter US state code (e.g. TX, CA, NY, FL). All 50 states and DC are supported.
Bu API için kaydedilmiş örnek yanıt; görüntülerken canlı istek yapılmaz.
Yayınlanmış bir kaydedilmiş yanıt yok. Yanıtını incelemek için API'yi Playground'da çalıştırın.
Daha fazlasını keşfedin
| API | Fiyat | Yanıt |
|---|---|---|
AAA | $0.02 çağrı başına | Asenkron JSON |
AAA | $0.01 çağrı başına | Asenkron JSON |
AAA | $0.01 çağrı başına | Asenkron JSON |
AAA | $0.01 çağrı başına | Asenkron JSON |
AAA | $0.01 çağrı başına | Asenkron JSON |
AAA | $0.01 çağrı başına | Asenkron JSON |
Sorular
SandBase API anahtarınızı Authorization başlığında (Bearer) ve parametreleri JSON gövdesi olarak ile https://api.sandbase.ai/v1/api/aaa/price-change-by-state adresine bir POST isteği gönderin. Ayrıca bu sayfadaki Playground’da kod yazmadan da deneyebilirsiniz.
çağrı başına $0.02, SandBase bakiyenizden tahsil edilir. Yalnızca yaptığınız çağrılar için ücretlendirilirsiniz; abonelik yoktur.
Gerekli: state_code (string). Parametreler tablosu ve bu sayfadaki Playground, tüm alanları listeler.
Bir JSON sonucu. Bu uç nokta asenkron çalışır; bu nedenle yanıt, tamamlanan sonucu nasıl alacağınızı söyler. Bu sayfadaki README'de örnek bir yanıt yer alır.
Hayır. AAA Price Change By State, SandBase üzerinden çalışır; bu nedenle tek bir SandBase API anahtarı bu uç noktayı ve katalogdaki diğer tüm API'leri ve modelleri kapsar. AAA API erişimi için ayrıca başvuru yapmanız gerekmez.