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

Categories

PreviousSurveys

Get one category

get
Authorizations
Responses
200
OK
application/json
404
Not Found
application/json
get
GET /api/v5/categories/100 HTTP/1.1
Host: ushahididocs.api.ushahidi.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "result": {
    "id": 6,
    "tag": "Done",
    "slug": "done",
    "type": "status",
    "icon": "tag",
    "priority": 0,
    "children": [],
    "translations": {
      "es": {
        "tag": "Done - ES"
      }
    },
    "enabled_languages": {
      "default": "",
      "available": [
        "es"
      ]
    }
  }
}

Delete category

delete
Authorizations
Responses
200
OK
application/json
404
Not Found
application/json
delete
DELETE /api/v5/categories/6 HTTP/1.1
Host: ushahididocs.api.ushahidi.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "result": {
    "deleted": 6
  }
}
  • GETGet categories
  • POSTAdd a category
  • GETGet one category
  • PUTEdit category
  • DELETEDelete category

Get categories

get
Authorizations
Query parameters
onlystringOptionalExample: id,name
Responses
200
OK
application/json
get
GET /api/v5/categories HTTP/1.1
Host: ushahididocs.api.ushahidi.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200

OK

{
  "results": [
    {
      "id": 1,
      "parent_id": "text",
      "tag": "text",
      "slug": "text",
      "type": "text",
      "color": "text",
      "icon": "text",
      "description": "text",
      "role": [
        "text"
      ],
      "priority": 1,
      "children": [
        {
          "id": 1,
          "parent_id": 1,
          "tag": "text",
          "slug": "text",
          "type": "text",
          "color": "text",
          "icon": "text",
          "description": "text",
          "role": "text",
          "priority": 1,
          "children": [
            "text"
          ],
          "parent": {
            "id": 1,
            "parent_id": "text",
            "tag": "text",
            "slug": "text",
            "type": "text",
            "color": "text",
            "icon": "text",
            "description": "text",
            "role": "text",
            "priority": 1,
            "parent": "text",
            "translations": {
              "es": {
                "tag": "text"
              }
            }
          },
          "enabled_languages": {
            "default": "text",
            "available": [
              "text"
            ]
          },
          "translations": {
            "es": {
              "tag": "text"
            },
            "enabled_languages": {
              "es": {
                "tag": "text"
              }
            }
          }
        }
      ],
      "parent": {
        "id": 1,
        "parent_id": "text",
        "tag": "text",
        "slug": "text",
        "type": "text",
        "color": "text",
        "icon": "text",
        "description": "text",
        "role": "text",
        "priority": 1,
        "parent": "text",
        "translations": [
          "text"
        ],
        "enabled_languages": {
          "default": "text",
          "available": [
            "text"
          ]
        }
      },
      "translations": {
        "es": {
          "tag": "text"
        }
      },
      "enabled_languages": {
        "default": "text",
        "available": [
          "text"
        ]
      }
    }
  ]
}

Add a category

post
Authorizations
Body
all ofOptional
and
anyOptionalExample: {"base_language":"22","type":"category","icon":"tag","color":"","parent_id":5,"translations":{},"tag":"test243","slug":"test243"}
Responses
201
Created
application/json
422
Unprocessable Entity
application/json
post
POST /api/v5/categories HTTP/1.1
Host: ushahididocs.api.ushahidi.io
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 129

{
  "base_language": "22",
  "type": "category",
  "icon": "tag",
  "color": "",
  "parent_id": 5,
  "translations": {},
  "tag": "test243",
  "slug": "test243"
}
{
  "result": {
    "id": 21,
    "tag": "test2",
    "slug": "test2",
    "type": "category",
    "color": "",
    "icon": "tag",
    "children": [],
    "translations": [],
    "enabled_languages": {
      "default": "en-US",
      "available": []
    }
  }
}

Edit category

put
Authorizations
Body
all ofOptional
and
anyOptionalExample: {"base_language":"22","type":"category","icon":"tag","color":"","parent_id":5,"translations":{},"tag":"test2458","slug":"test2436"}
Responses
200
OK
application/json
404
Not Found
application/json
422
Unprocessable Entity
application/json
put
PUT /api/v5/categories/70 HTTP/1.1
Host: ushahididocs.api.ushahidi.io
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 131

{
  "base_language": "22",
  "type": "category",
  "icon": "tag",
  "color": "",
  "parent_id": 5,
  "translations": {},
  "tag": "test2458",
  "slug": "test2436"
}
{
  "result": {
    "id": 7,
    "parent_id": 5,
    "tag": "test2458",
    "slug": "role-control",
    "type": "category",
    "color": "",
    "icon": "tag",
    "role": [
      "admin"
    ],
    "priority": 0,
    "children": [],
    "parent": {
      "id": 5,
      "tag": "Todo",
      "slug": "todo",
      "type": "status",
      "icon": "tag",
      "priority": 0,
      "translations": {
        "es": {
          "tag": "Todo - ES"
        }
      },
      "enabled_languages": {
        "default": "",
        "available": [
          "es"
        ]
      }
    },
    "translations": {
      "es": {
        "tag": "Role Control - ES"
      }
    },
    "enabled_languages": {
      "default": "22",
      "available": [
        "es"
      ]
    }
  }
}