To perform an action using the Ecolabel Index API, send a request to its endpoint specifying a method and some arguments. You will receive a formatted response.
All requests take a list of named parameters in REST format, i.e. as parameters to an HTTP GET. The API endpoint is http://www.ecolabelindex.com/services/rest/
.
The REQUIRED parameter method
is used to specify the action you wish to perform.
The REQUIRED parameter api_key
is used to specify your API Key.
For example, to access the 'echo' method, you would access http://www.ecolabelindex.com/services/rest/?api_key=c0debad0123456789abcdefdeadbeef&method=echo&message=Hello+World
Responses are in JSON, and will be in one of two formats:
{ "stat": "fail", "code": 100, "message": "Invalid API key" }or
{ "stat": "ok", ... other information, determined by the method you called ... }
Possible error messages are documented for each API call.
API keys are 32-character ASCII text strings.
Ecolabel Index subscribers can visit their Account page when logged in, and generate a key under Developers.
A testing method which replies all parameters back in the response.
Example request
http://www.ecolabelindex.com/services/rest/?method=echo&message=Hello+World&api_key=x
Returns a list of all lists known to the API. Lists map relatively opaque keys to user-presentable strings (e.g. "guide65" to "ISO Guide 65"). Lists are identified by a name, and are composed of an ordered list of (key, value). Lists are ordered in mostly alphabetical order, though with some exceptions on a case-by-case basis. In general, API clients should display lists in the order returned by the API.
Example request
http://www.ecolabelindex.com/services/rest/?method=list-list&api_key=x
A list of all ecolabels currently published, optionally filtered by certain criteria. Returns a list of ecolabel IDs (opaque and permanently-assigned strings).
Example request
http://www.ecolabelindex.com/services/rest/?method=ecolabel-index&api_key=x
Returns all available details for a given ecolabel, specified in the parameter id.
Example request
http://www.ecolabelindex.com/services/rest/?method=ecolabel-detail&id=energy-star-usa&api_key=x