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

Roles

PreviousPermissonsNextUsers

add role

POST https://ushahididocs.api.ushahidi.io/api/v3/roles

Request Body

Name
Type
Description

name

String

Name of the User

permissions

array

An array containing strings of role permissions

description

String

Role description

display_name

String

The user display name

protected

Boolean

Set True to protect the role and false for unprotected

{
  "id": 0,
  "url": "string",
  "name": "string",
  "display_name": "string",
  "description": "string",
  "permissions": [
    true
  ],
  "allowed_priviledges": [
    "string"
  ]
}

edit role

PUT https://ushahididocs.api.ushahidi.io/api/v3/roles/1

Request Body

Name
Type
Description

display_name

String

Display name

permissions

Array

An array containing strings of permissions

description

String

Role description

protected

Boolean

Set True to protect the role and false for unprotected

{
  "id": 1,
  "url": "https://ushahididocs.api.ushahidi.io//api/v3/roles/1",
  "name": "user",
  "display_name": "test user2",
  "description": "test user description",
  "permissions": [
    "Edit their own posts",
    "Delete Their Own Posts"
  ],
  "protected": true,
  "allowed_privileges": [
    "read",
    "create",
    "update",
    "search"
  ]
}

Get roles

get
Authorizations
Query parameters
orderbystringOptional

Sorting parameter Available values : entity fields Default value : id

orderstringOptional

Sorting parameter Available values : [ASC,DESC] Default value : ASC !! not work

limitinteger · int32Optional

Paging parameter Default value : null

offsetinteger · int32Optional

Paging parameter Default value : 0

qstringOptional

Filter parameter if this parameter is set then the api will return posts containing q text in name property

namestringOptional

Filter parameter return the roles with name value

Responses
200
OK
application/json
401
Unauthorized
application/json
get
GET /api/v3/roles HTTP/1.1
Host: ushahididocs.api.ushahidi.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "count": 1,
  "results": [
    {
      "id": 2,
      "url": "https://ushahididocs.api.ushahidi.io//api/v3/roles/2",
      "name": "admin",
      "display_name": "Admin",
      "permissions": [],
      "protected": true,
      "allowed_privileges": [
        "read",
        "create",
        "update",
        "search"
      ]
    }
  ],
  "offset": 0,
  "order": "asc",
  "orderby": "id",
  "curr": "https://ushahididocs.api.ushahidi.io//api/v3/roles?orderby=id&order=asc&offset=0",
  "next": "https://ushahididocs.api.ushahidi.io//api/v3/roles?orderby=id&order=asc&offset=0",
  "prev": "https://ushahididocs.api.ushahidi.io//api/v3/roles?orderby=id&order=asc&offset=0",
  "total_count": 1
}

Get role

get
Authorizations
Responses
200
OK
application/json
404
Not Found
application/json
get
GET /api/v3/roles/100 HTTP/1.1
Host: ushahididocs.api.ushahidi.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "id": 1,
  "url": "https://ushahididocs.api.ushahidi.io//api/v3/roles/1",
  "name": "user",
  "display_name": "User",
  "permissions": [
    "Edit their own posts",
    "Delete Their Own Posts"
  ],
  "protected": true,
  "allowed_privileges": [
    "read",
    "create",
    "update",
    "search"
  ]
}

Delete role

delete
Authorizations
Responses
200
OK
application/json
404
Not Found
application/json
delete
DELETE /api/v3/roles/8 HTTP/1.1
Host: ushahididocs.api.ushahidi.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "id": 5,
  "url": "https://ushahididocs.api.ushahidi.io//api/v3/roles/5",
  "name": "importer",
  "display_name": "Importer",
  "permissions": [
    "Bulk Data Import and Export",
    "Edit their own posts",
    "Delete Their Own Posts"
  ],
  "protected": false,
  "allowed_privileges": [
    "read",
    "create",
    "update",
    "delete",
    "search"
  ]
}
  • GETGet roles
  • add role
  • GETGet role
  • edit role
  • DELETEDelete role