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

Contacts

PreviousExportsNextHXL

add contact

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

Request Body

Name
Type
Description

user_id

Integer

The user identifier

country_code

String

Country code

can_notify

Boolean

Set True to enable contact notification and False to disable

contact

String

Contact number

type

String

The type of contact e.g. "phone"

data_source

String

The data source

{
    "id": 1,
    "url": "http://localhost:8000/api/v3/contacts/1",
    "user": {
        "id": 1,
        "url": "http://localhost:8000/api/v3/users/1"
    },
    "data_source": null,
    "type": "phone",
    "contact": "123456789",
    "created": "1970-01-01T00:00:00+00:00",
    "updated": null,
    "can_notify": false,
    "country_code": null,
    "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
    ]
}

edit contact

PUT https://ushahididocs.api.ushahidi.io/api/v3/contacts/3

Request Body

Name
Type
Description

user_id

Integer

The user identifier

country_code

String

Country code

can_notify

Boolean

Set True to enable contact notification and False to disable

contact

String

Contact number

type

String

The type of contact e.g. "phone"

data_source

String

The data source

{
    "id": 1,
    "url": "http://localhost:8000/api/v3/contacts/1",
    "user": {
        "id": 1,
        "url": "http://localhost:8000/api/v3/users/1"
    },
    "data_source": null,
    "type": "phone",
    "contact": "123456789",
    "created": "1970-01-01T00:00:00+00:00",
    "updated": null,
    "can_notify": false,
    "country_code": null,
    "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
    ]
}

get contacts

get
Authorizations
Query parameters
orderbystringOptional

Sorting parameter Available values : entity fields Default value : id

Example: failed_attempts
orderstringOptional

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

Example: Desc
limitinteger · int32Optional

Paging parameter Default value : null

Example: 2
offsetinteger · int32Optional

Paging parameter Default value : 0

Example: 3
contactinteger · int32Optional

Filter Parameter check the contact

Example: 123456789
typestringOptional

Filter Parameter check the type Available values : [email,phone,email]

Example: email
userinteger · int32Optional

Filter Parameter check the user_id

  • accept "me" as special value
Example: 1
data_sourcestringOptional

Filter Parameter check the data_source

Example: email
Responses
200
OK
application/json
401
Unauthorized
application/json
get
GET /api/v3/contacts HTTP/1.1
Host: ushahididocs.api.ushahidi.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "count": 9,
  "results": [
    {
      "id": 1,
      "url": "http://localhost:8000/api/v3/contacts/1",
      "user": {
        "id": 1,
        "url": "http://localhost:8000/api/v3/users/1"
      },
      "type": "phone",
      "contact": "123456789",
      "created": "1970-01-01T00:00:00+00:00",
      "can_notify": false,
      "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
      ]
    },
    {
      "id": 2,
      "url": "http://localhost:8000/api/v3/contacts/2",
      "type": "email",
      "contact": "somejunkemail@v3.ushahidi.com",
      "created": "1970-01-01T00:00:00+00:00",
      "can_notify": false,
      "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
      ]
    },
    {
      "id": 3,
      "url": "http://localhost:8000/api/v3/contacts/3",
      "user": {
        "id": 1,
        "url": "http://localhost:8000/api/v3/users/1"
      },
      "type": "phone",
      "contact": "123456789",
      "created": "1970-01-01T00:00:00+00:00",
      "updated": "2022-11-02T15:35:51+00:00",
      "can_notify": false,
      "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
      ]
    },
    {
      "id": 4,
      "url": "http://localhost:8000/api/v3/contacts/4",
      "user": {
        "id": 1,
        "url": "http://localhost:8000/api/v3/users/1"
      },
      "type": "email",
      "contact": "robbie@ushahidi.com",
      "created": "1970-01-01T00:00:00+00:00",
      "can_notify": false,
      "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
      ]
    },
    {
      "id": 5,
      "url": "http://localhost:8000/api/v3/contacts/5",
      "type": "phone",
      "contact": "099999999",
      "created": "1970-01-01T00:00:00+00:00",
      "can_notify": false,
      "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
      ]
    },
    {
      "id": 6,
      "url": "http://localhost:8000/api/v3/contacts/6",
      "type": "phone",
      "contact": "99999991",
      "created": "1970-01-01T00:00:00+00:00",
      "can_notify": false,
      "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
      ]
    },
    {
      "id": 7,
      "url": "http://localhost:8000/api/v3/contacts/7",
      "type": "phone",
      "contact": "99999992",
      "created": "1970-01-01T00:00:00+00:00",
      "can_notify": false,
      "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
      ]
    },
    {
      "id": 8,
      "url": "http://localhost:8000/api/v3/contacts/8",
      "type": "phone",
      "contact": "59891333224",
      "created": "1970-01-01T00:00:00+00:00",
      "can_notify": false,
      "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
      ]
    },
    {
      "id": 9,
      "url": "http://localhost:8000/api/v3/contacts/9",
      "type": "phone",
      "contact": "59891333225",
      "created": "1970-01-01T00:00:00+00:00",
      "can_notify": false,
      "allowed_privileges": [
        "read",
        "create",
        "update",
        "delete",
        "search"
      ]
    }
  ],
  "offset": 0,
  "order": "asc",
  "orderby": "id",
  "curr": "http://localhost:8000/api/v3/contacts?orderby=id&order=asc&offset=0",
  "next": "http://localhost:8000/api/v3/contacts?orderby=id&order=asc&offset=0",
  "prev": "http://localhost:8000/api/v3/contacts?orderby=id&order=asc&offset=0",
  "total_count": 9
}

get contact

get
Authorizations
Responses
200
OK
application/json
401
Unauthorized
application/json
404
Not Found
application/json
get
GET /api/v3/contacts/1 HTTP/1.1
Host: ushahididocs.api.ushahidi.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "id": 1,
  "url": "http://localhost:8000/api/v3/contacts/1",
  "user": {
    "id": 1,
    "url": "http://localhost:8000/api/v3/users/1"
  },
  "type": "phone",
  "contact": "123456789",
  "created": "1970-01-01T00:00:00+00:00",
  "can_notify": false,
  "allowed_privileges": [
    "read",
    "create",
    "update",
    "delete",
    "search"
  ]
}

delete contact

delete
Authorizations
Responses
200
OK
application/json
401
Unauthorized
application/json
404
Not Found
application/json
delete
DELETE /api/v3/contacts/9 HTTP/1.1
Host: ushahididocs.api.ushahidi.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "id": 10,
  "url": "http://localhost:8000/api/v3/contacts/10",
  "type": "phone",
  "contact": "59891333226",
  "created": "1970-01-01T00:00:00+00:00",
  "can_notify": false,
  "allowed_privileges": [
    "read",
    "create",
    "update",
    "delete",
    "search"
  ]
}
  • GETget contacts
  • add contact
  • GETget contact
  • edit contact
  • DELETEdelete contact