AAA State Gas Prices
https://api.sandbase.ai/v1/api/aaa/state-gas-pricesReturns current average gas prices for all 50 US states plus DC across all four fuel grades (Regular, Mid-Grade, Premium, Diesel). States are listed in alphabetical order by full state name.
- ราคา
- $0.01USD / คำขอ
- Method
- POST
- การตอบกลับ
- Async JSON
- พารามิเตอร์
- 0 จำเป็น · 0 ไม่บังคับ
Playground
เอาต์พุตของคุณจะแสดงที่นี่
กรอกอินพุตให้ครบ แล้วคลิก Run
API README
AAA State Gas Prices
Returns the current average cost of gas for each US state and DC, based on AAA data. Each row covers Regular, Mid-Grade, Premium and Diesel. The request takes no input.
Use cases
- Compare Regular gas costs between states to find the cheapest and most expensive places to fill up.
- Estimate fuel costs for a road trip that crosses several states.
- Build a state-by-state fuel cost table or map for a dashboard.
- Track the gap between
dieselandregularin each state for fleet planning.
Request
curl -X POST "https://api.sandbase.ai/v1/api/aaa/state-gas-prices" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'
The result is returned in outputs[0].data.
Example response
Real response for the request above, trimmed: lists keep their first item and long strings are cut.
{
"data": {
"states": [
{
"diesel": 5.8537,
"mid_grade": 4.1781,
"premium": 4.5882,
"regular": 3.73,
"state": "Alabama"
}
]
},
"status": "success"
}
Response fields
| Field | Meaning |
|---|---|
data.states[] | One entry per state. The list is in alphabetical order by full state name. |
data.states[].state | Full name of the state, for example Alabama. |
data.states[].regular | Average cost of Regular gas in that state. |
data.states[].mid_grade | Average cost of Mid-Grade gas in that state. |
data.states[].premium | Average cost of Premium gas in that state. |
data.states[].diesel | Average cost of diesel in that state. |
status | Shows success when the call worked. |
Notes
- Send an empty JSON object
{}as the request body. There are no parameters. - Fuel values are plain numbers, such as
3.73or5.8537. - For the US-wide average, call AAA National Average.
Pricing
$0.01 per successful call. Failed calls are not charged. It is included in the daily free quota of each organization.
เริ่มสร้าง
ส่งคำขอแรกของคุณ
เอ็นด์พอยต์ของ Platform API ที่มีการยืนยันตัวตนและการติดตามการใช้งานแบบรวมศูนย์
curl -X POST "https://api.sandbase.ai/v1/api/aaa/state-gas-prices" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'2. การยืนยันตัวตน
ตั้งค่า SandBase API key ของคุณในสภาพแวดล้อมฝั่งเซิร์ฟเวอร์ คำขอจะใช้การยืนยันตัวตนแบบ Bearer
export SANDBASE_API_KEY="YOUR_API_KEY"เก็บ key ไว้บนเซิร์ฟเวอร์ อย่าเปิดเผยในโค้ดฝั่งเบราว์เซอร์
3. พารามิเตอร์
ยังไม่มีการเผยแพร่ schema ของพารามิเตอร์สำหรับ API นี้
4. การตอบกลับ
บันทึกตัวอย่างการตอบกลับสำหรับ API นี้; จะไม่มีการส่งคำขอจริงเมื่อเปิดดู
ยังไม่มีการเผยแพร่การตอบกลับที่บันทึกไว้ ให้รัน API ใน Playground เพื่อดูการตอบกลับ
สำรวจเพิ่มเติม
APIs ที่เกี่ยวข้อง
| API | ราคา | การตอบกลับ |
|---|---|---|
AAA State Gas PricesAPI นี้ AAA | $0.01 ต่อการเรียก | Async JSON |
AAA | $0.01 ต่อการเรียก | Async JSON |
AAA | $0.01 ต่อการเรียก | Async JSON |
AAA | $0.01 ต่อการเรียก | Async JSON |
AAA | $0.01 ต่อการเรียก | Async JSON |
AAA | $0.01 ต่อการเรียก | Async JSON |
คำถาม
คำถามที่พบบ่อย
ฉันจะใช้ AAA State Gas Prices API ได้อย่างไร?
ส่งคำขอ POST ไปที่ https://api.sandbase.ai/v1/api/aaa/state-gas-prices โดยใส่ SandBase API key ของคุณใน Authorization header (Bearer) และส่งพารามิเตอร์เป็น JSON body คุณยังสามารถลองใช้ได้ใน Playground บนหน้านี้โดยไม่ต้องเขียนโค้ด
AAA State Gas Prices API ราคาเท่าไร?
$0.01 ต่อครั้ง คิดจากยอดคงเหลือ SandBase ของคุณ คุณจะถูกเรียกเก็บเฉพาะคำขอที่คุณส่งเท่านั้น ไม่มีค่าสมาชิกรายเดือน
AAA State Gas Prices API รับพารามิเตอร์อะไรบ้าง?
AAA State Gas Prices ไม่รับพารามิเตอร์อินพุต ส่ง JSON body ว่างเปล่า
AAA State Gas Prices API ส่งคืนอะไร?
ผลลัพธ์ JSON จุดเชื่อมต่อนี้ทำงานแบบอะซิงโครนัส ดังนั้นการตอบกลับจะบอกวิธีดึงผลลัพธ์ที่เสร็จแล้ว README บนหน้านี้มีตัวอย่างการตอบกลับ
ฉันจำเป็นต้องมีบัญชีนักพัฒนาหรือ API key ของ AAA ไหม?
ไม่จำเป็น AAA State Gas Prices ทำงานผ่าน SandBase ดังนั้น SandBase API key เดียวครอบคลุม endpoint นี้และทุก API กับโมเดลอื่นในแค็ตตาล็อก คุณไม่ต้องสมัครขอสิทธิ์เข้าถึง AAA API แยกต่างหาก
