Diesel Web Service
Softmodal's diesel web service is a free of charge service that re-publishes the Department of Energy's weekly on-highway retail diesel price in a format that can be used by software applications. The API for the service is simple and it returns two different formats; a plain text format and a JSON format.
Base URI
The base URI for the service is: http://doe.softmodal.com/. Please note the trailing slash. If you click on the link now you will see the current national average.
Parameters
The service takes three optional parameters; date, region, and format. Each parameter consists of a key/value pair separated by an equals sign (=). The first parameter must be preceded by a question mark (?) and each successive parameter must be preceded by an ampersand (&). See the following table for parameter examples and defaults.
| Parameter | Example | Possible Values | Default |
|---|---|---|---|
| Date | ../?date=2009-03-01 | any date after 2008-04-01 in YYYY-MM-DD format | current date |
| Region | ../?region=ca | US, EAST COAST, NEW ENGLAND, CENT ATL, LOWER ATL, MIDWEST, GULF COAST, ROCKY MTN, WEST COAST, CA | US |
| Format | ../?format=json | JSON, txt | txt |
A multiple parameter request would look like http://doe.softmodal.com/?date=2009-05-15&format=json
Formats
The txt format returns either a number that represents the diesel price for the request's date and region or a string indicating an error with the request.
The JSON format returns a JSON object that includes 3 attributes when successful and 2 attributes on failure. The date attribute of a successful response is the date on which that price was published by the Department of Energy. Examples are listed below.
Examples:Successful requests: {status: 'success', date: '2009-08-24', amount: 2.668}
Failed requests: {status: 'error', message: 'Region could not be found'}
The content of this web service is reproduced from the Department of Energy. It is provided on an "as is" basis without warranties of any kind, either expressed or implied, including without limitation warranties of title or implied warranties of merchantability or fitness for a particular purpose. You acknowledge, by your use of this web service, that it is at your sole risk, that you assume full responsibility for all costs associated with all necessary servicing or repairs of any equipment used in connection with your use of this web service, and that Softmodal shall not be liable for any damages of any kind related to your use of this site.
Contact Us
(917) 544-9330
info@softmodal.com
