Skip to content

Commit f62ac98

Browse files
committed
Move blueprints into docs/api and split into multiple files
1 parent 27e3d11 commit f62ac98

16 files changed

+964
-447
lines changed

apiary.apib

Lines changed: 1 addition & 447 deletions
Large diffs are not rendered by default.

docs/api/auth.apib

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Group Authorization with OAuth 2
2+
3+
Most API requests are authenticated with OAuth2.
4+
5+
## OAuth 2 token exchange [/api/v3/oauth/token]
6+
The first step of OAuth is to exchange credentials for an `access_token`. This `access_token` is then used on subsequent resource requests.
7+
8+
Supported grant types:
9+
10+
+ `client_credentials`
11+
+ `password`
12+
13+
### Exchange credentials for token [POST]
14+
+ Request Client Credentials grant
15+
+ Attributes (OAuth grant request)
16+
+ Headers
17+
18+
Authorization: Basic ABCDEF
19+
20+
+ Response 200 (application/json)
21+
+ Attributes (OAuth valid response)
22+
23+
+ Request Password grant
24+
+ Attributes (OAuth password grant request)
25+
26+
+ Response 200 (application/json)
27+
+ Attributes (OAuth valid response)
28+
29+
## Accessing a protected resource [/api/v3/protected]
30+
31+
Now we have an `access_token` we add that to the `Authentication` header on all resource requests.
32+
33+
### Accessing a protected resource [GET]
34+
+ Request With Valid token
35+
+ Headers
36+
37+
Authentication: Bearer accesstoken
38+
39+
+ Response 200 (application/json)
40+
+ Attributes (Server response)
41+
42+
43+
+ Request With Invalid or Expired token
44+
+ Headers
45+
46+
Authentication: Bearer invalidOrExpireToken
47+
48+
+ Response 401 (application/json)
49+
+ Attributes (Server error response)
50+
51+
+ Request With insufficient permissions
52+
+ Headers
53+
54+
Authentication: Bearer accesstoken
55+
56+
+ Response 403 (application/json)
57+
+ Attributes (Server error response)
58+
59+
# Data Structures
60+
61+
## OAuth grant request (object)
62+
+ `grant_type`: `client_credentials` (string, required)
63+
+ `client_id` (string, required)
64+
+ `client_secret` (string, required)
65+
+ `scope`: post,user(string, optional)
66+
67+
## OAuth password grant request (object)
68+
+ `grant_type`: `password` (string, required)
69+
+ `client_id` (string, required)
70+
+ `client_secret` (string, required)
71+
+ `username`: [email protected] (string, required)
72+
+ `password`: somepassword (string, required)
73+
+ `scope`: post,user (string, optional)
74+
75+
## OAuth valid response (object)
76+
+ `access_token`: `eyJhbGciOiJIUzI1NiJ9` (string, required) - valid access token
77+
+ scope: all (string, required) - scopes of current token
78+
+ `expires_in`: 300 (number, required)
79+
+ `token_type`: Bearer (string, required)
80+
81+
## Server response (object)
82+
+ status: ok (string, required)

docs/api/collections.apib

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
2+
# Group Collections
3+
4+
## Collections [/api/v3/collections]
5+
6+
### List All Collections [GET]
7+
8+
+ Response 200
9+
10+
### Create a Collection [POST]
11+
12+
+ Response 200
13+
14+
### Get a Collection [GET /api/v3/collections/{id}]
15+
16+
+ Response 200
17+
18+
### Update a Collection [PUT /api/v3/collections/{id}]
19+
20+
+ Response 200
21+
22+
### Delete a Collection [DELETE /api/v3/collections/{id}]
23+
24+
+ Response 200
25+
26+
27+
## Collection Posts [/api/v3/collections/{id}/posts]
28+
29+
### Add a Post to a collection [POST]
30+
31+
+ Response 200
32+
33+
### Get a Post in a collection [GET]
34+
35+
+ Response 200
36+
37+
# Group Saved Searches
38+
39+
## Saved Searches [/api/v3/savedsearches]
40+
41+
### List All [GET]
42+
43+
+ Response 200

docs/api/config.apib

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
# Group Config
3+
4+
## Config [/api/v3/config]
5+
6+
### List All Config Groups [GET]
7+
8+
+ Response 200
9+
10+
### Get a Config Group [GET /api/v3/config/{id}]
11+
12+
+ Response 200
13+
14+
### Update a Config Group [PUT /api/v3/config/{id}]
15+
16+
+ Response 200

docs/api/dataproviders.apib

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
# Group Data Providers
3+
4+
### List All Data Providers [GET /api/v3/dataproviders]
5+
6+
+ Response 200
7+
8+
### Get a Data Provider [GET /api/v3/dataproviders/{id}]
9+
10+
+ Response 200

docs/api/forms.apib

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
2+
# Group Forms
3+
4+
## Forms [/api/v3/forms]
5+
6+
### List All Forms [GET]
7+
8+
+ Response 200 (application/json)
9+
10+
11+
### Create a Form [POST]
12+
13+
+ Response 200 (application/json)
14+
15+
16+
### Get a Form [GET /api/v3/forms/{id}]
17+
18+
+ Response 200 (application/json)
19+
20+
21+
### Update a Form [PUT /api/v3/forms/{id}]
22+
23+
+ Response 200 (application/json)
24+
25+
26+
### Delete a Form [DELETE /api/v3/forms/{id}]
27+
28+
+ Response 200 (application/json)
29+
30+
31+
32+
## Form Attributes [/api/v3/forms/{formid}/attributes]
33+
34+
### List All Form Attributes [GET]
35+
36+
+ Response 200 (application/json)
37+
38+
39+
### Create a Form Attributes [POST]
40+
41+
+ Response 200 (application/json)
42+
43+
44+
### Get a Form Attributes [GET /api/v3/forms/{formid}/attributes/{id}]
45+
46+
+ Response 200 (application/json)
47+
48+
49+
### Update a Form Attributes [PUT /api/v3/forms/{formid}/attributes/{id}]
50+
51+
+ Response 200 (application/json)
52+
53+
54+
### Delete a Form Attributes [DELETE /api/v3/forms/{formid}/attributes/{id}]
55+
56+
+ Response 200 (application/json)
57+
58+
59+
60+
## Form Stages [/api/v3/forms/{formid}/stages]
61+
62+
### List All Form Stages [GET]
63+
64+
+ Response 200 (application/json)
65+
66+
67+
### Create a Form Stage [POST]
68+
69+
+ Response 200 (application/json)
70+
71+
72+
### Get a Form Stage [GET /api/v3/forms/{formid}/stages/{id}]
73+
74+
+ Response 200 (application/json)
75+
76+
77+
### Update a Form Stage [PUT /api/v3/forms/{formid}/stages/{id}]
78+
79+
+ Response 200 (application/json)
80+
81+
82+
### Delete a Form Stage [DELETE /api/v3/forms/{formid}/stages/{id}]
83+
84+
+ Response 200 (application/json)

docs/api/import.apib

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
3+
# Group Import
4+
5+
## CSV [/api/v3/csv]
6+
7+
### List All [GET]
8+
9+
+ Response 200 (application/json)
10+
11+
### Upload a CSV [POST]
12+
13+
+ Response 200 (application/json)
14+
15+
### Get CSV [GET /api/v3/csv/{id}]
16+
17+
+ Response 200 (application/json)
18+
19+
### Update CSV [PUT /api/v3/csv/{id}]
20+
21+
+ Response 200 (application/json)
22+
23+
### Delete CSV [DELETE /api/v3/csv/{id}]
24+
25+
+ Response 200 (application/json)
26+
27+
### Import a CSV [POST /api/v3/csv/{id}/import]
28+
29+
+ Response 200 (application/json)
30+

docs/api/index.apib

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
FORMAT: 1A
2+
HOST: http://demo.api.ushahidi.io
3+
4+
# Ushahidi Platform API
5+
6+
Ushahidi is a tool to collect and manage citizen reports. This describes the resources that make up the Ushahidi Platform API v3. If you have any problems or requests please contact [support](mailto:[email protected]).
7+
8+
<!-- include(overview.apib) -->
9+
10+
<!-- include(auth.apib) -->
11+
12+
<!-- include(posts.apib) -->
13+
14+
<!-- include(media.apib) -->
15+
16+
<!-- include(tags.apib) -->
17+
18+
<!-- include(collections.apib) -->
19+
20+
<!-- include(savedsearches.apib) -->
21+
22+
<!-- include(import.apib) -->
23+
24+
<!-- include(forms.apib) -->
25+
26+
<!-- include(messages.apib) -->
27+
28+
<!-- include(users.apib) -->
29+
30+
<!-- include(config.apib) -->
31+
32+
<!-- include(dataproviders.apib) -->
33+
34+
<!-- include(migrations.apib) -->
35+
36+
## Data Structures
37+
38+
## Server error response (object)
39+
+ errors (array, required)
40+
+ (object)
41+
+ status (number, required)
42+
+ title (string, required)
43+
44+
## Not Found error response (object)
45+
+ errors (array, required)
46+
+ (object)
47+
+ status: 404 (number, required)
48+
+ title: Resource could not be found (string, required)
49+
50+
## Validation error response (object)
51+
+ errors (array, required)
52+
+ (object)
53+
+ status: 422 (number, required)
54+
+ title: Validation Error (string, required)
55+
+ (object)
56+
+ status: 422 (number, required)
57+
+ title: Field is required (string, required)
58+
+ source (object)
59+
+ pointer: /field (string)

0 commit comments

Comments
 (0)