-
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.
GET, POST, HEAD, OPTIONS
Returns the list of all stories (see this wiki page for more information about stories).
-
GET /api/stories/Will list every stories -
GET /api/stories/?revelevance_for=30000Will list every stories sorted by relevance. -
POST /api/stories/Accepted format: JSON, x-form-encoded
Will create a new story.
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). |
GET, PUT, DELETE, HEAD, OPTIONS, PATCH
Operation a single story.
| Name | Type | Description | Example | Writable ? |
|---|---|---|---|---|
| id | Integer |
The story identifier | 210 |
✗ |
| value | Float |
The spending amount | 360000.0 |
✓ |
| tite | String |
The story's title | "Shropshire council on iPads" |
✓ |
| description | String |
The story description | 10e6 |
✓ |
| country | String |
The story description | 10e6 |
✓ |
| year | Integer |
The story description | 10e6 |
✓ |
| themes | Array |
The story description | 10e6 |
✓ |
| type | String |
The story description | 10e6 |
✓ |
| created_at | Float |
The story description | 10e6 |
✓ |
| current_value | Float |
The story description | 10e6 |
✓ |
| current_value_usd | Float |
The story description | 10e6 |
✓ |
| inflation_last_year | Integer |
The story description | 10e6 |
✓ |
GET, PUT, DELETE, HEAD, OPTIONS, PATCH
GET, HEAD, OPTIONS
GET, HEAD, OPTIONS
GET, HEAD, OPTIONS
GET, HEAD, OPTIONS
GET, HEAD, OPTIONS
GET, HEAD, OPTIONS