Gas Price Lookup
Gas Price Lookup
Documentation
API Overview
This API is used to query retail prices for refined oil products (gasoline, diesel) in various provinces and cities across mainland China. Developers can retrieve the official guidance price or market reference price for a specific date by providing the date, suitable for business systems that need to integrate energy cost data.
Use Cases
- Logistics Freight Calculation: Dynamically adjust transportation cost estimates based on real-time or historical oil prices.
- Travel Service Applications: Provide car owners with fuel cost references and fuel budgets for route planning.
- Data Analysis Platforms: Build energy price trend charts to assist industry research and decision-making.
Request and Response Details
- Request Method: POST
- Core Parameters:
date(optional): Query date, formatyyyyMMdd(e.g.,20231001). If not provided, the latest available data will be returned by default.- Response Result: Contains a list of price information for various grades of oil products (e.g., 92#, 95# gasoline, 0# diesel, etc.) for the corresponding date.
Integration Recommendations
- Caching Strategy: Oil price adjustments are infrequent (typically once every 10 working days). It is recommended to cache query results for the same date locally to reduce unnecessary API calls.
- Error Handling: Please properly handle cases where data is returned for non-trading days or when data has not been updated, ensuring a user-friendly frontend display.
- Date Format: It is crucial to strictly adhere to the
yyyyMMddformat when passing the date parameter to avoid parsing errors.
Integration Examples
Includes ready-to-use Shell, Python, Go, Java, and PHP examples for direct integration.
Request Example
{
"date": "日期,格式:yyyyMMdd,比如:20220422,默认今日"
}Response Example
{}Request Fields
The fields below are derived from example JSON for integration reference only.
| Path | Type | Sample |
|---|---|---|
| type | string | object |
| properties | object | {...} |
| properties.date | object | {...} |
| properties.date.type | string | string |
| properties.date.description | string | 日期,格式:yyyyMMdd,比如:20220422,默认今日 |
Response Fields
The fields below are derived from example JSON for integration reference only.
| Path | Type | Sample |
|---|---|---|
| type | string | object |