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 auP5kohSBezUu_fBUvs2xa08f1-9YcIvrlzUrzqgFzo"

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": "wX99_ZfpIwmjWNGvOjpBHlHzB6xFCSACw2WTJphXCzQ",
  "created_at": "2021-11-05T08:17:40.783Z",
  "updated_at": "2021-11-05T08:17:40.786Z",
  "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 1hu9iwqxcQTKSd8mMNVVRktuzk09--X9AkEizeMlPvY"

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 NoH6OSwGthbtw6HQaAKksAPzatP0sZSTMchH8_H1bzU"

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": "usx2cr-K-q0FANC1gslJ7QtzDLayFML4u7agkKmKaks",
    "created_at": "2021-11-05T08:17:40.656Z",
    "updated_at": "2021-11-05T08:17:40.657Z",
    "metadata": {
      "foo": "bar"
    },
    "permissions": [

    ]
  }
]

Retrieve an Access Token

Request

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

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": "CEZuCU5y5tk7C_-M4fn4_7-LTF0LjYy4J_0vcR9JVx0",
  "created_at": "2021-11-05T08:17:40.847Z",
  "updated_at": "2021-11-05T08:17:40.848Z",
  "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 e9wxIrPMxmBwok5ahojTvE48s2qBQdoMPWqHb1siKfI"

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 V9rYiP2G__5sDZQ_eZpiK4knE1yxJjo-O5Pc_aavpco"

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-11-05T08:17:40.954Z",
  "updated_at": "2021-11-05T08:17:40.954Z",
  "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 1PQeqK3dAwI4KIiZalGbs3W_Jgeh_djlITFUVQUeYZc"

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 JXx46pSxwzS4xeABEz9NU4kLfWsJmThc_n26QcNd5cc"

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-11-05T08:17:41.067Z",
  "updated_at": "2021-11-05T08:17:41.067Z",
  "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 OcrpC3BAMVy5ZOEG6ZTyr7KOEKVgOl2Byk25mGgoxYM"

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 589q2SGto2uHGi6LxiZpD0SWKHpYkAt7mb-wtqEjg9g"

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-11-05T08:17:41.005Z",
    "updated_at": "2021-11-05T08:17:41.005Z",
    "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 kvOeEn0OHJIZfmFKZKV6I8vXCo2jq0BHB_kYCCDbQnA"

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-11-05T08:17:41.077Z",
  "updated_at": "2021-11-05T08:17:41.077Z",
  "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": "c4a5e7c7-9723-442b-8d06-fa5e58559f9c",
  "twilio_auth_token": "095781bd-a711-4d74-a838-7daf9afb69d3",
  "somleng_auth_token": "f750f0d9-2988-4930-b3ba-b73dc45a5773",
  "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 Y-ceWNLYB4KILdpJFJvakFUOH8wYmhuP-zZ2JuNgCbM"

Endpoint

PATCH /api/accounts/:id

PATCH /api/accounts/334

Parameters

{
  "metadata": {
    "foo": "bar"
  },
  "metadata_merge_mode": "replace",
  "twilio_account_sid": "AC8",
  "somleng_account_sid": "c4a5e7c7-9723-442b-8d06-fa5e58559f9c",
  "twilio_auth_token": "095781bd-a711-4d74-a838-7daf9afb69d3",
  "somleng_auth_token": "f750f0d9-2988-4930-b3ba-b73dc45a5773",
  "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 y7AEJbve6niJMP1FHVOW8KjMmeIRg0cgv9RpZzdXvAk"

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-11-05T08:17:41.499Z",
  "updated_at": "2021-11-05T08:17:41.499Z",
  "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 XENqEqOy-lnwaCHcdkGS8Fpem1k58hmtY9-Phk8bCmg"

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 ryiB58Twkal4hMrnbUGNjNsrQtHHyd2H1qmKyeUVIQA"

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-11-05T08:17:41.223Z",
    "updated_at": "2021-11-05T08:17:41.223Z",
    "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 Hvf7DaZC66xmUkEi5sedL_-3uBSwtOlP5Ve2Fpxacek"

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-11-05T08:17:41.289Z",
  "updated_at": "2021-11-05T08:17:41.289Z",
  "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 zQeiDropkT3azSCz0EPBoYhOIEuU7tSfz-SCOe5Fy7o"

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-11-05T08:17:41.339Z",
  "updated_at": "2021-11-05T08:17:41.339Z",
  "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 ZIwNUYZhNDZe4NInbVDKctgc8-uRLydVYe7TYNo66Qs"

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 kjpUqsNklAR64hpFkonR9nFMg6997UM9IInQb5xq10Q"

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-11-05T08:17:41.813Z",
  "updated_at": "2021-11-05T08:17:41.813Z",
  "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 QVuP5ZyHftADP14rL4jxV_5RhWd1OxjkNDqr663xOFM"

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 KOa8UL9glnqOe_dPSQ9ShdGvJisxJv_dN-mIfD7nMUA"

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 UWx8Pg3XlqaggyX22ezKxNGAxkK8zcfbUmCnlqtYU7Q"

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 ysxrifvNNxo2ei4yaPL0FELJ9D7rxu1WUV8hpUuR9RE"

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-11-05T08:17:41.635Z",
    "updated_at": "2021-11-05T08:17:41.635Z",
    "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 yxPslibnF2EORsH-802GXcbSRVabtTBr3OMTbL-c_4M"

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-11-05T08:17:41.865Z",
  "updated_at": "2021-11-05T08:17:41.865Z",
  "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 O5cq_HApCNQpYUxD-HprEzZ9yOS3t1kziZmfzlzaJPs"

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 1cLs5_5mx65rUi8-k87vJ5FhQTYVVgfXcsKCQ_B7FXo"

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-11-05T08:17:42.125Z",
  "updated_at": "2021-11-05T08:17:42.125Z",
  "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 R74dEAQHPYG8xzHbngqergutw1h3mg6xpIpvAx2gAoI"

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-11-05T08:17:42.286Z",
  "updated_at": "2021-11-05T08:17:42.309Z",
  "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 MDaGnOb6litjV7QKi4BtsSm03qra2NCtnOtihcOn1jY"

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 B5MXb_0c9k_aQWNdNr7AOaMtyZ4FD8qvlZG1MhYjo38"

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-11-05T08:17:42.022Z",
    "updated_at": "2021-11-05T08:17:42.022Z",
    "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 lacBqk_C-zFZDvUwZHimrejMgIgAq2z0P3IwDrq0z_I"

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-11-05T08:17:42.140Z",
  "updated_at": "2021-11-05T08:17:42.140Z",
  "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 kn5bnbtV8_LlKBLFTXIDGvIpzt3Z8FR8hyiaSZBa-0A"

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 lMnYZsES1_leLVgHVgSj-M69hsAay2PEUtJ-8DBZgM0"

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-11-05T08:17:42.480Z",
  "updated_at": "2021-11-05T08:17:42.480Z",
  "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 gD8YD_R9JT-wn8jsV4GCKAaNK73UZ_kknqPu_lkZyW8"

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-11-05T08:17:42.618Z",
  "updated_at": "2021-11-05T08:17:42.618Z",
  "account_id": 383
}

Delete a Contact

Request

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

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 IktJGWW9VrB665_pXHnkAktef5n2w9-cQpesDDlMcZk"

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-11-05T08:17:42.384Z",
    "updated_at": "2021-11-05T08:17:42.384Z",
    "account_id": 375
  }
]

Retrieve a Contact

Request

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

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-11-05T08:17:42.515Z",
  "updated_at": "2021-11-05T08:17:42.515Z",
  "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 xGedsAztFAHJf2jq6mkXJhc63V-3ZzChDznI35bdhNk"

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 _fC1dyhZ8Y2OHvr3ISVG6H-FcHBkr3B1QP7HR4IkLhk"

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": "00c44dea-2ba4-4ede-ab21-c0b0486ad32a",
    "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-11-05T08:17:42.753Z",
    "updated_at": "2021-11-05T08:17:42.753Z",
    "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 Ww55oVj2q92QkM2u5ePDlWyOzQDm6rEz0fdn8TzDr8M"

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": "a7f2cd7e-8466-4b07-991f-8fab2c02455e",
  "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-11-05T08:17:43.026Z",
  "updated_at": "2021-11-05T08:17:43.026Z",
  "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 c9DJaTg9FEh_B0uoG8jdJ-O43Wvl50crslMCUakvgJ0"

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": "ec60607a-ff53-4d8a-be0f-a62cf9089c4c",
      "Direction": "inbound",
      "AccountSid": "55b97a77-7345-4363-9186-3990586de24d",
      "ApiVersion": "2010-04-01",
      "CallStatus": "completed"
    },
    "metadata": {
      "foo": "bar"
    },
    "remote_call_id": "ec60607a-ff53-4d8a-be0f-a62cf9089c4c",
    "remote_direction": "inbound",
    "call_flow_logic": "CallFlowLogic::HelloWorld",
    "created_at": "2021-11-05T08:17:43.093Z",
    "updated_at": "2021-11-05T08:17:43.093Z",
    "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 GYI2wwoIDcX2Cp_APDoOe5LBTETt8utPSgXZuHCt3vA"

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": "39cbdf03-17d5-4b33-b8d2-75fa2db68b2f",
    "Direction": "inbound",
    "AccountSid": "8933ba6a-38b3-4c41-be43-661f35bc676f",
    "ApiVersion": "2010-04-01",
    "CallStatus": "completed"
  },
  "metadata": {
  },
  "remote_call_id": "39cbdf03-17d5-4b33-b8d2-75fa2db68b2f",
  "remote_direction": "inbound",
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "created_at": "2021-11-05T08:17:43.458Z",
  "updated_at": "2021-11-05T08:17:43.458Z",
  "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 F4wOlsNvQWA0JhWwl-EW0xQZUh-rbHa3LaRojvdDl0c"

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-11-04&sort=-id%2Ccreated_at" -X GET \
    -H "Authorization: Bearer QbUYw8266u2uZH5atFgKd_B_xyXNY3QfdsmPNO6y9pk"

Endpoint

GET /api/contacts

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

Parameters

q: {"metadata"=>{"gender"=>"f"}, "created_at_after"=>"2021-11-04"}
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-11-05T08:17:43.783Z",
    "updated_at": "2021-11-05T08:17:43.783Z",
    "account_id": 407
  },
  {
    "id": 221,
    "msisdn": "+252662345983",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-11-05T08:17:43.780Z",
    "updated_at": "2021-11-05T08:17:43.780Z",
    "account_id": 407
  },
  {
    "id": 220,
    "msisdn": "+252662345982",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-11-05T08:17:43.776Z",
    "updated_at": "2021-11-05T08:17:43.776Z",
    "account_id": 407
  },
  {
    "id": 219,
    "msisdn": "+252662345981",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-11-05T08:17:43.773Z",
    "updated_at": "2021-11-05T08:17:43.773Z",
    "account_id": 407
  },
  {
    "id": 218,
    "msisdn": "+252662345980",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-11-05T08:17:43.770Z",
    "updated_at": "2021-11-05T08:17:43.770Z",
    "account_id": 407
  },
  {
    "id": 217,
    "msisdn": "+252662345979",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-11-05T08:17:43.766Z",
    "updated_at": "2021-11-05T08:17:43.766Z",
    "account_id": 407
  },
  {
    "id": 216,
    "msisdn": "+252662345978",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-11-05T08:17:43.763Z",
    "updated_at": "2021-11-05T08:17:43.763Z",
    "account_id": 407
  },
  {
    "id": 215,
    "msisdn": "+252662345977",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-11-05T08:17:43.760Z",
    "updated_at": "2021-11-05T08:17:43.760Z",
    "account_id": 407
  },
  {
    "id": 214,
    "msisdn": "+252662345976",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-11-05T08:17:43.756Z",
    "updated_at": "2021-11-05T08:17:43.756Z",
    "account_id": 407
  },
  {
    "id": 213,
    "msisdn": "+252662345975",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-11-05T08:17:43.753Z",
    "updated_at": "2021-11-05T08:17:43.753Z",
    "account_id": 407
  },
  {
    "id": 212,
    "msisdn": "+252662345974",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-11-05T08:17:43.750Z",
    "updated_at": "2021-11-05T08:17:43.750Z",
    "account_id": 407
  },
  {
    "id": 211,
    "msisdn": "+252662345973",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-11-05T08:17:43.747Z",
    "updated_at": "2021-11-05T08:17:43.747Z",
    "account_id": 407
  },
  {
    "id": 210,
    "msisdn": "+252662345972",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-11-05T08:17:43.743Z",
    "updated_at": "2021-11-05T08:17:43.743Z",
    "account_id": 407
  },
  {
    "id": 209,
    "msisdn": "+252662345971",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-11-05T08:17:43.740Z",
    "updated_at": "2021-11-05T08:17:43.740Z",
    "account_id": 407
  },
  {
    "id": 208,
    "msisdn": "+252662345970",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-11-05T08:17:43.737Z",
    "updated_at": "2021-11-05T08:17:43.737Z",
    "account_id": 407
  },
  {
    "id": 207,
    "msisdn": "+252662345969",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-11-05T08:17:43.734Z",
    "updated_at": "2021-11-05T08:17:43.734Z",
    "account_id": 407
  },
  {
    "id": 206,
    "msisdn": "+252662345968",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-11-05T08:17:43.731Z",
    "updated_at": "2021-11-05T08:17:43.731Z",
    "account_id": 407
  },
  {
    "id": 205,
    "msisdn": "+252662345967",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-11-05T08:17:43.728Z",
    "updated_at": "2021-11-05T08:17:43.728Z",
    "account_id": 407
  },
  {
    "id": 204,
    "msisdn": "+252662345966",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-11-05T08:17:43.725Z",
    "updated_at": "2021-11-05T08:17:43.725Z",
    "account_id": 407
  },
  {
    "id": 203,
    "msisdn": "+252662345965",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-11-05T08:17:43.722Z",
    "updated_at": "2021-11-05T08:17:43.722Z",
    "account_id": 407
  },
  {
    "id": 202,
    "msisdn": "+252662345964",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-11-05T08:17:43.719Z",
    "updated_at": "2021-11-05T08:17:43.719Z",
    "account_id": 407
  },
  {
    "id": 201,
    "msisdn": "+252662345963",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-11-05T08:17:43.716Z",
    "updated_at": "2021-11-05T08:17:43.716Z",
    "account_id": 407
  },
  {
    "id": 200,
    "msisdn": "+252662345962",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-11-05T08:17:43.713Z",
    "updated_at": "2021-11-05T08:17:43.713Z",
    "account_id": 407
  },
  {
    "id": 199,
    "msisdn": "+252662345961",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-11-05T08:17:43.710Z",
    "updated_at": "2021-11-05T08:17:43.710Z",
    "account_id": 407
  },
  {
    "id": 198,
    "msisdn": "+252662345960",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-11-05T08:17:43.707Z",
    "updated_at": "2021-11-05T08:17:43.707Z",
    "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 ECvW5TPFNYq5X7Pv8cixdTWom7w6yrd76ylm9EESkJU"

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 kCEbWCajJtuOT1Rw1wwibDWt5hZu85s9gpR5py84loo"

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-11-05T08:17:43.976Z",
  "updated_at": "2021-11-05T08:17:43.976Z",
  "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 xE9b_33glfACnDZcjgndmx4jzdEIRZ6iptw4zzbxda4"

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-11-05T08:17:44.133Z",
  "updated_at": "2021-11-05T08:17:44.151Z",
  "locale": "en"
}

Delete a User

Request

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

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 tlNSftGyPbF-dVhd8VVh--9DRpl4kncIRJRD_4DQwss"

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-11-05T08:17:43.872Z",
    "updated_at": "2021-11-05T08:17:43.872Z",
    "locale": "en"
  }
]

Retrieve a User

Request

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

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-11-05T08:17:44.026Z",
  "updated_at": "2021-11-05T08:17:44.026Z",
  "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 Tdg8Xl-uO6Na_XEC7cjN2bG80iNJtVJYbaAW5jtXIIs"

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