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-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.
Çıktınız burada görünecek
Girdileri tamamlayın, ardından Çalıştır'a tıklayın.
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.
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-metro" \
-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.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 |
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-metro adresine bir POST isteği gönderin. Ayrıca bu sayfadaki Playground’da kod yazmadan da deneyebilirsiniz.
çağrı başına $0.01, 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 Metro, 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.