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

Forms

PreviousApi KeysNextForm Attribute

add form

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

Request Body

Name
Type
Description

type

String

Form type

parent_id

String

The user's parent identifier

hide_time

String

Set True to hide the time and Flase to make the time visible

color

String

Form color

hide_location

String

Set True to hide the location and Flase to make the location visible

updated

String

require_approval

String

Set True to require form approval and Flase to not

targeted_survey

String

Set True to enable targeted survey and false to disable targeted survey

disabled

Boolean

Set True to disable the form and false to enable the form

everyone_can_create

String

Set True to allow everyone to create form and False to not

description

String

Form description

name

String

Form name

hide_author

Boolean

Set True to hide the author and Flase to make the author visible

{
    "id": 11,
    "url": "http://localhost:8000/api/v3/forms/11",
    "parent_id": null,
    "name": "Test Form",
    "description": "Testing form",
    "color": null,
    "type": "report",
    "disabled": false,
    "created": "2022-11-03T11:24:37+00:00",
    "updated": null,
    "hide_author": false,
    "hide_time": false,
    "hide_location": false,
    "require_approval": false,
    "everyone_can_create": true,
    "targeted_survey": false,
    "can_create": [],
    "tags": [],
    "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
    ]
}

add form

PUT https://ushahididocs.api.ushahidi.io/api/v3/forms/9

Request Body

Name
Type
Description

type

String

Form type

parent_id

String

The user's parent identifier

hide_time

String

Set True to hide the time and Flase to make the time visible

color

String

Form color

hide_location

String

Set True to hide the location and Flase to make the location visible

updated

String

require_approval

String

Set True to require form approval and Flase to not

targeted_survey

String

Set True to enable targeted survey and false to disable targeted survey

disabled

Boolean

Set True to disable the form and false to enable the form

everyone_can_create

String

Set True to allow everyone to create form and False to not

description

String

Form description

name

String

Form name

hide_author

Boolean

Set True to hide the author and Flase to make the author visible

{
    "id": 11,
    "url": "http://localhost:8000/api/v3/forms/11",
    "parent_id": null,
    "name": "Test Form",
    "description": "Testing form",
    "color": null,
    "type": "report",
    "disabled": false,
    "created": "2022-11-03T11:24:37+00:00",
    "updated": null,
    "hide_author": false,
    "hide_time": false,
    "hide_location": false,
    "require_approval": false,
    "everyone_can_create": true,
    "targeted_survey": false,
    "can_create": [],
    "tags": [],
    "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
    ]
}

get forms

get
Authorizations
Query parameters
orderbystringOptional

Sorting parameter Available values : entity fields Default value : id

Example: id
orderstringOptional

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

Example: Desc
limitinteger ยท int32Optional

Paging parameter Default value : null

Example: 2
offsetinteger ยท int32Optional

Paging parameter Default value : 0

Example: 3
qstringOptional

Filter parameter like name

Example: test
parentinteger ยท int32Optional

Filter parameter check the parent id value

Example: 1
Responses
200
OK
application/json
get
GET /api/v3/forms HTTP/1.1
Host: ushahididocs.api.ushahidi.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200

OK

{
  "count": 2,
  "results": [
    {
      "id": 1,
      "url": "http://localhost:8000/api/v3/forms/1",
      "name": "Test Form",
      "description": "Testing form",
      "type": "report",
      "disabled": false,
      "created": "1970-01-01T00:00:00+00:00",
      "hide_author": false,
      "hide_time": false,
      "hide_location": false,
      "require_approval": false,
      "everyone_can_create": true,
      "targeted_survey": false,
      "can_create": [],
      "tags": [
        {
          "id": 1,
          "url": "http://localhost:8000/api/v3/tags/1"
        },
        {
          "id": 2,
          "url": "http://localhost:8000/api/v3/tags/2"
        },
        {
          "id": 3,
          "url": "http://localhost:8000/api/v3/tags/3"
        },
        {
          "id": 4,
          "url": "http://localhost:8000/api/v3/tags/4"
        },
        {
          "id": 5,
          "url": "http://localhost:8000/api/v3/tags/5"
        },
        {
          "id": 6,
          "url": "http://localhost:8000/api/v3/tags/6"
        },
        {
          "id": 7,
          "url": "http://localhost:8000/api/v3/tags/7"
        }
      ],
      "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
      ]
    },
    {
      "id": 2,
      "url": "http://localhost:8000/api/v3/forms/2",
      "name": "Test Form",
      "description": "Testing form",
      "type": "report",
      "disabled": false,
      "created": "1970-01-01T00:00:00+00:00",
      "updated": "2022-11-03T18:02:11+00:00",
      "hide_author": false,
      "hide_time": false,
      "hide_location": false,
      "require_approval": false,
      "everyone_can_create": true,
      "targeted_survey": false,
      "can_create": [
        "user"
      ],
      "tags": [],
      "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
      ]
    }
  ],
  "limit": "2",
  "offset": 0,
  "order": "asc",
  "orderby": "id",
  "curr": "http://localhost:8000/api/v3/forms?orderby=id&order=asc&limit=2&offset=0",
  "next": "http://localhost:8000/api/v3/forms?orderby=id&order=asc&limit=2&offset=2",
  "prev": "http://localhost:8000/api/v3/forms?orderby=id&order=asc&limit=2&offset=0",
  "total_count": 12
}

get form

get
Authorizations
Responses
200
OK
application/json
404
Not Found
application/json
get
GET /api/v3/forms/9 HTTP/1.1
Host: ushahididocs.api.ushahidi.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "id": 1,
  "url": "https://ushahididocs.api.ushahidi.io//api/v3/forms/1",
  "name": "Basic Post",
  "description": "Post with a location",
  "type": "report",
  "disabled": false,
  "created": "2022-05-30T14:10:27+00:00",
  "hide_author": false,
  "hide_time": false,
  "hide_location": false,
  "require_approval": true,
  "everyone_can_create": true,
  "targeted_survey": false,
  "can_create": [],
  "tags": [],
  "allowed_privileges": [
    "read",
    "search"
  ]
}

delete form

delete
Authorizations
Responses
200
OK
application/json
401
Unauthorized
application/json
404
Not Found
application/json
delete
DELETE /api/v3/forms/1 HTTP/1.1
Host: ushahididocs.api.ushahidi.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "id": 10,
  "url": "http://localhost:8000/api/v3/forms/10",
  "name": "Survey with a category field",
  "description": "Survey with a category field to test permissions",
  "type": "report",
  "disabled": false,
  "created": "1970-01-01T00:00:00+00:00",
  "hide_author": false,
  "hide_time": false,
  "hide_location": false,
  "require_approval": false,
  "everyone_can_create": true,
  "targeted_survey": false,
  "can_create": [],
  "tags": [
    {
      "id": 12,
      "url": "http://localhost:8000/api/v3/tags/12"
    },
    {
      "id": 13,
      "url": "http://localhost:8000/api/v3/tags/13"
    },
    {
      "id": 14,
      "url": "http://localhost:8000/api/v3/tags/14"
    },
    {
      "id": 15,
      "url": "http://localhost:8000/api/v3/tags/15"
    },
    {
      "id": 16,
      "url": "http://localhost:8000/api/v3/tags/16"
    },
    {
      "id": 17,
      "url": "http://localhost:8000/api/v3/tags/17"
    },
    {
      "id": 18,
      "url": "http://localhost:8000/api/v3/tags/18"
    }
  ],
  "allowed_privileges": [
    "read",
    "create",
    "update",
    "delete",
    "search"
  ]
}

get forms attributes

get
Authorizations
Responses
200
OK
application/json
get
GET /api/v3/forms/attributes HTTP/1.1
Host: ushahididocs.api.ushahidi.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200

OK

{
  "count": 1,
  "results": [
    {
      "id": 1,
      "url": "text",
      "key": "text",
      "label": "text",
      "instructions": "text",
      "input": "text",
      "type": "text",
      "required": true,
      "default": "text",
      "priority": 1,
      "options": [
        "text"
      ],
      "cardinality": 1,
      "config": [
        "text"
      ],
      "form_stage_id": 1,
      "response_private": true,
      "allowed_privileges": [
        "text"
      ]
    }
  ],
  "limit": "text",
  "offset": 1,
  "order": "text",
  "orderby": "text",
  "curr": "text",
  "next": "text",
  "prev": "text",
  "total_count": 1
}

get forms stages

get
Authorizations
Responses
200
OK
application/json
get
GET /api/v3/forms/stages HTTP/1.1
Host: ushahididocs.api.ushahidi.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200

OK

{
  "count": 19,
  "results": [
    {
      "id": 1,
      "url": "http://localhost:8000/api/v3/form_stages/1",
      "form_id": 1,
      "label": "Main",
      "priority": 1,
      "type": "post",
      "required": false,
      "show_when_published": true,
      "task_is_internal_only": false,
      "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
      ]
    },
    {
      "id": 2,
      "url": "http://localhost:8000/api/v3/form_stages/2",
      "form_id": 1,
      "label": "2nd step",
      "priority": 2,
      "type": "task",
      "required": false,
      "show_when_published": true,
      "task_is_internal_only": false,
      "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
      ]
    },
    {
      "id": 3,
      "url": "http://localhost:8000/api/v3/form_stages/3",
      "form_id": 1,
      "label": "3rd step",
      "priority": 3,
      "type": "task",
      "required": false,
      "show_when_published": true,
      "task_is_internal_only": false,
      "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
      ]
    },
    {
      "id": 5,
      "url": "http://localhost:8000/api/v3/form_stages/5",
      "form_id": 3,
      "label": "Post",
      "priority": 1,
      "type": "post",
      "required": false,
      "show_when_published": true,
      "task_is_internal_only": false,
      "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
      ]
    },
    {
      "id": 6,
      "url": "http://localhost:8000/api/v3/form_stages/6",
      "form_id": 4,
      "label": "restricted",
      "priority": 1,
      "type": "task",
      "required": false,
      "show_when_published": false,
      "task_is_internal_only": false,
      "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
      ]
    },
    {
      "id": 7,
      "url": "http://localhost:8000/api/v3/form_stages/7",
      "form_id": 4,
      "label": "Post",
      "priority": 2,
      "type": "post",
      "required": false,
      "show_when_published": true,
      "task_is_internal_only": false,
      "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
      ]
    },
    {
      "id": 8,
      "url": "http://localhost:8000/api/v3/form_stages/8",
      "form_id": 5,
      "label": "Post",
      "priority": 1,
      "type": "post",
      "required": false,
      "show_when_published": false,
      "task_is_internal_only": false,
      "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
      ]
    },
    {
      "id": 9,
      "url": "http://localhost:8000/api/v3/form_stages/9",
      "form_id": 7,
      "label": "Post",
      "priority": 1,
      "type": "post",
      "required": false,
      "show_when_published": false,
      "task_is_internal_only": false,
      "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
      ]
    },
    {
      "id": 10,
      "url": "http://localhost:8000/api/v3/form_stages/10",
      "form_id": 6,
      "label": "Post",
      "priority": 1,
      "type": "post",
      "required": false,
      "show_when_published": false,
      "task_is_internal_only": false,
      "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
      ]
    },
    {
      "id": 11,
      "url": "http://localhost:8000/api/v3/form_stages/11",
      "form_id": 8,
      "label": "Post",
      "priority": 1,
      "type": "post",
      "required": false,
      "show_when_published": false,
      "task_is_internal_only": false,
      "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
      ]
    },
    {
      "id": 12,
      "url": "http://localhost:8000/api/v3/form_stages/12",
      "form_id": 8,
      "label": "Post",
      "priority": 2,
      "type": "task",
      "required": false,
      "show_when_published": false,
      "task_is_internal_only": true,
      "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
      ]
    },
    {
      "id": 13,
      "url": "http://localhost:8000/api/v3/form_stages/13",
      "form_id": 8,
      "label": "Post",
      "priority": 3,
      "type": "task",
      "required": false,
      "show_when_published": false,
      "task_is_internal_only": false,
      "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
      ]
    },
    {
      "id": 14,
      "url": "http://localhost:8000/api/v3/form_stages/14",
      "form_id": 8,
      "label": "Public task",
      "priority": 4,
      "type": "post",
      "required": false,
      "show_when_published": true,
      "task_is_internal_only": false,
      "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
      ]
    },
    {
      "id": 15,
      "url": "http://localhost:8000/api/v3/form_stages/15",
      "form_id": 9,
      "label": "Main - translated form - show when published",
      "priority": 1,
      "type": "post",
      "required": false,
      "show_when_published": true,
      "task_is_internal_only": false,
      "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
      ]
    },
    {
      "id": 16,
      "url": "http://localhost:8000/api/v3/form_stages/16",
      "form_id": 9,
      "label": "2nd step - show when published",
      "priority": 2,
      "type": "task",
      "required": false,
      "show_when_published": true,
      "task_is_internal_only": false,
      "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
      ]
    },
    {
      "id": 17,
      "url": "http://localhost:8000/api/v3/form_stages/17",
      "form_id": 9,
      "label": "3nd step - show when published, is internal only",
      "priority": 3,
      "type": "task",
      "required": false,
      "show_when_published": true,
      "task_is_internal_only": true,
      "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
      ]
    },
    {
      "id": 19,
      "url": "http://localhost:8000/api/v3/form_stages/19",
      "form_id": 4,
      "label": "restricted",
      "priority": 1,
      "type": "task",
      "required": false,
      "show_when_published": false,
      "task_is_internal_only": false,
      "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
      ]
    },
    {
      "id": 20,
      "url": "http://localhost:8000/api/v3/form_stages/20",
      "form_id": 4,
      "label": "restricted",
      "priority": 1,
      "type": "task",
      "required": false,
      "show_when_published": false,
      "task_is_internal_only": false,
      "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
      ]
    },
    {
      "id": 21,
      "url": "http://localhost:8000/api/v3/form_stages/21",
      "form_id": 4,
      "label": "restricted",
      "priority": 1,
      "type": "task",
      "required": false,
      "show_when_published": false,
      "task_is_internal_only": false,
      "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
      ]
    }
  ],
  "offset": 0,
  "order": "asc",
  "orderby": "id",
  "curr": "http://localhost:8000/api/v3/forms/stages?orderby=id&order=asc&offset=0",
  "next": "http://localhost:8000/api/v3/forms/stages?orderby=id&order=asc&offset=0",
  "prev": "http://localhost:8000/api/v3/forms/stages?orderby=id&order=asc&offset=0",
  "total_count": 19
}

get form stats

get
Authorizations
Responses
200
OK
application/json
401
Unauthorized
application/json
get
GET /api/v3/forms/4/stats HTTP/1.1
Host: ushahididocs.api.ushahidi.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "url": "http://localhost:8000/api/v3/form_stats",
  "total_by_data_source": {
    "sms": 0,
    "email": 0,
    "twitter": 0,
    "web": "6",
    "all": 6
  },
  "allowed_privileges": [
    "read",
    "create",
    "update",
    "delete",
    "search"
  ]
}
  • GETget forms
  • add form
  • add form
  • GETget form
  • DELETEdelete form
  • GETget forms attributes
  • GETget forms stages
  • GETget form stats