Docs, guidelines and compromising photos
To make changes to these pages, checkout the wego.github.io project and the GitHub Pages docs.
A guide for the times when you're creating an API, either public or internal.
/searches
instead of /search
, /hotels/123
instead of /hotel/123
./v1/searches
. Make the version mandatory.Accept
header is send, respond with JSON.Content-Type
response header:
application/json
application/javascript
meta
and data
fields, e.g. { meta: { status: 400 }, data: {} }
. Note that the actual HTTP status is included in the response as response['meta']['status']
.fields
parameter as a convention.
/v1/hotels/123?fields=name,stars,location.code
X-RateLimit-Limit
and X-RateLimit-Remaining
headers.api_key
as parameter name for API key.POST
requests, other than supporting params in the request body in the standard way (e.g. foo=bar&page=1
), you can also support JSON-encoded params in the body. The request Content-Type
should be application/x-www-form-urlencoded
.
curl -i -u username -d '{"scopes":["public_repo"]}' https://api.github.com/authorizations
page
and per_page
params as a convention.Accept-Language
header (preferred) or locale
param.A good convention to follow is this:
{
"status": 401, // HTTP status code
"error_type": "invalid_auth", // Additional error type - explain this in docs
"developer_message": "Invalid API key." // Word this message for API developers
"user_message": "This application has not been authorized." // A message for actual users to see. Optional.
"more_info": "http://developer.wego.com/v1/hotels" // URL to helpful API documentation.
}