NAV
cURL

This is the API Documentation for Somleng Simple Call Flow Manager (Somleng SCFM).

Access Tokens

Create an Access Token

Request

curl "https://scfm.somleng.org/api/access_tokens" -d '{
  "metadata": {
    "foo": "bar"
  },
  "permissions": [
    "contacts_write"
  ]
}' -X POST \
    -H "Authorization: Bearer oCTmJghI96nVksM597Noy1uxfK-jsZIzdpsOTkXz2a4"

Endpoint

POST /api/access_tokens

POST /api/access_tokens

Parameters

{
  "metadata": {
    "foo": "bar"
  },
  "permissions": [
    "contacts_write"
  ]
}
Name Description
permissions An array of permissions for the access token. Valid permissions are: access_tokens_read, access_tokens_write, accounts_read, accounts_write, batch_operations_read, batch_operations_write, callout_participations_read, callout_participations_write, callouts_read, callouts_write, contacts_read, contacts_write, phone_calls_read, phone_calls_write, remote_phone_call_events_read, remote_phone_call_events_write, users_read, users_write

Response

Location: /api/access_tokens/16
201 Created
{
  "id": 16,
  "token": "SkjfcgRmXn_wNlm1kX-lN66zIMzY8DfrdhlK_-vDsvk",
  "created_at": "2021-09-20T13:20:37.799Z",
  "updated_at": "2021-09-20T13:20:37.801Z",
  "metadata": {
    "foo": "bar"
  },
  "permissions": [
    "contacts_write"
  ]
}

Delete an Access Token

Request

curl "https://scfm.somleng.org/api/access_tokens/21" -d '' -X DELETE \
    -H "Authorization: Bearer tbxJsy__v6RjnWFVP4HWWKrARASo3_8nQlNI5khlMf0"

Endpoint

DELETE /api/access_tokens/:id

DELETE /api/access_tokens/21

Parameters

None known.

Response

Location: /api/access_tokens
204 No Content

List all Access Tokens

Request

curl -g "https://scfm.somleng.org/api/access_tokens?q[metadata][foo]=bar" -X GET \
    -H "Authorization: Bearer iA_FAvdl9QFCT_Z8n3cvBra_NfK0lYojc6jkwzhiduo"

Endpoint

GET /api/access_tokens

GET /api/access_tokens?q[metadata][foo]=bar

Parameters

q: {"metadata"=>{"foo"=>"bar"}}
Name Description
q A filter in which to filter resources

Response

Per-Page: 25
Total: 1
200 OK
[
  {
    "id": 11,
    "token": "llOGUhiaS2bwJ7h1jdYgnMSVNQB4BS5F4GpwaddJwcU",
    "created_at": "2021-09-20T13:20:37.688Z",
    "updated_at": "2021-09-20T13:20:37.690Z",
    "metadata": {
      "foo": "bar"
    },
    "permissions": [

    ]
  }
]

Retrieve an Access Token

Request

curl -g "https://scfm.somleng.org/api/access_tokens/19" -X GET \
    -H "Authorization: Bearer b2ygHl4AF0lN4m5_HX2lKMzrGOaybs7MbRpRBtKdE-M"

Endpoint

GET /api/access_tokens/:id

GET /api/access_tokens/19

Parameters

None known.

Response

Location: /api/access_tokens/19
200 OK
{
  "id": 19,
  "token": "b2ygHl4AF0lN4m5_HX2lKMzrGOaybs7MbRpRBtKdE-M",
  "created_at": "2021-09-20T13:20:37.846Z",
  "updated_at": "2021-09-20T13:20:37.847Z",
  "metadata": {
  },
  "permissions": [
    "access_tokens_read",
    "access_tokens_write"
  ]
}

Update an Access Token

Request

curl "https://scfm.somleng.orgapi/access_tokens/20" -d '{
  "metadata": {
    "foo": "bar"
  },
  "metadata_merge_mode": "replace"
}' -X PATCH \
    -H "Authorization: Bearer 3EJ7Hh3mKVnxt9AJb_F1J2Elw51PYtLyAIiTM8YSpTw"

Endpoint

PATCH api/access_tokens/:id

PATCH api/access_tokens/20

Parameters

{
  "metadata": {
    "foo": "bar"
  },
  "metadata_merge_mode": "replace"
}

None known.

Response

Location: /api/access_tokens/20
204 No Content

Account Details

Retrieve Account Details

Request

curl -g "https://scfm.somleng.org/api/account" -X GET \
    -H "Authorization: Bearer JlamGFNMwojBt8BijLcuA5D9u6Ol7m8YazIpP2UB8NQ"

Endpoint

GET /api/account

GET /api/account

Parameters

None known.

Response

Location: /api/accounts/325
200 OK
{
  "id": 325,
  "metadata": {
  },
  "settings": {
    "from_phone_number": "1234",
    "phone_call_queue_limit": 200,
    "max_phone_calls_for_callout_participation": 3
  },
  "twilio_account_sid": null,
  "somleng_account_sid": null,
  "twilio_auth_token": null,
  "somleng_auth_token": null,
  "permissions": [

  ],
  "created_at": "2021-09-20T13:20:37.945Z",
  "updated_at": "2021-09-20T13:20:37.945Z",
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "platform_provider_name": null,
  "somleng_api_host": null,
  "somleng_api_base_url": null
}

Update Account Details

Request

curl "https://scfm.somleng.org/api/account" -d '{
  "metadata": {
    "foo": "bar"
  },
  "metadata_merge_mode": "replace"
}' -X PATCH \
    -H "Authorization: Bearer 7Al9moCryrfMZrK8pnn2VmeCqMMsIrG3oyHEJhv0x1U"

Endpoint

PATCH /api/account

PATCH /api/account

Parameters

{
  "metadata": {
    "foo": "bar"
  },
  "metadata_merge_mode": "replace"
}

None known.

Response

Location: /api/accounts/326
204 No Content

Accounts

Only super admins can manage accounts.

Create an Account

Request

curl "https://scfm.somleng.org/api/accounts" -d '' -X POST \
    -H "Authorization: Bearer _Cxau4MgbWEJaGuQudIXIXVi8ZwPjvjTO3IdKzCJEqk"

Endpoint

POST /api/accounts

POST /api/accounts

Parameters

None known.

Response

Location: /api/accounts/331
201 Created
{
  "id": 331,
  "metadata": {
  },
  "settings": {
    "from_phone_number": "1234",
    "phone_call_queue_limit": 200,
    "max_phone_calls_for_callout_participation": 3
  },
  "twilio_account_sid": null,
  "somleng_account_sid": null,
  "twilio_auth_token": null,
  "somleng_auth_token": null,
  "permissions": [

  ],
  "created_at": "2021-09-20T13:20:38.051Z",
  "updated_at": "2021-09-20T13:20:38.051Z",
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "platform_provider_name": null,
  "somleng_api_host": null,
  "somleng_api_base_url": null
}

Delete an Account

Request

curl "https://scfm.somleng.org/api/accounts/336" -d '' -X DELETE \
    -H "Authorization: Bearer bRfiM-h6ewngJjpraPZCzKgLfRzR7NAJ3ayXc-kNP9E"

Endpoint

DELETE /api/accounts/:id

DELETE /api/accounts/336

Parameters

None known.

Response

Location: /api/accounts
204 No Content

List all Accounts

Request

curl -g "https://scfm.somleng.org/api/accounts?q[metadata][foo]=bar" -X GET \
    -H "Authorization: Bearer HQ7uuk1eZgo-G03d4nzIbQFkrzRwzR7uBP4aa08PWGM"

Endpoint

GET /api/accounts

GET /api/accounts?q[metadata][foo]=bar

Parameters

q: {"metadata"=>{"foo"=>"bar"}}

None known.

Response

Per-Page: 25
Total: 1
200 OK
[
  {
    "id": 327,
    "metadata": {
      "foo": "bar"
    },
    "settings": {
      "from_phone_number": "1234",
      "phone_call_queue_limit": 200,
      "max_phone_calls_for_callout_participation": 3
    },
    "twilio_account_sid": null,
    "somleng_account_sid": null,
    "twilio_auth_token": null,
    "somleng_auth_token": null,
    "permissions": [

    ],
    "created_at": "2021-09-20T13:20:37.991Z",
    "updated_at": "2021-09-20T13:20:37.991Z",
    "call_flow_logic": "CallFlowLogic::HelloWorld",
    "platform_provider_name": null,
    "somleng_api_host": null,
    "somleng_api_base_url": null
  }
]

Retrieve an Account

Request

curl -g "https://scfm.somleng.org/api/accounts/332" -X GET \
    -H "Authorization: Bearer Bvhqdc4xRyyzc0HmfkxVs3A3_hsRLARrpTCt3VmukYU"

Endpoint

GET /api/accounts/:id

GET /api/accounts/332

Parameters

None known.

Response

Location: /api/accounts/332
200 OK
{
  "id": 332,
  "metadata": {
  },
  "settings": {
    "from_phone_number": "1234",
    "phone_call_queue_limit": 200,
    "max_phone_calls_for_callout_participation": 3
  },
  "twilio_account_sid": null,
  "somleng_account_sid": null,
  "twilio_auth_token": null,
  "somleng_auth_token": null,
  "permissions": [

  ],
  "created_at": "2021-09-20T13:20:38.058Z",
  "updated_at": "2021-09-20T13:20:38.058Z",
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "platform_provider_name": null,
  "somleng_api_host": null,
  "somleng_api_base_url": null
}

Update an Account

Request

curl "https://scfm.somleng.org/api/accounts/334" -d '{
  "metadata": {
    "foo": "bar"
  },
  "metadata_merge_mode": "replace",
  "twilio_account_sid": "AC8",
  "somleng_account_sid": "bd13834c-a7b0-41e3-a203-0d80deabcf56",
  "twilio_auth_token": "c4a4041c-a35d-4a4a-bb03-e161eb852ee8",
  "somleng_auth_token": "2e5f245a-d3dd-4a9d-b54a-46d62398f3f4",
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "platform_provider_name": "somleng",
  "settings": {
    "batch_operation_phone_call_create_parameters": {
      "callout_filter_params": {
        "status": "running"
      },
      "callout_participation_filter_params": {
        "no_phone_calls_or_last_attempt": "failed"
      },
      "remote_request_params": {
        "from": "1234",
        "url": "https://demo.twilio.com/docs/voice.xml",
        "method": "GET"
      }
    },
    "batch_operation_phone_call_queue_parameters": {
      "callout_filter_params": {
        "status": "running"
      },
      "phone_call_filter_params": {
        "status": "created"
      },
      "limit": "30"
    },
    "batch_operation_phone_call_queue_remote_fetch_parameters": {
      "phone_call_filter_params": {
        "status": "remotely_queued,in_progress"
      },
      "limit": "30"
    }
  }
}' -X PATCH \
    -H "Authorization: Bearer lEbpMqOlziCbPosGcpJWCvoXuDlVRbgYcOin0hKGFkA"

Endpoint

PATCH /api/accounts/:id

PATCH /api/accounts/334

Parameters

{
  "metadata": {
    "foo": "bar"
  },
  "metadata_merge_mode": "replace",
  "twilio_account_sid": "AC8",
  "somleng_account_sid": "bd13834c-a7b0-41e3-a203-0d80deabcf56",
  "twilio_auth_token": "c4a4041c-a35d-4a4a-bb03-e161eb852ee8",
  "somleng_auth_token": "2e5f245a-d3dd-4a9d-b54a-46d62398f3f4",
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "platform_provider_name": "somleng",
  "settings": {
    "batch_operation_phone_call_create_parameters": {
      "callout_filter_params": {
        "status": "running"
      },
      "callout_participation_filter_params": {
        "no_phone_calls_or_last_attempt": "failed"
      },
      "remote_request_params": {
        "from": "1234",
        "url": "https://demo.twilio.com/docs/voice.xml",
        "method": "GET"
      }
    },
    "batch_operation_phone_call_queue_parameters": {
      "callout_filter_params": {
        "status": "running"
      },
      "phone_call_filter_params": {
        "status": "created"
      },
      "limit": "30"
    },
    "batch_operation_phone_call_queue_remote_fetch_parameters": {
      "phone_call_filter_params": {
        "status": "remotely_queued,in_progress"
      },
      "limit": "30"
    }
  }
}

None known.

Response

Location: /api/accounts/334
204 No Content

Batch Operations

Create a Batch Operation Event

Request

curl "https://scfm.somleng.org/api/batch_operations/36/batch_operation_events" -d '{
  "event": "queue"
}' -X POST \
    -H "Authorization: Bearer 9GIH9qLnotcC3ZG5WQOtvTupfPhAXFMu581eRI8Pu4A"

Endpoint

POST /api/batch_operations/:batch_operation_id/batch_operation_events

POST /api/batch_operations/36/batch_operation_events

Parameters

{
  "event": "queue"
}
Name Description
event required Either queue or requeue.

Response

Location: /api/batch_operations/36
201 Created
{
  "id": 36,
  "callout_id": 163,
  "parameters": {
  },
  "metadata": {
  },
  "status": "queued",
  "created_at": "2021-09-20T13:20:38.448Z",
  "updated_at": "2021-09-20T13:20:38.448Z",
  "account_id": 350,
  "type": "BatchOperation::CalloutPopulation"
}

Delete a Batch Operation

Request

curl "https://scfm.somleng.org/api/batch_operations/34" -d '' -X DELETE \
    -H "Authorization: Bearer XuuqD9KI8rqz_G9VINEki9TtZKuCpRaSt7Z0XcdQSxI"

Endpoint

DELETE /api/batch_operations/:id

DELETE /api/batch_operations/34

Parameters

None known.

Response

Location: /api/batch_operations
204 No Content

List all Batch Operations

Request

curl -g "https://scfm.somleng.org/api/batch_operations?q[callout_id]=154" -X GET \
    -H "Authorization: Bearer XS4CFPSsb0KfZ3cOtGCRLxqQlLfSmNuezetxgPazMNE"

Endpoint

GET /api/batch_operations

GET /api/batch_operations?q[callout_id]=154

Parameters

q: {"callout_id"=>"154"}

None known.

Response

Per-Page: 25
Total: 1
200 OK
[
  {
    "id": 28,
    "callout_id": 154,
    "parameters": {
    },
    "metadata": {
    },
    "status": "preview",
    "created_at": "2021-09-20T13:20:38.186Z",
    "updated_at": "2021-09-20T13:20:38.186Z",
    "account_id": 340,
    "type": "BatchOperation::CalloutPopulation"
  }
]

Populate a Callout

Creates a batch operation for populating a callout with callout participations. Specify contact_filter_params in order to filter which contacts will participate in the callout.

Request

curl "https://scfm.somleng.org/api/batch_operations" -d '{
  "callout_id": 157,
  "metadata": {
    "foo": "bar"
  },
  "parameters": {
    "skip_validate_preview_presence": "1",
    "contact_filter_params": {
      "metadata": {
        "gender": "f"
      }
    }
  },
  "type": "BatchOperation::CalloutPopulation"
}' -X POST \
    -H "Authorization: Bearer zgTHZrTRb_OfgNAeW965tg68VoSmyKO-d1e6_rilnA8"

Endpoint

POST /api/batch_operations

POST /api/batch_operations

Parameters

{
  "callout_id": 157,
  "metadata": {
    "foo": "bar"
  },
  "parameters": {
    "skip_validate_preview_presence": "1",
    "contact_filter_params": {
      "metadata": {
        "gender": "f"
      }
    }
  },
  "type": "BatchOperation::CalloutPopulation"
}
Name Description
type required Must be: BatchOperation::CalloutPopulation
parameters Parameters for the batch operation. limit, specifies a limit to the number of operations that will occur in the batch operation. skip_validate_preview_presence turns off validation for creating batch operations which would not effect any resources
callout_id The id of the callout. Only applicable if the type is BatchOperation::CalloutPopulation

Response

Location: /api/batch_operations/31
201 Created
{
  "id": 31,
  "callout_id": 157,
  "parameters": {
    "skip_validate_preview_presence": "1",
    "contact_filter_params": {
      "metadata": {
        "gender": "f"
      }
    }
  },
  "metadata": {
    "foo": "bar"
  },
  "status": "preview",
  "created_at": "2021-09-20T13:20:38.246Z",
  "updated_at": "2021-09-20T13:20:38.246Z",
  "account_id": 342,
  "type": "BatchOperation::CalloutPopulation"
}

Retrieve a Batch Operation

Request

curl -g "https://scfm.somleng.org/api/batch_operations/32" -X GET \
    -H "Authorization: Bearer 3SqQDSbE_-E1qk99BkLxFPdJl45NTslGUabpRwkI9QY"

Endpoint

GET /api/batch_operations/:id

GET /api/batch_operations/32

Parameters

None known.

Response

Location: /api/batch_operations/32
200 OK
{
  "id": 32,
  "callout_id": 158,
  "parameters": {
  },
  "metadata": {
  },
  "status": "preview",
  "created_at": "2021-09-20T13:20:38.308Z",
  "updated_at": "2021-09-20T13:20:38.308Z",
  "account_id": 344,
  "type": "BatchOperation::CalloutPopulation"
}

Update a Batch Operation

Request

curl "https://scfm.somleng.org/api/batch_operations/33" -d '{
  "metadata": {
    "foo": "bar",
    "bar": "foo"
  },
  "parameters": {
    "skip_validate_preview_presence": "1",
    "foo": "bar"
  },
  "metadata_merge_mode": "replace"
}' -X PATCH \
    -H "Authorization: Bearer JVSranhvLYBqR2KfPNWWKRCUifsE6Rf8PR0KllGRn4k"

Endpoint

PATCH /api/batch_operations/:id

PATCH /api/batch_operations/33

Parameters

{
  "metadata": {
    "foo": "bar",
    "bar": "foo"
  },
  "parameters": {
    "skip_validate_preview_presence": "1",
    "foo": "bar"
  },
  "metadata_merge_mode": "replace"
}

None known.

Response

Location: /api/batch_operations/33
204 No Content

Callout Participations

Create a Callout Participation

Request

curl "https://scfm.somleng.org/api/callouts/173/callout_participations" -d '{
  "contact_id": 149,
  "msisdn": "252662345899",
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "metadata": {
    "foo": "bar"
  }
}' -X POST \
    -H "Authorization: Bearer N4X_OPEbdpBOCg2HyzU68jNgy0ggfEvdD6Lhb4e81Cw"

Endpoint

POST /api/callouts/:callout_id/callout_participations

POST /api/callouts/173/callout_participations

Parameters

{
  "contact_id": 149,
  "msisdn": "252662345899",
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "metadata": {
    "foo": "bar"
  }
}

None known.

Response

Location: /api/callout_participations/128
201 Created
{
  "id": 128,
  "callout_id": 173,
  "contact_id": 149,
  "callout_population_id": null,
  "msisdn": "+252662345899",
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "metadata": {
    "foo": "bar"
  },
  "created_at": "2021-09-20T13:20:38.732Z",
  "updated_at": "2021-09-20T13:20:38.732Z",
  "answered": false,
  "phone_calls_count": 0
}

Create a Callout Participation with invalid data

Request

curl "https://scfm.somleng.org/api/callouts/174/callout_participations" -d '' -X POST \
    -H "Authorization: Bearer FD4_C5wH2aknHZ-eGh1gvq2XfHQbxQdnLUFi8hSZYBg"

Endpoint

POST /api/callouts/:callout_id/callout_participations

POST /api/callouts/174/callout_participations

Parameters

None known.

Response


422 Unprocessable Entity
{
  "errors": {
    "msisdn": [
      "can't be blank"
    ],
    "contact": [
      "must exist"
    ]
  }
}

Delete a Callout Participation

Request

curl "https://scfm.somleng.org/api/callout_participations/131" -d '' -X DELETE \
    -H "Authorization: Bearer XXsUcgCIhR55-WoTFZCCQtdYuBDwUn2XvqPmFqil4-0"

Endpoint

DELETE /api/callout_participations/:id

DELETE /api/callout_participations/131

Parameters

None known.

Response

Location: /api/callout_participations
204 No Content

Delete a Callout Participation with phone calls

Request

curl "https://scfm.somleng.org/api/callout_participations/132" -d '' -X DELETE \
    -H "Authorization: Bearer 0xKUJJHD2CWSn-pzODPKxOzw6fB7-Kn8gwF6yYjysdQ"

Endpoint

DELETE /api/callout_participations/:id

DELETE /api/callout_participations/132

Parameters

None known.

Response


422 Unprocessable Entity
{
  "errors": {
    "base": [
      "Cannot delete record because dependent phone calls exist"
    ]
  }
}

List all Callout Participations

Request

curl -g "https://scfm.somleng.org/api/callout_participations?q[metadata][foo]=bar" -X GET \
    -H "Authorization: Bearer K4ppft-NaFmNxVmD8PxYFEd-3J3z7b6A1aB2MQGXa9U"

Endpoint

GET /api/callout_participations

GET /api/callout_participations?q[metadata][foo]=bar

Parameters

q: {"metadata"=>{"foo"=>"bar"}}

None known.

Response

Per-Page: 25
Total: 1
200 OK
[
  {
    "id": 121,
    "callout_id": 166,
    "contact_id": 142,
    "callout_population_id": null,
    "msisdn": "+252662345891",
    "call_flow_logic": "CallFlowLogic::HelloWorld",
    "metadata": {
      "foo": "bar"
    },
    "created_at": "2021-09-20T13:20:38.570Z",
    "updated_at": "2021-09-20T13:20:38.570Z",
    "answered": false,
    "phone_calls_count": 0
  }
]

Retrieve a Callout Participation

Request

curl -g "https://scfm.somleng.org/api/callout_participations/129" -X GET \
    -H "Authorization: Bearer ONxWwCNgMR14BSa9FuRealryc7fzxdpOiAEekVnuApo"

Endpoint

GET /api/callout_participations/:id

GET /api/callout_participations/129

Parameters

None known.

Response

Location: /api/callout_participations/129
200 OK
{
  "id": 129,
  "callout_id": 175,
  "contact_id": 150,
  "callout_population_id": null,
  "msisdn": "+252662345900",
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "metadata": {
  },
  "created_at": "2021-09-20T13:20:38.781Z",
  "updated_at": "2021-09-20T13:20:38.781Z",
  "answered": false,
  "phone_calls_count": 0
}

Update a Callout Participation

Request

curl "https://scfm.somleng.org/api/callout_participations/130" -d '{
  "contact_id": 152,
  "msisdn": "252662345903",
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "metadata": {
    "bar": "foo"
  },
  "metadata_merge_mode": "replace"
}' -X PATCH \
    -H "Authorization: Bearer FyuMOZAHQaxWfrAyKiah9nnZf9Bmt9r5ksXHBsAGSz0"

Endpoint

PATCH /api/callout_participations/:id

PATCH /api/callout_participations/130

Parameters

{
  "contact_id": 152,
  "msisdn": "252662345903",
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "metadata": {
    "bar": "foo"
  },
  "metadata_merge_mode": "replace"
}

None known.

Response

Location: /api/callout_participations/130
204 No Content

Callouts

Create a Callout

Request

curl "https://scfm.somleng.org/api/callouts" -d '{
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "audio_url": "https://www.example.com/sample.mp3",
  "metadata": {
    "foo": "bar"
  },
  "settings": {
    "external_service_1": {
      "foo": "bar"
    }
  }
}' -X POST \
    -H "Authorization: Bearer DagJ0UmhVKZ78z6B_mOsxjKGgEYU6aRUFbj37VDVy-0"

Endpoint

POST /api/callouts

POST /api/callouts

Parameters

{
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "audio_url": "https://www.example.com/sample.mp3",
  "metadata": {
    "foo": "bar"
  },
  "settings": {
    "external_service_1": {
      "foo": "bar"
    }
  }
}
Name Description
call_flow_logic The name of the call flow logic to be run during the callout.
audio_url The URL to an audio file to be played during the callout.
settings Additionoal settings which are needed byt the call flow logic.

Response

Location: /api/callouts/184
201 Created
{
  "id": 184,
  "status": "initialized",
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "metadata": {
    "foo": "bar"
  },
  "created_at": "2021-09-20T13:20:39.013Z",
  "updated_at": "2021-09-20T13:20:39.013Z",
  "account_id": 367,
  "audio_url": "https://www.example.com/sample.mp3",
  "settings": {
    "external_service_1": {
      "foo": "bar"
    }
  },
  "created_by_id": null
}

Create a Callout Event

Request

curl "https://scfm.somleng.org/api/callouts/189/callout_events" -d '{
  "event": "start"
}' -X POST \
    -H "Authorization: Bearer X-UNVGw_C5HDe4XVfsI6PY2AcVoeIVPHcBqoF8UQnHg"

Endpoint

POST /api/callouts/:callout_id/callout_events

POST /api/callouts/189/callout_events

Parameters

{
  "event": "start"
}
Name Description
event required One of: start, pause, resume, stop

Response

Location: /api/callouts/189
201 Created
{
  "account_id": 372,
  "id": 189,
  "status": "running",
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "metadata": {
  },
  "created_at": "2021-09-20T13:20:39.143Z",
  "updated_at": "2021-09-20T13:20:39.162Z",
  "audio_url": null,
  "settings": {
  },
  "created_by_id": null
}

Delete a Callout

Request

curl "https://scfm.somleng.org/api/callouts/187" -d '' -X DELETE \
    -H "Authorization: Bearer qQLhfdSD5mf58O06MKkRMfTbXCLuGJXyETQKy8RLPxc"

Endpoint

DELETE /api/callouts/:id

DELETE /api/callouts/187

Parameters

None known.

Response

Location: /api/callouts
204 No Content

List all Callouts

Request

curl -g "https://scfm.somleng.org/api/callouts?q[metadata][foo]=bar" -X GET \
    -H "Authorization: Bearer Q2MPDPb5VAIOPoofsKHQV9T03fip1VlaIjWVoWuViaI"

Endpoint

GET /api/callouts

GET /api/callouts?q[metadata][foo]=bar

Parameters

q: {"metadata"=>{"foo"=>"bar"}}

None known.

Response

Per-Page: 25
Total: 1
200 OK
[
  {
    "id": 179,
    "status": "initialized",
    "call_flow_logic": "CallFlowLogic::HelloWorld",
    "metadata": {
      "foo": "bar"
    },
    "created_at": "2021-09-20T13:20:38.924Z",
    "updated_at": "2021-09-20T13:20:38.924Z",
    "account_id": 364,
    "audio_url": null,
    "settings": {
    },
    "created_by_id": null
  }
]

Retrieve a Callout

Request

curl -g "https://scfm.somleng.org/api/callouts/185" -X GET \
    -H "Authorization: Bearer RgVWp6tky_hsBEUyBlDvDI4FREuapf7UR8Eehp5RHfA"

Endpoint

GET /api/callouts/:id

GET /api/callouts/185

Parameters

None known.

Response

Location: /api/callouts/185
200 OK
{
  "id": 185,
  "status": "initialized",
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "metadata": {
  },
  "created_at": "2021-09-20T13:20:39.026Z",
  "updated_at": "2021-09-20T13:20:39.026Z",
  "account_id": 368,
  "audio_url": null,
  "settings": {
  },
  "created_by_id": null
}

Update a Callout

Request

curl "https://scfm.somleng.org/api/callouts/186" -d '{
  "metadata": {
    "bar": "foo"
  },
  "metadata_merge_mode": "replace"
}' -X PATCH \
    -H "Authorization: Bearer vixj1j1wAOXtMlcx-R9bkat0tPTu-6MeGml7tzAyLM8"

Endpoint

PATCH /api/callouts/:id

PATCH /api/callouts/186

Parameters

{
  "metadata": {
    "bar": "foo"
  },
  "metadata_merge_mode": "replace"
}

None known.

Response

Location: /api/callouts/186
204 No Content

Contacts

Create a Contact

Request

curl "https://scfm.somleng.org/api/contacts" -d '{
  "msisdn": "252662345913",
  "metadata": {
    "gender": "f",
    "name": "Kate"
  }
}' -X POST \
    -H "Authorization: Bearer fAoMVJHtYYULDgA04t_Dgm4lN32pM2JmiyxmWeBjgkQ"

Endpoint

POST /api/contacts

POST /api/contacts

Parameters

{
  "msisdn": "252662345913",
  "metadata": {
    "gender": "f",
    "name": "Kate"
  }
}
Name Description
msisdn required Phone number in E.164 format

Response

Location: /api/contacts/162
201 Created
{
  "id": 162,
  "msisdn": "+252662345913",
  "metadata": {
    "gender": "f",
    "name": "Kate"
  },
  "created_at": "2021-09-20T13:20:39.327Z",
  "updated_at": "2021-09-20T13:20:39.327Z",
  "account_id": 378
}

Create or update a Contact

Creates or updates a contact. If a contact is found with the msisdn, it is updated, otherwise it is created.

Request

curl "https://scfm.somleng.org/api/contact_data" -d '{
  "msisdn": "252662345917",
  "metadata": {
    "gender": "f",
    "name": "Kate"
  }
}' -X POST \
    -H "Authorization: Bearer 8dw5gWgS1vWSoXytGz9qve3CcTHO0jNjoI-laTa4peE"

Endpoint

POST /api/contact_data

POST /api/contact_data

Parameters

{
  "msisdn": "252662345917",
  "metadata": {
    "gender": "f",
    "name": "Kate"
  }
}

None known.

Response

Location: /api/contacts/166
201 Created
{
  "id": 166,
  "msisdn": "+252662345917",
  "metadata": {
    "gender": "f",
    "name": "Kate"
  },
  "created_at": "2021-09-20T13:20:39.455Z",
  "updated_at": "2021-09-20T13:20:39.455Z",
  "account_id": 383
}

Delete a Contact

Request

curl "https://scfm.somleng.org/api/contacts/168" -d '' -X DELETE \
    -H "Authorization: Bearer mDYM_Zd92TsNzGlLtX19TT3M6VrFJL01Fh_LVrBaS5A"

Endpoint

DELETE /api/contacts/:id

DELETE /api/contacts/168

Parameters

None known.

Response

Location: /api/contacts
204 No Content

List all Contacts

Request

curl -g "https://scfm.somleng.org/api/contacts?q[metadata][foo]=bar" -X GET \
    -H "Authorization: Bearer C5gy_VbmthXlpV88nEQC4P-PCMTRaC9MlMS5jdg3tHY"

Endpoint

GET /api/contacts

GET /api/contacts?q[metadata][foo]=bar

Parameters

q: {"metadata"=>{"foo"=>"bar"}}

None known.

Response

Per-Page: 25
Total: 1
200 OK
[
  {
    "id": 157,
    "msisdn": "+252662345908",
    "metadata": {
      "foo": "bar"
    },
    "created_at": "2021-09-20T13:20:39.237Z",
    "updated_at": "2021-09-20T13:20:39.237Z",
    "account_id": 375
  }
]

Retrieve a Contact

Request

curl -g "https://scfm.somleng.org/api/contacts/163" -X GET \
    -H "Authorization: Bearer cGKEyFP_Xr-QAlxR8AruTtwpRVbiYoA2178BMSHEB9U"

Endpoint

GET /api/contacts/:id

GET /api/contacts/163

Parameters

None known.

Response

Location: /api/contacts/163
200 OK
{
  "id": 163,
  "msisdn": "+252662345914",
  "metadata": {
  },
  "created_at": "2021-09-20T13:20:39.362Z",
  "updated_at": "2021-09-20T13:20:39.362Z",
  "account_id": 380
}

Update a Contact

Request

curl "https://scfm.somleng.org/api/contacts/164" -d '{
  "metadata": {
    "bar": "foo"
  },
  "metadata_merge_mode": "replace"
}' -X PATCH \
    -H "Authorization: Bearer cEj1ecDYxheuw1NV4AuyKHAW1-R1YxXl_22aJQfWpBU"

Endpoint

PATCH /api/contacts/:id

PATCH /api/contacts/164

Parameters

{
  "metadata": {
    "bar": "foo"
  },
  "metadata_merge_mode": "replace"
}

None known.

Response

Location: /api/contacts/164
204 No Content

Phone Calls

List all Phone Calls

Request

curl -g "https://scfm.somleng.org/api/phone_calls?q[metadata][foo]=bar" -X GET \
    -H "Authorization: Bearer 3ipx78U6P1Niao5-p6_33XzixQaNlDxvrB8zz224Yeo"

Endpoint

GET /api/phone_calls

GET /api/phone_calls?q[metadata][foo]=bar

Parameters

q: {"metadata"=>{"foo"=>"bar"}}

None known.

Response

Per-Page: 25
Total: 1
200 OK
[
  {
    "id": 107,
    "callout_participation_id": 137,
    "contact_id": 171,
    "status": "created",
    "msisdn": "+252662345922",
    "remote_call_id": "4b7a412c-b838-4070-a0b0-7b7bf87622b9",
    "remote_status": null,
    "remote_direction": null,
    "remote_error_message": null,
    "metadata": {
      "foo": "bar"
    },
    "remote_response": {
    },
    "remote_queue_response": {
    },
    "call_flow_logic": "CallFlowLogic::HelloWorld",
    "remotely_queued_at": null,
    "created_at": "2021-09-20T13:20:39.573Z",
    "updated_at": "2021-09-20T13:20:39.573Z",
    "duration": 0,
    "lock_version": 0,
    "account_id": 387,
    "remote_status_fetch_queued_at": null,
    "callout_id": 194
  }
]

Retrieve a Phone Call

Request

curl -g "https://scfm.somleng.org/api/phone_calls/116" -X GET \
    -H "Authorization: Bearer IfoIy8WyX8ztkhpxNJq50DOePdgSchCJXEWGE4P2oGA"

Endpoint

GET /api/phone_calls/:id

GET /api/phone_calls/116

Parameters

None known.

Response

Location: /api/phone_calls/116
200 OK
{
  "id": 116,
  "callout_participation_id": 146,
  "contact_id": 180,
  "status": "created",
  "msisdn": "+252662345931",
  "remote_call_id": "ad38f288-d14c-4091-93cd-5181a1067382",
  "remote_status": null,
  "remote_direction": null,
  "remote_error_message": null,
  "metadata": {
  },
  "remote_response": {
  },
  "remote_queue_response": {
  },
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "remotely_queued_at": null,
  "created_at": "2021-09-20T13:20:39.814Z",
  "updated_at": "2021-09-20T13:20:39.814Z",
  "duration": 0,
  "lock_version": 0,
  "account_id": 393,
  "remote_status_fetch_queued_at": null,
  "callout_id": 203
}

Remote Phone Call Events

Remote Phone Call Events are created by Somleng or Twilio Webhooks, when an event happens in a Phone Call. Setup your Somleng or Twilio Webhook endpoint to point to /api/remote_phone_call_events

List all Remote Phone Call Events

Request

curl -g "https://scfm.somleng.org/api/remote_phone_call_events?q[metadata][foo]=bar" -X GET \
    -H "Authorization: Bearer SV_0nS7milbwfEXs8ZBXs3J6uIxjluRGcvPS6urKQ10"

Endpoint

GET /api/remote_phone_call_events

GET /api/remote_phone_call_events?q[metadata][foo]=bar

Parameters

q: {"metadata"=>{"foo"=>"bar"}}

None known.

Response

Per-Page: 25
Total: 1
200 OK
[
  {
    "id": 39,
    "phone_call_id": 117,
    "details": {
      "To": "345",
      "From": "252662345933",
      "CallSid": "d44124aa-4e2d-49ff-9cda-4e39f0cf903f",
      "Direction": "inbound",
      "AccountSid": "ba8c978b-4ab0-43a5-b257-3ebd950698b7",
      "ApiVersion": "2010-04-01",
      "CallStatus": "completed"
    },
    "metadata": {
      "foo": "bar"
    },
    "remote_call_id": "d44124aa-4e2d-49ff-9cda-4e39f0cf903f",
    "remote_direction": "inbound",
    "call_flow_logic": "CallFlowLogic::HelloWorld",
    "created_at": "2021-09-20T13:20:39.873Z",
    "updated_at": "2021-09-20T13:20:39.873Z",
    "call_duration": 0
  }
]

Retrieve a Remote Phone Call Event

Request

curl -g "https://scfm.somleng.org/api/remote_phone_call_events/50" -X GET \
    -H "Authorization: Bearer tXf1PvnPN4oFxJkZJihVYhjLKlruVCqkb2YEi_Qn-PI"

Endpoint

GET /api/remote_phone_call_events/:id

GET /api/remote_phone_call_events/50

Parameters

None known.

Response

Location: /api/remote_phone_call_events/50
200 OK
{
  "id": 50,
  "phone_call_id": 128,
  "details": {
    "To": "345",
    "From": "252662345955",
    "CallSid": "e2823e69-9d71-466f-8923-086fc8566404",
    "Direction": "inbound",
    "AccountSid": "5d53e75f-86ee-4100-b073-feb39e0733f9",
    "ApiVersion": "2010-04-01",
    "CallStatus": "completed"
  },
  "metadata": {
  },
  "remote_call_id": "e2823e69-9d71-466f-8923-086fc8566404",
  "remote_direction": "inbound",
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "created_at": "2021-09-20T13:20:40.214Z",
  "updated_at": "2021-09-20T13:20:40.214Z",
  "call_duration": 0
}

Update a Remote Phone Call Event

Request

curl "https://scfm.somleng.org/api/remote_phone_call_events/51" -d '{
  "metadata": {
    "foo": "bar"
  },
  "metadata_merge_mode": "replace"
}' -X PATCH \
    -H "Authorization: Bearer IoPA-EaUtGcfdlz9Ai1fnxL9r1G5IuiKcU9vKKn-1SE"

Endpoint

PATCH /api/remote_phone_call_events/:id

PATCH /api/remote_phone_call_events/51

Parameters

{
  "metadata": {
    "foo": "bar"
  },
  "metadata_merge_mode": "replace"
}

None known.

Response

Location: /api/remote_phone_call_events/51
204 No Content

Shared API Features

Filtering, Sorting and Pagination

All index requests can be filtered and sorted by using the q and sort parameters. Responses are paginated. The maxiumum number of items displayed for a single request is 25. This can be verified by the Per-Page response header. The actual number of items will appear in the Total header. If there are more than 25 items then you'll see a Link header with links to the first, last, next and previous pages. The links are formatted according to RFC-8288.

Request

curl -g "https://scfm.somleng.org/api/contacts?q[metadata][gender]=f&q[created_at_after]=2021-09-19&sort=-id%2Ccreated_at" -X GET \
    -H "Authorization: Bearer fG8OHpHiO7fwRUFKjtqcMgpm-_tSc0nvQJWtomnipsg"

Endpoint

GET /api/contacts

GET /api/contacts?q[metadata][gender]=f&q[created_at_after]=2021-09-19&sort=-id%2Ccreated_at

Parameters

q: {"metadata"=>{"gender"=>"f"}, "created_at_after"=>"2021-09-19"}
sort: -id,created_at
Name Description
q A filter in which to filter resources. You can always filter by metadata, created_at and updated_at. Additional filters are available different resources
sort A comma separated list of sort columns. For example to sort by id in descending order, then by created_at in ascending order, specify sort: -id,created_at

Response

Per-Page: 25
Total: 26
200 OK
[
  {
    "id": 222,
    "msisdn": "+252662345984",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-09-20T13:20:40.492Z",
    "updated_at": "2021-09-20T13:20:40.492Z",
    "account_id": 407
  },
  {
    "id": 221,
    "msisdn": "+252662345983",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-09-20T13:20:40.489Z",
    "updated_at": "2021-09-20T13:20:40.489Z",
    "account_id": 407
  },
  {
    "id": 220,
    "msisdn": "+252662345982",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-09-20T13:20:40.487Z",
    "updated_at": "2021-09-20T13:20:40.487Z",
    "account_id": 407
  },
  {
    "id": 219,
    "msisdn": "+252662345981",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-09-20T13:20:40.482Z",
    "updated_at": "2021-09-20T13:20:40.482Z",
    "account_id": 407
  },
  {
    "id": 218,
    "msisdn": "+252662345980",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-09-20T13:20:40.479Z",
    "updated_at": "2021-09-20T13:20:40.479Z",
    "account_id": 407
  },
  {
    "id": 217,
    "msisdn": "+252662345979",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-09-20T13:20:40.477Z",
    "updated_at": "2021-09-20T13:20:40.477Z",
    "account_id": 407
  },
  {
    "id": 216,
    "msisdn": "+252662345978",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-09-20T13:20:40.474Z",
    "updated_at": "2021-09-20T13:20:40.474Z",
    "account_id": 407
  },
  {
    "id": 215,
    "msisdn": "+252662345977",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-09-20T13:20:40.471Z",
    "updated_at": "2021-09-20T13:20:40.471Z",
    "account_id": 407
  },
  {
    "id": 214,
    "msisdn": "+252662345976",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-09-20T13:20:40.468Z",
    "updated_at": "2021-09-20T13:20:40.468Z",
    "account_id": 407
  },
  {
    "id": 213,
    "msisdn": "+252662345975",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-09-20T13:20:40.464Z",
    "updated_at": "2021-09-20T13:20:40.464Z",
    "account_id": 407
  },
  {
    "id": 212,
    "msisdn": "+252662345974",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-09-20T13:20:40.462Z",
    "updated_at": "2021-09-20T13:20:40.462Z",
    "account_id": 407
  },
  {
    "id": 211,
    "msisdn": "+252662345973",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-09-20T13:20:40.459Z",
    "updated_at": "2021-09-20T13:20:40.459Z",
    "account_id": 407
  },
  {
    "id": 210,
    "msisdn": "+252662345972",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-09-20T13:20:40.457Z",
    "updated_at": "2021-09-20T13:20:40.457Z",
    "account_id": 407
  },
  {
    "id": 209,
    "msisdn": "+252662345971",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-09-20T13:20:40.454Z",
    "updated_at": "2021-09-20T13:20:40.454Z",
    "account_id": 407
  },
  {
    "id": 208,
    "msisdn": "+252662345970",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-09-20T13:20:40.452Z",
    "updated_at": "2021-09-20T13:20:40.452Z",
    "account_id": 407
  },
  {
    "id": 207,
    "msisdn": "+252662345969",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-09-20T13:20:40.449Z",
    "updated_at": "2021-09-20T13:20:40.449Z",
    "account_id": 407
  },
  {
    "id": 206,
    "msisdn": "+252662345968",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-09-20T13:20:40.446Z",
    "updated_at": "2021-09-20T13:20:40.446Z",
    "account_id": 407
  },
  {
    "id": 205,
    "msisdn": "+252662345967",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-09-20T13:20:40.443Z",
    "updated_at": "2021-09-20T13:20:40.443Z",
    "account_id": 407
  },
  {
    "id": 204,
    "msisdn": "+252662345966",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-09-20T13:20:40.441Z",
    "updated_at": "2021-09-20T13:20:40.441Z",
    "account_id": 407
  },
  {
    "id": 203,
    "msisdn": "+252662345965",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-09-20T13:20:40.438Z",
    "updated_at": "2021-09-20T13:20:40.438Z",
    "account_id": 407
  },
  {
    "id": 202,
    "msisdn": "+252662345964",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-09-20T13:20:40.435Z",
    "updated_at": "2021-09-20T13:20:40.435Z",
    "account_id": 407
  },
  {
    "id": 201,
    "msisdn": "+252662345963",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-09-20T13:20:40.432Z",
    "updated_at": "2021-09-20T13:20:40.432Z",
    "account_id": 407
  },
  {
    "id": 200,
    "msisdn": "+252662345962",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-09-20T13:20:40.429Z",
    "updated_at": "2021-09-20T13:20:40.429Z",
    "account_id": 407
  },
  {
    "id": 199,
    "msisdn": "+252662345961",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-09-20T13:20:40.426Z",
    "updated_at": "2021-09-20T13:20:40.426Z",
    "account_id": 407
  },
  {
    "id": 198,
    "msisdn": "+252662345960",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-09-20T13:20:40.423Z",
    "updated_at": "2021-09-20T13:20:40.423Z",
    "account_id": 407
  }
]

Metadata

Metadata is useful for storing additional, structured information on an object. As an example, you could store the contact's name and gender on the Contact object.

Request

curl "https://scfm.somleng.org/api/contacts/225" -d '{
  "metadata": {
    "name": "Kate"
  },
  "metadata_merge_mode": "replace"
}' -X PATCH \
    -H "Authorization: Bearer 7JVsi3Uf7knOuVYt-rhzox5D7GGEuSilD60TRPJdPk8"

Endpoint

PATCH /api/contacts/:id

PATCH /api/contacts/225

Parameters

{
  "metadata": {
    "name": "Kate"
  },
  "metadata_merge_mode": "replace"
}
Name Description
metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
metadata_merge_mode One of: merge (default), replace or deep_merge. merge merges the new metadata with the existing metadata. replace replaces the existing metadata with the new metadata. deep_merge deep merges the existing metadata with the new metadata.

Response

Location: /api/contacts/225
204 No Content

Users

Create a User

Request

curl "https://scfm.somleng.org/api/users" -d '{
  "email": "user32@example.com",
  "password": "secret123",
  "metadata": {
    "foo": "bar"
  }
}' -X POST \
    -H "Authorization: Bearer QZvgG1_F_OlOQNB5um5iA6v4NW3KEI6KLjwtGDiCuko"

Endpoint

POST /api/users

POST /api/users

Parameters

{
  "email": "user32@example.com",
  "password": "secret123",
  "metadata": {
    "foo": "bar"
  }
}
Name Description
email required The email address of the user
password required The initial password of the user. The user can change their password when they log in.

Response

Location: /api/users/25
201 Created
{
  "id": 25,
  "account_id": 414,
  "metadata": {
    "foo": "bar"
  },
  "email": "user32@example.com",
  "created_at": "2021-09-20T13:20:40.667Z",
  "updated_at": "2021-09-20T13:20:40.667Z",
  "locale": "en"
}

Create a User Event

Request

curl "https://scfm.somleng.org/api/users/30/user_events" -d '{
  "event": "invite"
}' -X POST \
    -H "Authorization: Bearer YymtKvBHaFKAV1WIJjKkKdz0ax0bvGUBZLgA9HYEc-M"

Endpoint

POST /api/users/:user_id/user_events

POST /api/users/30/user_events

Parameters

{
  "event": "invite"
}
Name Description
event required Only invite is supported at this time

Response

Location: /api/users/30
201 Created
{
  "account_id": 420,
  "id": 30,
  "metadata": {
  },
  "email": "user37@example.com",
  "created_at": "2021-09-20T13:20:40.811Z",
  "updated_at": "2021-09-20T13:20:40.827Z",
  "locale": "en"
}

Delete a User

Request

curl "https://scfm.somleng.org/api/users/29" -d '' -X DELETE \
    -H "Authorization: Bearer Ym1Lr5WkGjufxJp8blpDPR8Ua9_PDcAyXmu0rnvhNxk"

Endpoint

DELETE /api/users/:id

DELETE /api/users/29

Parameters

None known.

Response

Location: /api/users
204 No Content

List all Users

Request

curl -g "https://scfm.somleng.org/api/users?q[metadata][foo]=bar" -X GET \
    -H "Authorization: Bearer vcLFMyY5J4LEnkmh7asd63NpFyGeShf8r9UldyjbaZM"

Endpoint

GET /api/users

GET /api/users?q[metadata][foo]=bar

Parameters

q: {"metadata"=>{"foo"=>"bar"}}

None known.

Response

Per-Page: 25
Total: 1
200 OK
[
  {
    "id": 20,
    "account_id": 410,
    "metadata": {
      "foo": "bar"
    },
    "email": "user27@example.com",
    "created_at": "2021-09-20T13:20:40.566Z",
    "updated_at": "2021-09-20T13:20:40.566Z",
    "locale": "en"
  }
]

Retrieve a User

Request

curl -g "https://scfm.somleng.org/api/users/27" -X GET \
    -H "Authorization: Bearer g-fTaOUTIgdkdF6BfNvvMCFGlTwfg-V0-70v60Y7T2M"

Endpoint

GET /api/users/:id

GET /api/users/27

Parameters

None known.

Response

Location: /api/users/27
200 OK
{
  "id": 27,
  "account_id": 417,
  "metadata": {
  },
  "email": "user34@example.com",
  "created_at": "2021-09-20T13:20:40.715Z",
  "updated_at": "2021-09-20T13:20:40.715Z",
  "locale": "en"
}

Update a User

Request

curl "https://scfm.somleng.org/api/users/28" -d '{
  "metadata": {
    "bar": "foo"
  },
  "metadata_merge_mode": "replace"
}' -X PATCH \
    -H "Authorization: Bearer lbFIG3t6Qbb5wF-KNWtCFkgJwp3BFqUMvetLcqo_lGA"

Endpoint

PATCH /api/users/:id

PATCH /api/users/28

Parameters

{
  "metadata": {
    "bar": "foo"
  },
  "metadata_merge_mode": "replace"
}

None known.

Response

Location: /api/users/28
204 No Content