FOR ARCHIVAL PURPOSES ONLY

The information in this wiki hasn't been maintained for a good while. Some of the projects described have since been deprecated.

In particular, the "Ushahidi Platform v3.x" section contains information that is often misleading. Many details about this version of Platform have changed since.

This website is an extraction of the original Ushahidi wiki into a static form. Because of that, functions like logging in, commenting or searching will not work.

For more documentation, please refer to https://docs.ushahidi.com

Skip to end of metadata
Go to start of metadata

POST messages

Create a message

Note: Only outgoing messages can be created through the API. Incoming messages are created by data provider modules.

METHOD: POST
ENDPOINT: /api/v2/messages/
AUTHENTICATED: No

The request body is a JSON representation of the message being created.

Example request

POST https://ushv3.dev/api/v2/messages

Post Data
Response

GET messages

Listing all messages

METHOD: GET
ENDPOINT: /api/v2/messages/
AUTHENTICATED: No

Query Parameters

Note with no parameters the messages API defaults to returning messages with direction = incoming and status != archived.

Name

Type

Description

q

Optional

Only messages containing this search string will be returned, matched against 'title' and 'message' properties

type

Optional

Only messages of this type will be returned: report, revision, comment or alert

directionOptionalFilter messages based on direction. incoming or outgoing. Default: incoming
statusOptional

Filter messages based on status.
Options: pending, pending_poll, archived, received, expired, cancelled, failed, unknown, sent, all.
Default: != archived

parentOptionalFilter by parent message id
contactOptionalFilter by contact id
data_feedOptionalFilter by data feed id
data_providerOptionalFilter by data provider id
postOptionalFilter by post id

order

Optional

Returned messages will be sorted in this order: ASC or DESC. Default: DESC

order_by

Optional

Returned messages will be sorted by this field. Default: created

limit

Optional

Limit number of results returned. Default: 50. Max: 500

offset

Optional

messages returned will be offset by this number of results

Example Request

GET https://ushv3.dev/api/v2/messages

Response

Search Example

GET https://ushv3.dev/api/v2/messages?q=abc

Response

GET messages/:id

Get a single message

METHOD: GET
ENDPOINT: /api/v2/messages/:id
AUTHENTICATED: Yes

Query Parameters

Name

Type

Description

id

Required

The numerical id of the message being updated.

Example Request

GET http://ushv3.dev/api/v2/messages/1

Response

PUT messages/:id

Update a message

METHOD: PUT
ENDPOINT: /api/v2/messages/:id
AUTHENTICATED: Yes

Messages updates are subject to special rules depending on if they are incoming or outgoing

  • Incoming messages only allow updates to 'status'. The message itself cannot be edited
  • Outgoing messages allow most values to be updated as normal
Query Parameters

Name

Type

Description

id

Required

The numerical id of the message being updated.

Example Request

Archive message, and try to edit the message text.. In this case the message is status is changed but other changes are ignored.

PUT http://ushv3.dev/api/v2/messages/1

Post Data
Response

DELETE messages/:id

Deleting a message

METHOD: DELETE
ENDPOINT: /api/v2/messages/:id

Messages cannot be deleted through the API.

 

  • No labels