-
Notifications
You must be signed in to change notification settings - Fork 12
How to use API
Spending Stories API supports HTML & JSON format as output.
Checkout http://<your server host>/api/ on your server to browse and use the API.
Some of the operation (flagged with *) require to be authenficated. This part explains how to use the auth.
Spending Stories authentifcation system is based on a simple token auth.
Stories are the central entities of our application. For further informations about stories, feel free to consult About the project - Stories wiki page.
Every story is composed of the following attributes:
| Name | Type | Description | Example | Writable ? |
|---|---|---|---|---|
| id | Integer |
Story identifier | 210 |
✗ |
| value | Float |
Spending amount | 360000.0 |
✓ |
| tite | String |
Story's title | "A title" |
✓ |
| description | String |
Story description | "A description" |
✓ |
| country | String |
ISO code of story's country | FRA |
✓ |
| year | Integer |
Story year | 2010 |
✓ |
| themes | Array |
Related themes of this story. | ['aid', 'health' ] |
✓ |
| type | String |
Story description | over_one_year |
✓ |
| sticky | Boolean |
Story sticky status | true |
Staff Only |
| created_at | Float |
Creation date of this story | 10e6 |
✗ |
| current_value | Float |
Compensated value of the story (in its own currency) | 10e6 |
✗ |
| current_value_usd | Float |
Converted value of story in USD. | 10e6 |
✗ |
| inflation_last_year | Integer |
Last avalaible year of inflation for this story | 10e6 |
✗ |
GET, POST, HEAD, OPTIONS
List all stories in our application.
GET, PUT, DELETE, HEAD, OPTIONS, PATCH
Return a single story.
GET, POST, HEAD, OPTIONS
Similar as /api/stories/ except
that it's in a nested mode. That means every related object (like themes, country or currency) will
be return as well.
GET, PUT, DELETE, HEAD, OPTIONS, PATCH
Return a single story and its nested objects.
Results can be filtered using the following fields:
| Name | Type | Description | Possible values |
|---|---|---|---|
| sticky | Boolean |
Will filter stories based on their sticky attribute. |
True,False,''
|
| country | String |
Will filter stories based on the given country | The iso code of the wanted country, see /api/countries/ for more details. |
| currency | String |
Will filter stories based on the given currency | The iso code of the wanted currency, see /api/currencies/ for more details. |
| type | String |
Will filter stories based on their type. |
over_one_year, discrete, see the wiki page for more details. |
| title | String |
Will filter stories based on their title | Title of an existing story |
| themes | String |
Will filter stories based on their theme(s). |
- Themes attributes
- [Endpoints]
| Name | Type | Description | Example | Writable ? |
|---|---|---|---|---|
| title | String |
Theme's title | 'A theme title' | |
| slug | String |
Theme's slug, can be used to get a single theme (check /api/themes/:slug/) |
'aid' | ✗ |
| description | String |
Theme's title | 'A theme title' | ✗ |
| image | String |
Theme's title | 'A theme title' | ✗ |
| active | String |
Theme's title | 'A theme title' | ✗ |
GET, HEAD, OPTIONS
List all themes
GET, HEAD, OPTIONS
Get one single theme using its slug.
GET, HEAD, OPTIONS
GET, HEAD, OPTIONS
GET, HEAD, OPTIONS
GET, HEAD, OPTIONS