Surveys
Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Query parameters
onlystringOptionalExample:
Data parameter determine which fields of the survey will be returned
id,namehydratestringOptionalExample:
Data parameter determine which relations of the survey will be returned
translationResponses
200
OK
application/json
get/surveys
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"
}
}
}
}
]
}Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Body
namestringOptional
descriptionstringOptional
base_languagestringOptional
colorstring · nullableOptional
require_approvalbooleanOptional
everyone_can_createbooleanOptional
translationsobjectOptional
Responses
201
Created
application/json
422
Unprocessable Entity
application/json
post/surveys
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"
}
}
}
}
]
}Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Query parameters
hydratestringOptionalExample:
Data parameter determine which relations of the survey will be returned
translationsonlystringOptionalExample:
Data parameter determine which fields of the survey will be returned
id,nameResponses
200
OK
application/json
404
Not Found
application/json
get/surveys/100
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"
}
}
}
}
]
}Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Body
statusintegerOptional
messagestringOptional
Responses
200
OK
application/json
404
Not Found
application/json
422
Unprocessable Entity
application/json
put/surveys/2
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"
}
}
}
}
]
}Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Responses
200
OK
application/json
403
Forbidden
application/json
delete/surveys/8
DELETE /api/v5/surveys/8 HTTP/1.1
Host: ushahididocs.api.ushahidi.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"result": {
"deleted": 8
}
}