v3 Ushahidi Platform REST API Documentation
  • V3
    • Overview
    • Login & Register
    • Posts
      • Sub Posts & Translation
    • Tags
    • Configuration
    • Data provider
    • Country Code
    • Tos
    • Permissons
    • Roles
    • Users
      • User Settings
    • Saved Search
    • Collections
      • Collections Page
    • Messages
    • Exports
    • Contacts
    • HXL
    • Media
    • Verifier
    • Migration
    • Notification
    • Layer
    • Webhooks
    • Api Keys
    • Forms
      • Form Attribute
      • Form Contacts
      • Form Role
      • Form Stages
    • CSV
    • Test
  • V5
    • Overview
    • Posts
    • Surveys
    • Categories
Powered by GitBook
On this page
  1. V3

Test

PreviousCSVNextOverview

Get post revisions

get
Authorizations
Path parameters
parent_idstringRequired

Parent Identifier

Query parameters
orderbystringOptional

Sorting parameter Available values : entity fields Default value : post_date

orderstringOptional

Sorting parameter Available values : [ASC,DESC] !! Default value : DESC "default not working"

limitinteger · int32Optional

Paging parameter Default value : null

offsetinteger · int32Optional

Paging parameter Default value : 0

limitPostsinteger · int32Optional

!!! Paging parameter to activate the limit of posts or not Default value : 0 Note: if it is true then the max value of limit is equal or less than the config (list_admin_max_limit) !!! not working , forced to be 1 in post controller

statusstringOptional

!!! Filter parameter to set the status of posts to be returned Available values: [archived,draft,published] Default value : published Accepts multiple values: as an array or as a string but they will be separated by a comma !! if it is not set it will be published only "hard-coded"

typestringOptional

Filter parameter to set the type of posts to be returned Available values: [report, update, revision] Default value : report

localestringOptional

Filter parameter to set the local of posts to be returned Available values: codes returned from api v5/languages

slugstringOptional

Filter parameter to set the local of posts to be returned

userstringOptional

Filter parameter to set the user/users who created the posts to be returned Accepts multiple values: as an array or as a string but they will be separated by a comma Special case: accept (me) as special value to return the post of the current user Special case: accept (none) as special value to return the post null value of user_id

parentstringOptional

Filter parameter to set the parents of the posts to be returned Accepts multiple values: as an array or as a string but they will be separated by a comma Special case: accept (none) as special value to return the post null value of user_id

formstringOptional

Filter parameter to set the form/forms of the posts to be returned Accepts multiple values: as an array or as a string but they will be separated by a comma Special case: accept (none) as special value to return the post null value of user_id

setstringOptional

Filter parameter to set the collection/collections of the posts to be returned Accepts multiple values: as an array or as a string but they will be separated by a comma

tagsstringOptional

Filter parameter to set the category/categories of the posts to be returned Return Posts matching any of these Tags (Boolean OR) Accepts multiple values: as an array or as a string but they will be separated by a comma

tags[any]stringOptional

Filter parameter to set the category/categories of the posts to be returned Return Posts matching any of these Tags (Boolean OR) Accepts multiple values: as an array or as a string but they will be separated by a comma

tags[all]stringOptional
qinteger · int32Optional

Filter parameter if this parameter is integer it will return the post with id equal the value if this parameter is string then the api will return posts containing q text in title or content properties

post_idinteger · int32Optional

Filter parameter this parameter may used for check if a single post meets other filter conditions

created_before_by_idinteger · int32Optional

Filter parameter to return posts before this id

created_after_by_idinteger · int32Optional

Filter parameter to return posts after this id

created_beforestringOptional

Date filter parameter to return posts are created before this date

created_afterstringOptional

Date filter parameter to return posts are created after this date

updated_beforestringOptional

Date filter parameter to return posts are updated before this date

updated_afterstringOptional

Date filter parameter to return posts are updated after this date

date_beforestringOptional

Date filter parameter to return posts have post-date before this date

date_afterstringOptional

Date filter parameter to return posts have post-date after this date

bboxstringOptional

Spatial filter parameter to set the boundaries of the posts to be returned This parameter value is (west,north,east,south)

center_pointstringOptional

Spatial filter parameter to set the boundaries of the posts to be returned This parameter value is (lat,lng) This parameter and (within_km) parameter work together.

within_kminteger · int32Optional

Spatial filter parameter to set the boundaries of the posts to be returned This parameter and (center_point) parameter work together.

published_tostringOptional

Filter parameter return the posts with is published for this roles. This feature id deprecated Accepts multiple values: as an array or as a string but they will be separated by a comma

sourcestringOptional

Filter parameter to set the sources of the posts to be returned Accepts multiple values: as an array or as a string but they will be separated by a comma

include_typesstringOptional

Specify values to include depending on the type Accepts multiple values: as an array or as a string but they will be separated by a comma

include_attributesstringOptional

Specify values to include depending on the survey fields names Accepts multiple values: as an array or as a string but they will be separated by a comma

include_unmappedinteger · int32Optional

Append unmapped totals to stats

has_locationstringOptional

filter parameter Available values : [unmapped,mapped] Default value : id

output_core_postinteger · int32Optional

Return results parameter if it's equal 1 then return the core fields !! but it's doesn't work now

Responses
200
OK
application/json
404
Not Found
application/json
get
GET /api/v3/posts/{parent_id}/revisions HTTP/1.1
Host: ushahididocs.api.ushahidi.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "count": 1,
  "results": [
    {
      "id": 104,
      "url": "https://ushahididocs.api.ushahidi.io//api/v3/posts/104",
      "parent": {
        "id": 99,
        "url": "https://ushahididocs.api.ushahidi.io//api/v3/posts/99"
      },
      "form": {
        "id": 1,
        "url": "https://ushahididocs.api.ushahidi.io//api/v3/forms/1"
      },
      "type": "revision",
      "title": "Should be returned when Searching",
      "content": "Some description",
      "status": "published",
      "created": "2014-01-22T19:02:55.000Z",
      "locale": "en_us",
      "values": {
        "test_varchar": [
          "some-string"
        ]
      },
      "post_date": "2014-01-22T11:02:55.000Z",
      "tags": [],
      "published_to": [],
      "completed_stages": [],
      "sets": [],
      "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search",
        "change_status",
        "read_full"
      ]
    }
  ],
  "limit": "1",
  "offset": 0,
  "order": "desc",
  "orderby": "post_date",
  "curr": "https://ushahididocs.api.ushahidi.io//api/v3/posts/99/revisions?orderby=post_date&order=desc&limit=1&offset=0&limitPosts=0",
  "next": "https://ushahididocs.api.ushahidi.io//api/v3/posts/99/revisions?orderby=post_date&order=desc&limit=1&offset=1&limitPosts=0",
  "prev": "https://ushahididocs.api.ushahidi.io//api/v3/posts/99/revisions?orderby=post_date&order=desc&limit=1&offset=0&limitPosts=0",
  "total_count": 2
}
  • POSTlogin
  • POSTregister
  • POSTpassword reset
  • POSTConfirm reset password
  • GETGet post revisions

login

post
Authorizations
Body
usernamestringRequired

The Ushahidi login username/email

Example: test@ushahidi.com
passwordstringRequired

The Ushahidi password

Example: Doc@test2022
grant_typestringRequired

Login grant type. Use Password for this grant type

Example: password
client_idstringRequired

The user client ID

Example: ushahidiui
client_secretstringRequired

The client unique secret indentifier

Example: 35e7f0bca957836d05ca0492211b0ac707671261
scopestringOptional

You need to also provide the scope. you can add multiple scope to this parameters. (Scope Options - posts, country_codes, media, forms, api, tags, savedsearches, sets, users, stats, layers, config, messages, notifications, webhooks, contacts, roles, permissions, csv, tos dataproviders, migrate, apikeys)

Example: posts country_codes media forms api tags savedsearches sets users stats layers config messages notifications webhooks contacts roles permissions csv tos dataproviders migrate apikeys
Responses
200
OK
application/json; charset=UTF-8
post
POST /oauth/token HTTP/1.1
Host: ushahididocs.api.ushahidi.io
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 359

"username='test@ushahidi.com'&password='Doc@test2022'&grant_type='password'&client_id='ushahidiui'&client_secret='35e7f0bca957836d05ca0492211b0ac707671261'&scope='posts country_codes media forms api tags savedsearches sets users stats layers config messages notifications webhooks contacts roles permissions csv tos dataproviders migrate apikeys'"
200

OK

{
  "token_type": "Bearer",
  "expires_in": 54000,
  "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjUzZGQ3OWJlZjgxZDZhYmYzMmE5MjI2NjM5MTM5ZjE3MDQyOTBlOTFlZTYxOWIxNTAyMWUxMTJmYTM4MWFlNGY5ZWUwNTU0NDZkY2Q5NmZjIn0.eyJhdWQiOiJ1c2hhaGlkaXVpIiwianRpIjoiNTNkZDc5YmVmODFkNmFiZjMyYTkyMjY2MzkxMzlmMTcwNDI5MGU5MWVlNjE5YjE1MDIxZTExMmZhMzgxYWU0ZjllZTA1NTQ0NmRjZDk2ZmMiLCJpYXQiOjE2NTU5ODQ0NDcsIm5iZiI6MTY1NTk4NDQ0NywiZXhwIjoxNjU2MDM4NDQ3LCJzdWIiOiIyIiwic2NvcGVzIjpbInBvc3RzIiwiY291bnRyeV9jb2RlcyIsIm1lZGlhIiwiZm9ybXMiLCJhcGkiLCJ0YWdzIiwic2F2ZWRzZWFyY2hlcyIsInNldHMiLCJ1c2VycyIsInN0YXRzIiwibGF5ZXJzIiwiY29uZmlnIiwibWVzc2FnZXMiLCJub3RpZmljYXRpb25zIiwid2ViaG9va3MiLCJjb250YWN0cyIsInJvbGVzIiwicGVybWlzc2lvbnMiLCJjc3YiLCJ0b3MiLCJkYXRhcHJvdmlkZXJzIiwibWlncmF0ZSIsImFwaWtleXMiXX0.WTJ3GF2osjYbbnwe1Nlmvv9aOd8Dv6qz9H4QMOCPISWXZKvv59qTJPGGDiJKBu9KpfTLrfcfLqA6-x4CprMz3Bausmp7LIpTybO-K2OKLikt3UjbPs9qDMjct49dD_ylapUFhyLkTjjkRQIAIJfOupgK09IWovd18NNMRqcyzi-cE_Ki_5SvY1jeQMDEYNIfuCtDPFmofa9RH6jIpl9LEmp88llYkBHMAzhORVmTaMer7KN_35BbgP0eyWEtgMxdQMrygsXuBOYDP58-Brx0baxPFNfHvoP2hu5heQfOvlwWtX7wTLB8Pg8N5smdS3Xk-f4CsmYBKDl8nvvmD0S3-MPb9h8jue-BVo3DTkJylxORm4hiAaaBXoxaJs9trh847Fmw7D3IjGPte2F7KHuMWClbwGSIvUDBL-9FvBMAOcZXmi1mEISTF-ybGHc32uM87Vcc-mtDJCHzI9CCUW7_dhLYxP2-cP0oT_DDW3jDyUdj1qQMphBH2WoVgednWgKAbvZydPP1I8MCQFXuU7lcYqgCoGrVyS0_Me_ZdnrutHkxDbJyKl0Ev7m3W2ILTsUkdW7TYqItxlsthWJT3QxRD7X81pPYspH0BlUznAPeeHwLs6UHz093Ao2Uvup5hMP4rbXBLd7_ccBqx3ALuqEp2NociTorwjPq7i3MMVMB5kA",
  "refresh_token": "def502003eb18299266d788cfb81b2a84a2f100e60347eb828157609bc6cc9ddd49bd61125210ca916fd9f51df3e845d9180fc43462ce143fb11b067e46ae740d95582b011165b7a7ec0a26e79b5ec6fae3cb97927f8ac0ae0263a674c9248adb22a9f2cbc97e33ff63b7ae84b9e10faf74730360c5a78facff0ee105ba864d67c02cf0a542428806ba302874a706e52b692b1b1ce0dd97ea904e9df1852517ca9b0bc82c645a8422353f16f345708206aa944fbc87efce60be96ad07a2114433060f5cd8edf8e1d9bed9015ee033f9af71da68a80a29e996c56db637ac21922caccaa13d396914fe57faa1debe5017b31a41cc2907ddfd898fd339aa1c25c2e53033b5fdf5f010404bb6295d6022907e2a6061e7530b1b2181f2aa3193bf8dd19e37594a480de606786ab181b31971d52f8280f2b6661de17823287b62e62e3933aa3d57094f2c2a13eafd821002c4c194548859e5b8024d8e0b7993c14186bff7390daf38e68f03bf1ba04336e267b6e1424d64b5f0ee2d15a46bb084fadaceeff0e9b5ee5ec9fca8d5ebd2765e5483669c8cd0da6d845d9a67b5cfd1287e0686d0dc92a332132d7b690bbbff53e29cee01bf91ead2e3bfde1e3d73c6985bf3c67e2d0c6c169ef28b2cd0e7cc787d212d31fb5cc14dc4bed1fc67ddbd1d59880664fba1851f423192aab47e6ee93118e21b6c805158d0bba4dfba46d364d23f73358ad82be16608556f3b619b698365ec7e2d4761f57eb40eab6e3e98039394f0490f541db1bfaaf04bbc268c4ac1e0dbdcb1fd15cfc1a3427abeb1da62ad0e4fb89b1e24bd50b1847c66e8f6c"
}

register

post
Authorizations
Body
emailstringRequired
passwordstringRequired
Responses
200
OK
application/json
422
Unprocessable Entity
application/json
post
POST /api/v3/register HTTP/1.1
Host: ushahididocs.api.ushahidi.io
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 51

{
  "email": "test@ushahidi.com",
  "password": "test1234"
}
{
  "id": 13,
  "url": "http://localhost:8000/api/v3/users/13",
  "email": "test@ushahidi.com",
  "logins": 0,
  "failed_attempts": 0,
  "created": "2022-11-03T23:19:23+00:00",
  "role": "user",
  "contacts": [],
  "allowed_privileges": [
    "read",
    "create",
    "update",
    "delete",
    "search",
    "read_full",
    "register"
  ],
  "gravatar": "276f7d2512f5e6e6f99b5e405b944581"
}

password reset

post
Authorizations
Body
all ofOptional
Responses
400
Bad Request
application/json
500
Internal Server Error
application/json
post
POST /api/v3/passwordreset HTTP/1.1
Host: ushahididocs.api.ushahidi.io
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 32

{
  "email": "test@v3.ushahidi.com"
}
{
  "errors": [
    {
      "status": 400,
      "message": "Bad request: Payload parameter email has not been declared, defined parameters are: "
    }
  ]
}

Confirm reset password

post
Authorizations
Body
statusintegerOptional
messagestringOptional
Responses
204Success
application/json
Responseinteger · int32Example: 1
422
Unprocessable Entity
application/json
post
POST /api/v3/passwordreset/confirm HTTP/1.1
Host: ushahididocs.api.ushahidi.io
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 55

{
  "password": "new password",
  "token": "fjdsk$#@frhgrigds"
}
1