Skip to content
This repository has been archived by the owner on Aug 24, 2022. It is now read-only.
Adrien Pétremann edited this page Jun 22, 2016 · 4 revisions

Badger API Overview

Schema

All data is sent and received as JSON.

Blank fields are included as null instead of being omitted.

All timestamps are returned in ISO 8601 format:

YYYY-MM-DDTHH:MM:SSZ

Summary Representations

When you fetch a list of resources, the response includes a subset of the attributes for that resource. This is the "summary" representation of the resource. (Some attributes are computationally expensive for the API to provide. For performance reasons, the summary representation excludes those attributes. To obtain those attributes, fetch the "detailed" representation.)

Example: When you get a list of badges, you get the summary representation of each badge. Here, we fetch the list of badges owned by the user with id 123:

GET /users/123/badges

Detailed Representations

When you fetch an individual resource, the response typically includes all attributes for that resource. This is the "detailed" representation of the resource. (Note that authorization sometimes influences the amount of detail included in the representation.)

Example: When you get an individual badge, you get the detailed representation of the badge. Here, we fetch the badge with id 456:

GET /badges/456

The documentation provides an example response for each API method. The example response illustrates all attributes that are returned by that method.

Hypermedia

All resources may have one or more *_url properties linking to other resources. These are meant to provide explicit URLs so that proper API clients don't need to construct URLs on their own. It is highly recommended that API clients use these.

Pagination

Requests that return multiple items will be paginated to 30 items by default. You can specify further pages with the ?page parameter. For some resources, you can also set a custom page size up to 100 with the ?per_page parameter. Note that for technical reasons not all endpoints respect the ?per_page parameter.

GET /user/badges?page=2&per_page=100'

Note that page numbering is 1-based and that omitting the ?page parameter will return the first page.