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. V5

Surveys

PreviousPostsNextCategories

Get survey

get
Authorizations
Query parameters
hydratestringOptional

Data parameter determine which relations of the survey will be returned

Example: translations
onlystringOptional

Data parameter determine which fields of the survey will be returned

Example: id,name
Responses
200
OK
application/json
404
Not Found
application/json
get
GET /api/v5/surveys/100 HTTP/1.1
Host: ushahididocs.api.ushahidi.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "results": [
    {
      "id": 1,
      "name": "text",
      "translations": {
        "name": "text",
        "description": "text",
        "allOf": {
          "es": {
            "name": "text",
            "description": "text"
          }
        }
      }
    }
  ]
}

Delete survey

delete
Authorizations
Responses
200
OK
application/json
403
Forbidden
application/json
delete
DELETE /api/v5/surveys/8 HTTP/1.1
Host: ushahididocs.api.ushahidi.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "result": {
    "deleted": 8
  }
}
  • GETGet surveys
  • POSTAdd a survey
  • GETGet survey
  • PUTEdit survey
  • DELETEDelete survey

Get surveys

get
Authorizations
Query parameters
onlystringOptional

Data parameter determine which fields of the survey will be returned

Example: id,name
hydratestringOptional

Data parameter determine which relations of the survey will be returned

Example: translation
Responses
200
OK
application/json
get
GET /api/v5/surveys HTTP/1.1
Host: ushahididocs.api.ushahidi.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200

OK

{
  "results": [
    {
      "id": 1,
      "name": "text",
      "translations": {
        "name": "text",
        "description": "text",
        "allOf": {
          "es": {
            "name": "text",
            "description": "text"
          }
        }
      }
    }
  ]
}

Add a survey

post
Authorizations
Body
all ofOptional
and
anyOptionalExample: {"name":"test2","description":"test desc 2","base_language":"en-US","require_approval":true,"everyone_can_create":true,"translations":{},"tasks":[{"priority":0,"required":false,"type":"post","label":"Post","show_when_published":true,"task_is_internal_only":false,"translations":{},"fields":[{"cardinality":0,"input":"text","priority":1,"required":true,"label":"Title","type":"title","config":{},"form_stage_id":"interim_id_0","translations":{},"$$hashKey":"object:830"},{"cardinality":0,"input":"text","priority":2,"required":true,"label":"Description","type":"description","options":[],"config":{},"form_stage_id":"interim_id_1","translations":{},"$$hashKey":"object:831"}],"is_public":true},{"required":false,"fields":[{"required":false,"options":[],"config":{},"priority":0,"translations":{},"label":"field 2","type":"varchar","input":"text","description":"A sentence or less","$$hashKey":"object:893","instructions":"","form_stage_id":"interim_id_3"}],"type":"task","show_when_published":false,"task_is_internal_only":true,"label":"task 2","priority":1,"$$hashKey":"object:867"}],"enabled_languages":{"default":"en-US","available":[]}}
Responses
201
Created
application/json
422
Unprocessable Entity
application/json
post
POST /api/v5/surveys HTTP/1.1
Host: ushahididocs.api.ushahidi.io
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 1139

{
  "name": "test2",
  "description": "test desc 2",
  "base_language": "en-US",
  "require_approval": true,
  "everyone_can_create": true,
  "translations": {},
  "tasks": [
    {
      "priority": 0,
      "required": false,
      "type": "post",
      "label": "Post",
      "show_when_published": true,
      "task_is_internal_only": false,
      "translations": {},
      "fields": [
        {
          "cardinality": 0,
          "input": "text",
          "priority": 1,
          "required": true,
          "label": "Title",
          "type": "title",
          "config": {},
          "form_stage_id": "interim_id_0",
          "translations": {},
          "$$hashKey": "object:830"
        },
        {
          "cardinality": 0,
          "input": "text",
          "priority": 2,
          "required": true,
          "label": "Description",
          "type": "description",
          "options": [],
          "config": {},
          "form_stage_id": "interim_id_1",
          "translations": {},
          "$$hashKey": "object:831"
        }
      ],
      "is_public": true
    },
    {
      "required": false,
      "fields": [
        {
          "required": false,
          "options": [],
          "config": {},
          "priority": 0,
          "translations": {},
          "label": "field 2",
          "type": "varchar",
          "input": "text",
          "description": "A sentence or less",
          "$$hashKey": "object:893",
          "instructions": "",
          "form_stage_id": "interim_id_3"
        }
      ],
      "type": "task",
      "show_when_published": false,
      "task_is_internal_only": true,
      "label": "task 2",
      "priority": 1,
      "$$hashKey": "object:867"
    }
  ],
  "enabled_languages": {
    "default": "en-US",
    "available": []
  }
}
{
  "results": [
    {
      "id": 1,
      "name": "text",
      "translations": {
        "name": "text",
        "description": "text",
        "allOf": {
          "es": {
            "name": "text",
            "description": "text"
          }
        }
      }
    }
  ]
}

Edit survey

put
Authorizations
Body
all ofOptional
and
anyOptionalExample: {"name":"test2","description":"test desc 2","base_language":"en-US","require_approval":true,"everyone_can_create":true,"translations":{},"tasks":[{"priority":0,"required":false,"type":"post","label":"Post","show_when_published":true,"task_is_internal_only":false,"translations":{},"fields":[{"cardinality":0,"input":"text","priority":1,"required":true,"label":"Title","type":"title","config":{},"form_stage_id":"interim_id_0","translations":{},"$$hashKey":"object:830"},{"cardinality":0,"input":"text","priority":2,"required":true,"label":"Description","type":"description","options":[],"config":{},"form_stage_id":"interim_id_1","translations":{},"$$hashKey":"object:831"}],"is_public":true},{"required":false,"fields":[{"required":false,"options":[],"config":{},"priority":0,"translations":{},"label":"field 2","type":"varchar","input":"text","description":"A sentence or less","$$hashKey":"object:893","instructions":"","form_stage_id":"interim_id_3"}],"type":"task","show_when_published":false,"task_is_internal_only":true,"label":"task 2","priority":1,"$$hashKey":"object:867"}],"enabled_languages":{"default":"en-US","available":[]}}
Responses
200
OK
application/json
404
Not Found
application/json
422
Unprocessable Entity
application/json
put
PUT /api/v5/surveys/2 HTTP/1.1
Host: ushahididocs.api.ushahidi.io
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 1139

{
  "name": "test2",
  "description": "test desc 2",
  "base_language": "en-US",
  "require_approval": true,
  "everyone_can_create": true,
  "translations": {},
  "tasks": [
    {
      "priority": 0,
      "required": false,
      "type": "post",
      "label": "Post",
      "show_when_published": true,
      "task_is_internal_only": false,
      "translations": {},
      "fields": [
        {
          "cardinality": 0,
          "input": "text",
          "priority": 1,
          "required": true,
          "label": "Title",
          "type": "title",
          "config": {},
          "form_stage_id": "interim_id_0",
          "translations": {},
          "$$hashKey": "object:830"
        },
        {
          "cardinality": 0,
          "input": "text",
          "priority": 2,
          "required": true,
          "label": "Description",
          "type": "description",
          "options": [],
          "config": {},
          "form_stage_id": "interim_id_1",
          "translations": {},
          "$$hashKey": "object:831"
        }
      ],
      "is_public": true
    },
    {
      "required": false,
      "fields": [
        {
          "required": false,
          "options": [],
          "config": {},
          "priority": 0,
          "translations": {},
          "label": "field 2",
          "type": "varchar",
          "input": "text",
          "description": "A sentence or less",
          "$$hashKey": "object:893",
          "instructions": "",
          "form_stage_id": "interim_id_3"
        }
      ],
      "type": "task",
      "show_when_published": false,
      "task_is_internal_only": true,
      "label": "task 2",
      "priority": 1,
      "$$hashKey": "object:867"
    }
  ],
  "enabled_languages": {
    "default": "en-US",
    "available": []
  }
}
{
  "results": [
    {
      "id": 1,
      "name": "text",
      "translations": {
        "name": "text",
        "description": "text",
        "allOf": {
          "es": {
            "name": "text",
            "description": "text"
          }
        }
      }
    }
  ]
}