API Documentation
Get an authorization code for the client (without a user login)
POST
https://ushahididocs.api.ushahidi.io/oauth/token
This endpoint allows you to get an authorization token for the client without a user login. It allows you to execute the same actions as any non-logged in user.
Request Body
Name | Type | Description |
---|---|---|
grant_type | string | Expected value for this type: "client_credentials" |
client_secret | string | The client secret you added for your deployment in the database. Default value: "35e7f0bca957836d05ca0492211b0ac707671261" |
client_id | string | The client_id you created for your deployment. Default value: "ushahidiui" |
scope | string | All allowed scopes for this type: "posts country_codes media forms api tags savedsearches sets users stats layers config messages notifications webhooks contacts permissions csv" |
Get an authorization code for a user
POST
https://ushahididocs.api.ushahidi.io/oauth/token
This endpoint allows you to get an authentication token. All fields are required.
Request Body
Name | Type | Description |
---|---|---|
scope | string | Default value: * |
client_secret | string | Your client secret. Default value: 35e7f0bca957836d05ca0492211b0ac707671261 |
client_id | string | Your client ID. Default value: ushahidiui |
grant_type | string | Fixed. Send value: password |
password | string | Your Ushahidi platform password |
username | string | Your Ushahidi platform username |
Request a password reset token to be sent via email
POST
https://ushahididocs.api.ushahidi.io/api/v3/passwordreset
Request Body
Name | Type | Description |
---|---|---|
string | example: youremail@example.com |
Reset your password with the reset token
POST
https://ushahididocs.api.ushahidi.io/api/v3/passwordreset/confirm
Request Body
Name | Type | Description |
---|---|---|
password | string | The new password |
token | string | The reset token sent by email |
Register a new user
POST
https://ushahididocs.api.ushahidi.io/api/v3/register
Register your Ushahidi platform users with this endpoint.
Path Parameters
Name | Type | Description |
---|---|---|
string |
Get Collections
GET
https://ushahididocs.api.ushahidi.io/api/v3/collections
Headers
Name | Type | Description |
---|---|---|
Authorization | string | Bearer <your-auth-token> |
Get Posts from a collection
GET
https://ushahididocs.api.ushahidi.io/api/v3/posts?order=desc&orderby=created&set=15
Query Parameters
Name | Type | Description |
---|---|---|
set | string | :collectionId (required to get posts from a collection) |
orderby | string | Options: desc, asc |
limit | string | :number |
Headers
Name | Type | Description |
---|---|---|
Authorization | string | Bearer <your-auth-token> |
Create a collection
POST
https://ushahididocs.api.ushahidi.io/api/v3/collections
Query Parameters
Name | Type | Description |
---|---|---|
orderby | string | Options: desc, asc |
limit | string | :number |
Headers
Name | Type | Description |
---|---|---|
Authorization | string | Bearer <your-auth-token> |
Request Body
Name | Type | Description |
---|---|---|
user_id | string | The owner of the collection |
name | string | Collection's name |
role | array | The role id that is allowed to see and use it |
view | string | Options: map,data |
Delete a collection
DELETE
https://ushahididocs.api.ushahidi.io/api/v3/collections/:collectionId
Delete the collection by its id.
Path Parameters
Name | Type | Description |
---|---|---|
collectionId | number | The collection id.. can appear as set_id in other places |
Headers
Name | Type | Description |
---|---|---|
Authorization | string | Bearer <your-auth-token> |
GET
https://ushahididocs.api.ushahidi.io/api/v3/config
Path Parameters
Name | Type | Description |
---|---|---|
string |
GET
https://ushahididocs.api.ushahidi.io/api/v3/contacts/:contactId
Only used by deployments that require messaging capabilities such as receiving posts by SMS or Twitter.
Path Parameters
Name | Type | Description |
---|---|---|
contact_id | number | The contact id that you want to retrieve |
Headers
Name | Type | Description |
---|---|---|
Authorization | string | Bearer: <your-auth-token> |
Get country codes
GET
https://ushahididocs.api.ushahidi.io/api/v3/country-codes
This is only used to get a list of country codes that we can use for the UI of targeted surveys, a SaaS platform feature for sending surveys in steps to groups of people that they can respond to from their phones.
Path Parameters
Name | Type | Description |
---|---|---|
string |
Headers
Name | Type | Description |
---|---|---|
Auth | string | Bearer <your-auth-token> |
CSV Exports and Imports
Get a list of CSV exports jobs
GET
https://ushahididocs.api.ushahidi.io/api/v3/exports/jobs?user=me
This returns all the metadata for exports of the current user
Path Parameters
Name | Type | Description |
---|---|---|
:jobId | number | Export ID |
Query Parameters
Name | Type | Description |
---|---|---|
user | string | Value: me |
Headers
Name | Type | Description |
---|---|---|
Authorization | string | Bearer: <your-auth-token> |
[WIP]Create metadata to start a CSV Import
PUT
https://ushahididocs.api.ushahidi.io/api/v3/csv/:id/import
This returns all the metadata for exports of the current user
Query Parameters
Name | Type | Description |
---|---|---|
user | string | Value: me |
Headers
Name | Type | Description |
---|---|---|
Authorization | string | Bearer: <your-auth-token> |
Dataproviders (Datasources in the UI, read only config)
Get data provider options
GET
https://ushahididocs.api.ushahidi.io/api/v3/dataproviders/[:id]
Path Parameters
Name | Type | Description |
---|---|---|
id | string | Dataprovider id |
Headers
Name | Type | Description |
---|---|---|
Authorization | string | Bearer: <your-auth-token> |
Forms (Surveys)
Get all surveys
GET
https://ushahididocs.api.ushahidi.io/api/v3/forms
Headers
Name | Type | Description |
---|---|---|
Authorization | string | Bearer: <your-auth-token> |
Get all options for one survey
GET
https://ushahididocs.api.ushahidi.io/api/v3/forms/:id
Path Parameters
Name | Type | Description |
---|---|---|
id | number | The survey id |
Headers
Name | Type | Description |
---|---|---|
Authorization | string | Bearer: <your-auth-token> |
Get all attributes (fields) for one survey
GET
https://ushahididocs.api.ushahidi.io/api/v3/forms/:id/attributes
Path Parameters
Name | Type | Description |
---|---|---|
id | number | The form id |
Headers
Name | Type | Description |
---|---|---|
Authorization | string | Bearer: <your-auth-token> |
Get all stages (groups of fields) for one survey
GET
https://ushahididocs.api.ushahidi.io/api/v3/forms/:id/stages
Path Parameters
Name | Type | Description |
---|---|---|
id | number | The form id |
Headers
Name | Type | Description |
---|---|---|
Authorization | string | Bearer: <your-auth-token> |
Get stats (usage data) for one survey
GET
https://ushahididocs.api.ushahidi.io/api/v3/forms/:id/stats
Path Parameters
Name | Type | Description |
---|---|---|
id | number | The form id |
Headers
Name | Type | Description |
---|---|---|
Authorization | string | Bearer: <your-auth-token> |
Get all roles assigned to one survey
GET
https://ushahididocs.api.ushahidi.io/api/v3/forms/:id/roles
Path Parameters
Name | Type | Description |
---|---|---|
id | number | The form id |
Headers
Name | Type | Description |
---|---|---|
Authorization | string | Bearer: <your-auth-token> |
Create a survey
POST
https://ushahididocs.api.ushahidi.io/api/v3/forms
Create a survey in the backend.
Path Parameters
Name | Type | Description |
---|---|---|
string |
Headers
Name | Type | Description |
---|---|---|
Authorization | string | Bearer: <your-auth-token> |
Request Body
Name | Type | Description |
---|---|---|
name | string | The survey name |
tasks.$n.id | string | A frontend generated ID to identify it while its being created. Example interim_id_2 |
tasks.$n.is_public | boolean | Is the task open to everyone? Default: true |
tasks.$n.attributes | array | A list of attributes for the task. Takes the same options as form attributes for each. |
tasks.$n.task_is_internal_only | boolean | Default: false |
tasks.$n.show_when_published | boolean | Default: true |
tasks.$n.type | string | post |
tasks.$n.required | boolean | Default: false |
tasks.$n.priority | number | The order of the task in the form |
tasks.$n.label | string | The stage label |
tasks | array | Array of stages (tasks) with options. Look for tasks.$n.$x in this list of params to see the attributes available for tasks |
everyone_can_create | string | Can any user create posts? Default: true |
require_approvel | boolean | Does the data in this survey auto-publish or is it saved as draft (default: false) |
color | string | The survey color (shown in map and data view) |
Update a survey (example adding a new field)
PUT
https://ushahididocs.api.ushahidi.io/api/v3/forms/:form_id
Create a survey in the backend.
Path Parameters
Name | Type | Description |
---|---|---|
form_id | number | The survey id. |
Headers
Name | Type | Description |
---|---|---|
Authorization | string | Bearer: <your-auth-token> |
Request Body
Name | Type | Description |
---|---|---|
name | string | The survey name |
tasks.$n.id | string | A frontend generated ID to identify it while its being created. Example interim_id_2 |
tasks.$n.is_public | boolean | Is the task open to everyone? Default: true |
tasks.$n.attributes | array | A list of attributes for the task. Takes the same options as form attributes for each. |
tasks.$n.task_is_internal_only | boolean | Default: false |
tasks.$n.show_when_published | boolean | Default: true |
tasks.$n.type | string | post |
tasks.$n.required | boolean | Default: false |
tasks.$n.priority | number | The order of the task in the form |
tasks.$n.label | string | The stage label |
tasks | array | Array of stages (tasks) with options. Look for tasks.$n.$x in this list of params to see the attributes available for tasks |
everyone_can_create | string | Can any user create posts? Default: true |
require_approvel | boolean | Does the data in this survey auto-publish or is it saved as draft (default: false) |
color | string | The survey color (shown in map and data view) |
Delete a survey
DELETE
https://ushahididocs.api.ushahidi.io/api/v3/forms/:form_id
Path Parameters
Name | Type | Description |
---|---|---|
form_id | number | The survey id. |
Headers
Name | Type | Description |
---|---|---|
Authorization | string | Bearer: <your-auth-token> |
Respond to datasource messages
POST
https://ushahididocs.api.ushahidi.io/api/v3/messages
Used in the "Conversation with author" UX in the platform.
Headers
Name | Type | Description |
---|---|---|
Authorization | string | Bearer: <your-auth-token> |
Request Body
Name | Type | Description |
---|---|---|
parent_id | number | The id of the message you are responding to. |
contact_id | number | The contact id of the person you want to send a message to. You can get this in the "Get messages for a post contact" endpoint below this one. |
direction | string | Use "outgoing" for sending messages. We use "incoming" when a datasource fetches a message. |
message | string | The message you want to send |
Get all messages for a post's contact
GET
https://ushahididocs.api.ushahidi.io/api/v3/messages
Used in the "Conversation with author" UX in the platform.
Query Parameters
Name | Type | Description |
---|---|---|
orderby | string | Options: "created", "updated" |
order | string | Options: "desc", "asc" |
limit | number | Pagination limit |
offset | number | Pagination offset |
contact | number | The contact id. You can get it from the post the message is linked to. |
Headers
Name | Type | Description |
---|---|---|
Authorization | string | Bearer: <your-auth-token> |
Get the post for a message
GET
https://ushahididocs.api.ushahidi.io/api/v3/messages/:messageId/post
Used in the "Conversation with author" UX in the platform.
Query Parameters
Name | Type | Description |
---|---|---|
orderby | string | Options: "created", "updated" |
order | string | Options: "desc", "asc" |
limit | number | Pagination limit |
offset | number | Pagination offset |
contact | number | The contact id. You can get it from the post the message is linked to. |
Headers
Name | Type | Description |
---|---|---|
Authorization | string | Bearer: <your-auth-token> |
Create a new post
POST
https://ushahididocs.api.ushahidi.io/api/v3/posts
Create a new post in the ushahidi platform. This method works with a user's password_grant token or with a client_credentials token generated with the client id and secret.
Headers
Name | Type | Description |
---|---|---|
Authorization | string | Bearer: <your-auth-token> |
Request Body
Name | Type | Description |
---|---|---|
form | object | Format: {id: <formId>} . Sending the id of the form we want to add posts to is required. |
values | object | a key:value map of fields and their content. This is used for all fields other than content and title and follows the format fieldKey: value. You can get a field's get by requesting all attributes of a form. Can be an empty object literal if a form has no other fields. |
content | string | The post's description field |
title | string | The post's title field |
Example payload:
{"title":"My title","content":"My content","values":{},"form":{"id":4}}
Get Posts
GET
https://ushahididocs.api.ushahidi.io/api/v3/posts
Query Parameters
Name | Type | Description |
---|---|---|
orderby | string | Options: desc, asc |
limit | string | :number |
Headers
Name | Type | Description |
---|---|---|
Authorization | string | Bearer <your-auth-token> |