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

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": "GdQexF0eol1fL_tciDwOKHFby5bslwjLcoQfxpXnMFs",
  "created_at": "2021-02-17T23:10:21.713Z",
  "updated_at": "2021-02-17T23:10:21.716Z",
  "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 4IDZ1Eb6dlf7oSbNgy2K5qm1oRcwBI8M6BnsWh-42QM"

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 kVJrNgTun8Ycbwx4ViISp-gIX-y3R0nxRdxHhtP7CY4"

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": "25ZHjLRQ9ZZ8ks2QJ95FYTkPF-ehdtzenK3zRV8lJqQ",
    "created_at": "2021-02-17T23:10:21.548Z",
    "updated_at": "2021-02-17T23:10:21.550Z",
    "metadata": {
      "foo": "bar"
    },
    "permissions": [

    ]
  }
]

Retrieve an Access Token

Request

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

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": "hk2WpiU9VAZqUSVuj0bAKE9vGvmNT0l4wN1aJ9jd3Wc",
  "created_at": "2021-02-17T23:10:21.764Z",
  "updated_at": "2021-02-17T23:10:21.766Z",
  "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 MMxSHGFngzc-sPRK1wxWZVdIf1K8qGf4cGZ-0RQ33nk"

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 2XIFkTW9qmlPhRgjcHhdunEfE2gok0Zmn8WcrcJUmcs"

Endpoint

GET /api/account

GET /api/account

Parameters

None known.

Response

Location: /api/accounts/516
200 OK
{
  "id": 516,
  "metadata": {
  },
  "settings": {
  },
  "twilio_account_sid": null,
  "somleng_account_sid": null,
  "twilio_auth_token": null,
  "somleng_auth_token": null,
  "permissions": [

  ],
  "created_at": "2021-02-17T23:10:21.869Z",
  "updated_at": "2021-02-17T23:10:21.869Z",
  "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 _B3Efb7mWic5KFzMPQOn56E6v_7BbPUn87G20PiLAhc"

Endpoint

PATCH /api/account

PATCH /api/account

Parameters

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

None known.

Response

Location: /api/accounts/517
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 SxQZQ5Xe6I5M4K1zNKGvzcTVHRv2R4cyMHwqgFL336o"

Endpoint

POST /api/accounts

POST /api/accounts

Parameters

None known.

Response

Location: /api/accounts/522
201 Created
{
  "id": 522,
  "metadata": {
  },
  "settings": {
  },
  "twilio_account_sid": null,
  "somleng_account_sid": null,
  "twilio_auth_token": null,
  "somleng_auth_token": null,
  "permissions": [

  ],
  "created_at": "2021-02-17T23:10:21.976Z",
  "updated_at": "2021-02-17T23:10:21.976Z",
  "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/527" -d '' -X DELETE \
    -H "Authorization: Bearer ooZtSEsBAN8_WJ5o32sO5dxOP8-8tYHOQcArakqBI0Q"

Endpoint

DELETE /api/accounts/:id

DELETE /api/accounts/527

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 wiWTVUV-kxM-VaAXdGIpcdDc5ssQlEEYwAhM-WUV-A4"

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": 518,
    "metadata": {
      "foo": "bar"
    },
    "settings": {
    },
    "twilio_account_sid": null,
    "somleng_account_sid": null,
    "twilio_auth_token": null,
    "somleng_auth_token": null,
    "permissions": [

    ],
    "created_at": "2021-02-17T23:10:21.917Z",
    "updated_at": "2021-02-17T23:10:21.917Z",
    "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/523" -X GET \
    -H "Authorization: Bearer 4OI_W3psEi7ysdOPdcv75a0u_WKlk05uDoVHiBcnb70"

Endpoint

GET /api/accounts/:id

GET /api/accounts/523

Parameters

None known.

Response

Location: /api/accounts/523
200 OK
{
  "id": 523,
  "metadata": {
  },
  "settings": {
  },
  "twilio_account_sid": null,
  "somleng_account_sid": null,
  "twilio_auth_token": null,
  "somleng_auth_token": null,
  "permissions": [

  ],
  "created_at": "2021-02-17T23:10:21.984Z",
  "updated_at": "2021-02-17T23:10:21.984Z",
  "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/525" -d '{
  "metadata": {
    "foo": "bar"
  },
  "metadata_merge_mode": "replace",
  "twilio_account_sid": "AC9",
  "somleng_account_sid": "2854a0c4-5e9d-46f6-8d6b-b152d3a90a56",
  "twilio_auth_token": "c79bf347-059e-445d-a4ee-6d2df3b441e4",
  "somleng_auth_token": "8fec351b-f573-4240-a527-d864dbe361e9",
  "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 3P7I9R-hU0it-vUDP7QZmIhz5wdKSIbIg1z2jYRC_bE"

Endpoint

PATCH /api/accounts/:id

PATCH /api/accounts/525

Parameters

{
  "metadata": {
    "foo": "bar"
  },
  "metadata_merge_mode": "replace",
  "twilio_account_sid": "AC9",
  "somleng_account_sid": "2854a0c4-5e9d-46f6-8d6b-b152d3a90a56",
  "twilio_auth_token": "c79bf347-059e-445d-a4ee-6d2df3b441e4",
  "somleng_auth_token": "8fec351b-f573-4240-a527-d864dbe361e9",
  "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/525
204 No Content

Batch Operations

Create Phone Calls

Create a batch operation for creating phone calls. Specify remote_request_params to provide the request parameters for the phone call. You can filter which phone calls will be created using callout_filter_params, contact_filter_params and callout_participation_filter_params.

Request

curl "https://scfm.somleng.org/api/batch_operations" -d '{
  "metadata": {
    "foo": "bar"
  },
  "parameters": {
    "skip_validate_preview_presence": "1",
    "remote_request_params": {
      "url": "https://scfm.somleng.org/api/remote_phone_call_events",
      "from": "1234",
      "status_callback": "https://scfm.somleng.org/api/remote_phone_call_events"
    },
    "callout_filter_params": {
      "status": "running"
    },
    "callout_participation_filter_params": {
      "having_max_phone_calls_count": 3,
      "no_phone_calls_or_last_attempt": "not_answered,busy,failed"
    },
    "limit": 20
  },
  "type": "BatchOperation::PhoneCallCreate"
}' -X POST \
    -H "Authorization: Bearer 8T2r-LMTQzQWZbVTd1Mn6SheSOj7s1A3NkiDhi3CVnA"

Endpoint

POST /api/batch_operations

POST /api/batch_operations

Parameters

{
  "metadata": {
    "foo": "bar"
  },
  "parameters": {
    "skip_validate_preview_presence": "1",
    "remote_request_params": {
      "url": "https://scfm.somleng.org/api/remote_phone_call_events",
      "from": "1234",
      "status_callback": "https://scfm.somleng.org/api/remote_phone_call_events"
    },
    "callout_filter_params": {
      "status": "running"
    },
    "callout_participation_filter_params": {
      "having_max_phone_calls_count": 3,
      "no_phone_calls_or_last_attempt": "not_answered,busy,failed"
    },
    "limit": 20
  },
  "type": "BatchOperation::PhoneCallCreate"
}
Name Description
type required One of: BatchOperation::CalloutPopulation, BatchOperation::PhoneCallCreate, BatchOperation::PhoneCallQueue, BatchOperation::PhoneCallQueueRemoteFetch
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/74
201 Created
{
  "id": 74,
  "callout_id": null,
  "parameters": {
    "skip_validate_preview_presence": "1",
    "remote_request_params": {
      "url": "https://scfm.somleng.org/api/remote_phone_call_events",
      "from": "1234",
      "status_callback": "https://scfm.somleng.org/api/remote_phone_call_events"
    },
    "callout_filter_params": {
      "status": "running"
    },
    "callout_participation_filter_params": {
      "having_max_phone_calls_count": 3,
      "no_phone_calls_or_last_attempt": "not_answered,busy,failed"
    },
    "limit": 20
  },
  "metadata": {
    "foo": "bar"
  },
  "status": "preview",
  "created_at": "2021-02-17T23:10:22.207Z",
  "updated_at": "2021-02-17T23:10:22.207Z",
  "account_id": 534,
  "type": "BatchOperation::PhoneCallCreate"
}

Create a Batch Operation Event

Request

curl "https://scfm.somleng.org/api/batch_operations/81/batch_operation_events" -d '{
  "event": "queue"
}' -X POST \
    -H "Authorization: Bearer UWemgglN-94Ububa-QLGzIgd8sFBC-IKpsuXy_9k3cE"

Endpoint

POST /api/batch_operations/:batch_operation_id/batch_operation_events

POST /api/batch_operations/81/batch_operation_events

Parameters

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

Response

Location: /api/batch_operations/81
201 Created
{
  "id": 81,
  "callout_id": 251,
  "parameters": {
  },
  "metadata": {
  },
  "status": "queued",
  "created_at": "2021-02-17T23:10:22.468Z",
  "updated_at": "2021-02-17T23:10:22.468Z",
  "account_id": 544,
  "type": "BatchOperation::CalloutPopulation"
}

Delete a Batch Operation

Request

curl "https://scfm.somleng.org/api/batch_operations/79" -d '' -X DELETE \
    -H "Authorization: Bearer zvSTBqO23ySbyOp-SFVH5Oe--1mQlP2AtBIOxyIlQy4"

Endpoint

DELETE /api/batch_operations/:id

DELETE /api/batch_operations/79

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[metadata][foo]=bar" -X GET \
    -H "Authorization: Bearer nZfZhfttiQI_MPAsO4MF6Tr6_vJPZXAj64HPmMv8Oak"

Endpoint

GET /api/batch_operations

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

Parameters

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

None known.

Response

Per-Page: 25
Total: 1
200 OK
[
  {
    "id": 70,
    "callout_id": 242,
    "parameters": {
    },
    "metadata": {
      "foo": "bar"
    },
    "status": "preview",
    "created_at": "2021-02-17T23:10:22.117Z",
    "updated_at": "2021-02-17T23:10:22.117Z",
    "account_id": 531,
    "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": 245,
  "metadata": {
    "foo": "bar"
  },
  "parameters": {
    "skip_validate_preview_presence": "1",
    "contact_filter_params": {
      "metadata": {
        "gender": "f"
      }
    }
  },
  "type": "BatchOperation::CalloutPopulation"
}' -X POST \
    -H "Authorization: Bearer Oxk97VaLmQa-1zcsaw_4omoQBLYUWQqdVEafAgF8nqg"

Endpoint

POST /api/batch_operations

POST /api/batch_operations

Parameters

{
  "callout_id": 245,
  "metadata": {
    "foo": "bar"
  },
  "parameters": {
    "skip_validate_preview_presence": "1",
    "contact_filter_params": {
      "metadata": {
        "gender": "f"
      }
    }
  },
  "type": "BatchOperation::CalloutPopulation"
}
Name Description
type required One of: BatchOperation::CalloutPopulation, BatchOperation::PhoneCallCreate, BatchOperation::PhoneCallQueue, BatchOperation::PhoneCallQueueRemoteFetch
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/73
201 Created
{
  "id": 73,
  "callout_id": 245,
  "parameters": {
    "skip_validate_preview_presence": "1",
    "contact_filter_params": {
      "metadata": {
        "gender": "f"
      }
    }
  },
  "metadata": {
    "foo": "bar"
  },
  "status": "preview",
  "created_at": "2021-02-17T23:10:22.177Z",
  "updated_at": "2021-02-17T23:10:22.177Z",
  "account_id": 533,
  "type": "BatchOperation::CalloutPopulation"
}

Preview a Batch Operation

Previews a Batch Operation. For example, you can preview a CalloutPopulation batch operation for which contacts will participate in a callout.

Request

curl -g "https://scfm.somleng.org/api/batch_operations/86/preview/contacts" -X GET \
    -H "Authorization: Bearer twgaAsrKiyFZKaLw3l6JURubwfUNLSCxKSsACbM_Eu8"

Endpoint

GET /api/batch_operations/:batch_operation_id/preview/contacts

GET /api/batch_operations/86/preview/contacts

Parameters

None known.

Response

Per-Page: 25
Total: 1
200 OK
[
  {
    "id": 235,
    "msisdn": "+252662345989",
    "metadata": {
      "foo": "bar"
    },
    "created_at": "2021-02-17T23:10:22.762Z",
    "updated_at": "2021-02-17T23:10:22.762Z",
    "account_id": 549
  }
]

Queue Phone Calls

Create a batch operation for queuing phone calls to Somleng or Twilio. You can filter which phone calls will be queued using phone_call_filter_params, contact_filter_params, callout_participation_filter_params and callout_filter_params.

Request

curl "https://scfm.somleng.org/api/batch_operations" -d '{
  "metadata": {
    "foo": "bar"
  },
  "parameters": {
    "skip_validate_preview_presence": "1",
    "callout_filter_params": {
      "status": "running"
    },
    "phone_call_filter_params": {
      "status": "created"
    },
    "limit": 20
  },
  "type": "BatchOperation::PhoneCallQueue"
}' -X POST \
    -H "Authorization: Bearer MlieBYC8eFYqv0G6d2mdCmrj7miiN9L3mLijoni07tM"

Endpoint

POST /api/batch_operations

POST /api/batch_operations

Parameters

{
  "metadata": {
    "foo": "bar"
  },
  "parameters": {
    "skip_validate_preview_presence": "1",
    "callout_filter_params": {
      "status": "running"
    },
    "phone_call_filter_params": {
      "status": "created"
    },
    "limit": 20
  },
  "type": "BatchOperation::PhoneCallQueue"
}
Name Description
type required One of: BatchOperation::CalloutPopulation, BatchOperation::PhoneCallCreate, BatchOperation::PhoneCallQueue, BatchOperation::PhoneCallQueueRemoteFetch
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/75
201 Created
{
  "id": 75,
  "callout_id": null,
  "parameters": {
    "skip_validate_preview_presence": "1",
    "callout_filter_params": {
      "status": "running"
    },
    "phone_call_filter_params": {
      "status": "created"
    },
    "limit": 20
  },
  "metadata": {
    "foo": "bar"
  },
  "status": "preview",
  "created_at": "2021-02-17T23:10:22.234Z",
  "updated_at": "2021-02-17T23:10:22.234Z",
  "account_id": 535,
  "type": "BatchOperation::PhoneCallQueue"
}

Queue Remote Status Fetch

Create a batch operation for fetching the remote status of calls on Somleng or Twilio. You can filter which phone calls will be fetched using phone_call_filter_params, contact_filter_params, callout_participation_filter_params and callout_filter_params.

Request

curl "https://scfm.somleng.org/api/batch_operations" -d '{
  "metadata": {
    "foo": "bar"
  },
  "parameters": {
    "skip_validate_preview_presence": "1",
    "callout_filter_params": {
      "status": "running"
    },
    "phone_call_filter_params": {
      "status": "remotely_queued,in_progress"
    },
    "limit": 200
  },
  "type": "BatchOperation::PhoneCallQueueRemoteFetch"
}' -X POST \
    -H "Authorization: Bearer WRpu6P0eCLcs8RV_1zSGPImAYTJr69CeqnU-W_33VHE"

Endpoint

POST /api/batch_operations

POST /api/batch_operations

Parameters

{
  "metadata": {
    "foo": "bar"
  },
  "parameters": {
    "skip_validate_preview_presence": "1",
    "callout_filter_params": {
      "status": "running"
    },
    "phone_call_filter_params": {
      "status": "remotely_queued,in_progress"
    },
    "limit": 200
  },
  "type": "BatchOperation::PhoneCallQueueRemoteFetch"
}
Name Description
type required One of: BatchOperation::CalloutPopulation, BatchOperation::PhoneCallCreate, BatchOperation::PhoneCallQueue, BatchOperation::PhoneCallQueueRemoteFetch
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/76
201 Created
{
  "id": 76,
  "callout_id": null,
  "parameters": {
    "skip_validate_preview_presence": "1",
    "callout_filter_params": {
      "status": "running"
    },
    "phone_call_filter_params": {
      "status": "remotely_queued,in_progress"
    },
    "limit": 200
  },
  "metadata": {
    "foo": "bar"
  },
  "status": "preview",
  "created_at": "2021-02-17T23:10:22.263Z",
  "updated_at": "2021-02-17T23:10:22.263Z",
  "account_id": 536,
  "type": "BatchOperation::PhoneCallQueueRemoteFetch"
}

Retrieve a Batch Operation

Request

curl -g "https://scfm.somleng.org/api/batch_operations/77" -X GET \
    -H "Authorization: Bearer Scp3t87Azp7QakKcNLm_AbnTFlP5X3UFfMNifDGNv5o"

Endpoint

GET /api/batch_operations/:id

GET /api/batch_operations/77

Parameters

None known.

Response

Location: /api/batch_operations/77
200 OK
{
  "id": 77,
  "callout_id": 246,
  "parameters": {
  },
  "metadata": {
  },
  "status": "preview",
  "created_at": "2021-02-17T23:10:22.308Z",
  "updated_at": "2021-02-17T23:10:22.308Z",
  "account_id": 538,
  "type": "BatchOperation::CalloutPopulation"
}

Update a Batch Operation

Request

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

Endpoint

PATCH /api/batch_operations/:id

PATCH /api/batch_operations/78

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/78
204 No Content

Callout Participations

Create a Callout Participation

Request

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

Endpoint

POST /api/callouts/:callout_id/callout_participations

POST /api/callouts/277/callout_participations

Parameters

{
  "contact_id": 256,
  "msisdn": "252662346011",
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "metadata": {
    "foo": "bar"
  }
}

None known.

Response

Location: /api/callout_participations/230
201 Created
{
  "id": 230,
  "callout_id": 277,
  "contact_id": 256,
  "callout_population_id": null,
  "msisdn": "+252662346011",
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "metadata": {
    "foo": "bar"
  },
  "created_at": "2021-02-17T23:10:23.417Z",
  "updated_at": "2021-02-17T23:10:23.417Z"
}

Create a Callout Participation with invalid data

Request

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

Endpoint

POST /api/callouts/:callout_id/callout_participations

POST /api/callouts/278/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/233" -d '' -X DELETE \
    -H "Authorization: Bearer RFnBKhGOHff0YrMdSSlepzoyHRRi6WOvyuzKtoOLQAU"

Endpoint

DELETE /api/callout_participations/:id

DELETE /api/callout_participations/233

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/234" -d '' -X DELETE \
    -H "Authorization: Bearer 5CUi73L6kwojxE9Oc2nCMjzr5t0HpZ7_0R_-IMgTnPU"

Endpoint

DELETE /api/callout_participations/:id

DELETE /api/callout_participations/234

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&q[having_max_phone_calls_count]=1" -X GET \
    -H "Authorization: Bearer m1XoixQ0BbFirkrqrvHYSFz0uzU19XWG8LId8mtaUlY"

Endpoint

GET /api/callout_participations

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

Parameters

q: {"metadata"=>{"foo"=>"bar"}, "having_max_phone_calls_count"=>"1"}

None known.

Response

Per-Page: 25
Total: 1
200 OK
[
  {
    "id": 219,
    "callout_id": 265,
    "contact_id": 245,
    "callout_population_id": null,
    "msisdn": "+252662345999",
    "call_flow_logic": "CallFlowLogic::HelloWorld",
    "metadata": {
      "foo": "bar"
    },
    "created_at": "2021-02-17T23:10:23.113Z",
    "updated_at": "2021-02-17T23:10:23.113Z"
  }
]

Retrieve a Callout Participation

Request

curl -g "https://scfm.somleng.org/api/callout_participations/231" -X GET \
    -H "Authorization: Bearer 1v3QYhUDRyskb15e3qyUokyu8nDo-zu0QGYofPV-xuI"

Endpoint

GET /api/callout_participations/:id

GET /api/callout_participations/231

Parameters

None known.

Response

Location: /api/callout_participations/231
200 OK
{
  "id": 231,
  "callout_id": 279,
  "contact_id": 257,
  "callout_population_id": null,
  "msisdn": "+252662346012",
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "metadata": {
  },
  "created_at": "2021-02-17T23:10:23.476Z",
  "updated_at": "2021-02-17T23:10:23.476Z"
}

Update a Callout Participation

Request

curl "https://scfm.somleng.org/api/callout_participations/232" -d '{
  "contact_id": 259,
  "msisdn": "252662346015",
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "metadata": {
    "bar": "foo"
  },
  "metadata_merge_mode": "replace"
}' -X PATCH \
    -H "Authorization: Bearer vZ7UkW0QRF-kN4BHdQjm4H5JX4et94k-1FzwMwWGppY"

Endpoint

PATCH /api/callout_participations/:id

PATCH /api/callout_participations/232

Parameters

{
  "contact_id": 259,
  "msisdn": "252662346015",
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "metadata": {
    "bar": "foo"
  },
  "metadata_merge_mode": "replace"
}

None known.

Response

Location: /api/callout_participations/232
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 c-IvQ-MYMoPeL_Pm_0F_-9iKtQEZm0hQXsKrsAAPWqE"

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/288
201 Created
{
  "id": 288,
  "status": "initialized",
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "metadata": {
    "foo": "bar"
  },
  "created_at": "2021-02-17T23:10:23.724Z",
  "updated_at": "2021-02-17T23:10:23.724Z",
  "account_id": 570,
  "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/293/callout_events" -d '{
  "event": "start"
}' -X POST \
    -H "Authorization: Bearer 5Y6ns3vgzfxRGS1YX0qi8Cvl1MvwqGMD9bQUaLDjEto"

Endpoint

POST /api/callouts/:callout_id/callout_events

POST /api/callouts/293/callout_events

Parameters

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

Response

Location: /api/callouts/293
201 Created
{
  "account_id": 575,
  "id": 293,
  "status": "running",
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "metadata": {
  },
  "created_at": "2021-02-17T23:10:23.863Z",
  "updated_at": "2021-02-17T23:10:23.885Z",
  "audio_url": null,
  "settings": {
  },
  "created_by_id": null
}

Delete a Callout

Request

curl "https://scfm.somleng.org/api/callouts/291" -d '' -X DELETE \
    -H "Authorization: Bearer DXBqfcfhvyAE-rRatNArDogBwgc_2iLlFmp-DU853vI"

Endpoint

DELETE /api/callouts/:id

DELETE /api/callouts/291

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

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": 283,
    "status": "initialized",
    "call_flow_logic": "CallFlowLogic::HelloWorld",
    "metadata": {
      "foo": "bar"
    },
    "created_at": "2021-02-17T23:10:23.631Z",
    "updated_at": "2021-02-17T23:10:23.631Z",
    "account_id": 567,
    "audio_url": null,
    "settings": {
    },
    "created_by_id": null
  }
]

Retrieve a Callout

Request

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

Endpoint

GET /api/callouts/:id

GET /api/callouts/289

Parameters

None known.

Response

Location: /api/callouts/289
200 OK
{
  "id": 289,
  "status": "initialized",
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "metadata": {
  },
  "created_at": "2021-02-17T23:10:23.738Z",
  "updated_at": "2021-02-17T23:10:23.738Z",
  "account_id": 571,
  "audio_url": null,
  "settings": {
  },
  "created_by_id": null
}

Update a Callout

Request

curl "https://scfm.somleng.org/api/callouts/290" -d '{
  "metadata": {
    "bar": "foo"
  },
  "metadata_merge_mode": "replace"
}' -X PATCH \
    -H "Authorization: Bearer PlohfxUxliK-Qfq9AlnhimbKU56CgCmtCOqI6hh2Jmc"

Endpoint

PATCH /api/callouts/:id

PATCH /api/callouts/290

Parameters

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

None known.

Response

Location: /api/callouts/290
204 No Content

Contacts

Create a Contact

Request

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

Endpoint

POST /api/contacts

POST /api/contacts

Parameters

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

Response

Location: /api/contacts/273
201 Created
{
  "id": 273,
  "msisdn": "+252662346029",
  "metadata": {
    "gender": "f",
    "name": "Kate"
  },
  "created_at": "2021-02-17T23:10:24.215Z",
  "updated_at": "2021-02-17T23:10:24.215Z",
  "account_id": 583
}

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": "252662346033",
  "metadata": {
    "gender": "f",
    "name": "Kate"
  }
}' -X POST \
    -H "Authorization: Bearer AhcwXKCQhmGNdV0I5Z53u1-aBrovNcW83OARKNrG2pM"

Endpoint

POST /api/contact_data

POST /api/contact_data

Parameters

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

None known.

Response

Location: /api/contacts/277
201 Created
{
  "id": 277,
  "msisdn": "+252662346033",
  "metadata": {
    "gender": "f",
    "name": "Kate"
  },
  "created_at": "2021-02-17T23:10:24.373Z",
  "updated_at": "2021-02-17T23:10:24.373Z",
  "account_id": 588
}

Delete a Contact

Request

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

Endpoint

DELETE /api/contacts/:id

DELETE /api/contacts/279

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 QC1uuer3WeSsEXm1RtePpfzmUt-wZlvKgA08jQ5tYY0"

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": 264,
    "msisdn": "+252662346020",
    "metadata": {
      "foo": "bar"
    },
    "created_at": "2021-02-17T23:10:23.954Z",
    "updated_at": "2021-02-17T23:10:23.954Z",
    "account_id": 578
  }
]

Retrieve a Contact

Request

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

Endpoint

GET /api/contacts/:id

GET /api/contacts/274

Parameters

None known.

Response

Location: /api/contacts/274
200 OK
{
  "id": 274,
  "msisdn": "+252662346030",
  "metadata": {
  },
  "created_at": "2021-02-17T23:10:24.255Z",
  "updated_at": "2021-02-17T23:10:24.255Z",
  "account_id": 585
}

Update a Contact

Request

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

Endpoint

PATCH /api/contacts/:id

PATCH /api/contacts/275

Parameters

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

None known.

Response

Location: /api/contacts/275
204 No Content

Phone Calls

Create a Phone Call

Request

curl "https://scfm.somleng.org/api/callout_participations/257/phone_calls" -d '{
  "msisdn": "252662346054",
  "remote_request_params": {
    "to": "to",
    "from": "from",
    "method": "method",
    "fallback_url": "fallback_url",
    "fallback_method": "fallback_method",
    "status_callback": "status_callback",
    "status_callback_event": "status_callback_event",
    "status_callback_method": "status_callback_method",
    "send_digits": "send_digits",
    "timeout": "timeout",
    "record": "record",
    "recording_channels": "recording_channels",
    "recording_status_callback": "recording_status_callback",
    "recording_status_callback_method": "recording_status_callback_method",
    "sip_auth_username": "sip_auth_username",
    "sip_auth_password": "sip_auth_password",
    "machine_detection": "machine_detection",
    "machine_detection_timeout": "machine_detection_timeout",
    "recording_status_callback_event": "recording_status_callback_event",
    "trim": "trim",
    "caller_id": "caller_id",
    "machine_detection_speech_threshold": "machine_detection_speech_threshold",
    "machine_detection_speech_end_threshold": "machine_detection_speech_end_threshold",
    "machine_detection_silence_timeout": "machine_detection_silence_timeout",
    "async_amd": "async_amd",
    "async_amd_status_callback": "async_amd_status_callback",
    "async_amd_status_callback_method": "async_amd_status_callback_method",
    "byoc": "byoc",
    "call_reason": "call_reason",
    "recording_track": "recording_track",
    "url": "url",
    "twiml": "twiml",
    "application_sid": "application_sid"
  },
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "metadata": {
    "foo": "bar"
  }
}' -X POST \
    -H "Authorization: Bearer osA-VaFSiYYmOnw-lg62ygIZwFBWQuuOp6XLFyoxTec"

Endpoint

POST /api/callout_participations/:callout_participation_id/phone_calls

POST /api/callout_participations/257/phone_calls

Parameters

{
  "msisdn": "252662346054",
  "remote_request_params": {
    "to": "to",
    "from": "from",
    "method": "method",
    "fallback_url": "fallback_url",
    "fallback_method": "fallback_method",
    "status_callback": "status_callback",
    "status_callback_event": "status_callback_event",
    "status_callback_method": "status_callback_method",
    "send_digits": "send_digits",
    "timeout": "timeout",
    "record": "record",
    "recording_channels": "recording_channels",
    "recording_status_callback": "recording_status_callback",
    "recording_status_callback_method": "recording_status_callback_method",
    "sip_auth_username": "sip_auth_username",
    "sip_auth_password": "sip_auth_password",
    "machine_detection": "machine_detection",
    "machine_detection_timeout": "machine_detection_timeout",
    "recording_status_callback_event": "recording_status_callback_event",
    "trim": "trim",
    "caller_id": "caller_id",
    "machine_detection_speech_threshold": "machine_detection_speech_threshold",
    "machine_detection_speech_end_threshold": "machine_detection_speech_end_threshold",
    "machine_detection_silence_timeout": "machine_detection_silence_timeout",
    "async_amd": "async_amd",
    "async_amd_status_callback": "async_amd_status_callback",
    "async_amd_status_callback_method": "async_amd_status_callback_method",
    "byoc": "byoc",
    "call_reason": "call_reason",
    "recording_track": "recording_track",
    "url": "url",
    "twiml": "twiml",
    "application_sid": "application_sid"
  },
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "metadata": {
    "foo": "bar"
  }
}
Name Description
callout_participation_id required The id of the callout participation
remote_request_params required The request parameters to send to Somleng or Twilio

Response

Location: /api/phone_calls/218
201 Created
{
  "id": 218,
  "callout_participation_id": 257,
  "contact_id": 297,
  "create_batch_operation_id": null,
  "queue_batch_operation_id": null,
  "queue_remote_fetch_batch_operation_id": null,
  "status": "created",
  "msisdn": "+252662346054",
  "remote_call_id": null,
  "remote_status": null,
  "remote_direction": null,
  "remote_error_message": null,
  "metadata": {
    "foo": "bar"
  },
  "remote_response": {
  },
  "remote_request_params": {
    "to": "to",
    "from": "from",
    "method": "method",
    "fallback_url": "fallback_url",
    "fallback_method": "fallback_method",
    "status_callback": "status_callback",
    "status_callback_event": "status_callback_event",
    "status_callback_method": "status_callback_method",
    "send_digits": "send_digits",
    "timeout": "timeout",
    "record": "record",
    "recording_channels": "recording_channels",
    "recording_status_callback": "recording_status_callback",
    "recording_status_callback_method": "recording_status_callback_method",
    "sip_auth_username": "sip_auth_username",
    "sip_auth_password": "sip_auth_password",
    "machine_detection": "machine_detection",
    "machine_detection_timeout": "machine_detection_timeout",
    "recording_status_callback_event": "recording_status_callback_event",
    "trim": "trim",
    "caller_id": "caller_id",
    "machine_detection_speech_threshold": "machine_detection_speech_threshold",
    "machine_detection_speech_end_threshold": "machine_detection_speech_end_threshold",
    "machine_detection_silence_timeout": "machine_detection_silence_timeout",
    "async_amd": "async_amd",
    "async_amd_status_callback": "async_amd_status_callback",
    "async_amd_status_callback_method": "async_amd_status_callback_method",
    "byoc": "byoc",
    "call_reason": "call_reason",
    "recording_track": "recording_track",
    "url": "url",
    "twiml": "twiml",
    "application_sid": "application_sid"
  },
  "remote_queue_response": {
  },
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "remotely_queued_at": null,
  "created_at": "2021-02-17T23:10:24.993Z",
  "updated_at": "2021-02-17T23:10:24.993Z",
  "duration": 0,
  "lock_version": 0,
  "account_id": 601
}

Create a Phone Call Event

Queues a phone call, or a remote phone call status update on Somleng or Twilio

Request

curl "https://scfm.somleng.org/api/phone_calls/223/phone_call_events" -d '{
  "event": "queue"
}' -X POST \
    -H "Authorization: Bearer 38R82oOrjbeh-3ZsuE71sUZnh8nZ-HejxRynlwDNXBw"

Endpoint

POST /api/phone_calls/:phone_call_id/phone_call_events

POST /api/phone_calls/223/phone_call_events

Parameters

{
  "event": "queue"
}
Name Description
event required Either queue or queue_remote_fetch

Response

Location: /api/phone_calls/223
201 Created
{
  "account_id": 607,
  "id": 223,
  "callout_participation_id": 263,
  "contact_id": 303,
  "create_batch_operation_id": null,
  "queue_batch_operation_id": null,
  "queue_remote_fetch_batch_operation_id": null,
  "status": "queued",
  "msisdn": "+252662346062",
  "remote_call_id": null,
  "remote_status": null,
  "remote_direction": null,
  "remote_error_message": null,
  "metadata": {
  },
  "remote_response": {
  },
  "remote_request_params": {
    "to": "to",
    "url": "url",
    "byoc": "byoc",
    "from": "from",
    "trim": "trim",
    "twiml": "twiml",
    "method": "method",
    "record": "record",
    "timeout": "timeout",
    "async_amd": "async_amd",
    "caller_id": "caller_id",
    "call_reason": "call_reason",
    "send_digits": "send_digits",
    "fallback_url": "fallback_url",
    "application_sid": "application_sid",
    "fallback_method": "fallback_method",
    "recording_track": "recording_track",
    "status_callback": "status_callback",
    "machine_detection": "machine_detection",
    "sip_auth_password": "sip_auth_password",
    "sip_auth_username": "sip_auth_username",
    "recording_channels": "recording_channels",
    "status_callback_event": "status_callback_event",
    "status_callback_method": "status_callback_method",
    "async_amd_status_callback": "async_amd_status_callback",
    "machine_detection_timeout": "machine_detection_timeout",
    "recording_status_callback": "recording_status_callback",
    "recording_status_callback_event": "recording_status_callback_event",
    "async_amd_status_callback_method": "async_amd_status_callback_method",
    "recording_status_callback_method": "recording_status_callback_method",
    "machine_detection_silence_timeout": "machine_detection_silence_timeout",
    "machine_detection_speech_threshold": "machine_detection_speech_threshold",
    "machine_detection_speech_end_threshold": "machine_detection_speech_end_threshold"
  },
  "remote_queue_response": {
  },
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "remotely_queued_at": null,
  "created_at": "2021-02-17T23:10:25.241Z",
  "updated_at": "2021-02-17T23:10:25.262Z",
  "duration": 0,
  "lock_version": 1
}

Delete a Phone Call

Request

curl "https://scfm.somleng.org/api/phone_calls/221" -d '' -X DELETE \
    -H "Authorization: Bearer OkXw16w5Wz_AeN01S7vK4tGQRdD9mTKS3I2qZoPh6Ow"

Endpoint

DELETE /api/phone_calls/:id

DELETE /api/phone_calls/221

Parameters

None known.

Response

Location: /api/phone_calls
204 No Content

List all Phone Calls

Request

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

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": 203,
    "callout_participation_id": 242,
    "contact_id": 282,
    "create_batch_operation_id": null,
    "queue_batch_operation_id": null,
    "queue_remote_fetch_batch_operation_id": null,
    "status": "created",
    "msisdn": "+252662346038",
    "remote_call_id": null,
    "remote_status": null,
    "remote_direction": null,
    "remote_error_message": null,
    "metadata": {
      "foo": "bar"
    },
    "remote_response": {
    },
    "remote_request_params": {
      "to": "to",
      "url": "url",
      "byoc": "byoc",
      "from": "from",
      "trim": "trim",
      "twiml": "twiml",
      "method": "method",
      "record": "record",
      "timeout": "timeout",
      "async_amd": "async_amd",
      "caller_id": "caller_id",
      "call_reason": "call_reason",
      "send_digits": "send_digits",
      "fallback_url": "fallback_url",
      "application_sid": "application_sid",
      "fallback_method": "fallback_method",
      "recording_track": "recording_track",
      "status_callback": "status_callback",
      "machine_detection": "machine_detection",
      "sip_auth_password": "sip_auth_password",
      "sip_auth_username": "sip_auth_username",
      "recording_channels": "recording_channels",
      "status_callback_event": "status_callback_event",
      "status_callback_method": "status_callback_method",
      "async_amd_status_callback": "async_amd_status_callback",
      "machine_detection_timeout": "machine_detection_timeout",
      "recording_status_callback": "recording_status_callback",
      "recording_status_callback_event": "recording_status_callback_event",
      "async_amd_status_callback_method": "async_amd_status_callback_method",
      "recording_status_callback_method": "recording_status_callback_method",
      "machine_detection_silence_timeout": "machine_detection_silence_timeout",
      "machine_detection_speech_threshold": "machine_detection_speech_threshold",
      "machine_detection_speech_end_threshold": "machine_detection_speech_end_threshold"
    },
    "remote_queue_response": {
    },
    "call_flow_logic": "CallFlowLogic::HelloWorld",
    "remotely_queued_at": null,
    "created_at": "2021-02-17T23:10:24.511Z",
    "updated_at": "2021-02-17T23:10:24.511Z",
    "duration": 0,
    "lock_version": 0,
    "account_id": 592
  }
]

Retrieve a Phone Call

Request

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

Endpoint

GET /api/phone_calls/:id

GET /api/phone_calls/219

Parameters

None known.

Response

Location: /api/phone_calls/219
200 OK
{
  "id": 219,
  "callout_participation_id": 259,
  "contact_id": 299,
  "create_batch_operation_id": null,
  "queue_batch_operation_id": null,
  "queue_remote_fetch_batch_operation_id": null,
  "status": "created",
  "msisdn": "+252662346057",
  "remote_call_id": null,
  "remote_status": null,
  "remote_direction": null,
  "remote_error_message": null,
  "metadata": {
  },
  "remote_response": {
  },
  "remote_request_params": {
    "to": "to",
    "url": "url",
    "byoc": "byoc",
    "from": "from",
    "trim": "trim",
    "twiml": "twiml",
    "method": "method",
    "record": "record",
    "timeout": "timeout",
    "async_amd": "async_amd",
    "caller_id": "caller_id",
    "call_reason": "call_reason",
    "send_digits": "send_digits",
    "fallback_url": "fallback_url",
    "application_sid": "application_sid",
    "fallback_method": "fallback_method",
    "recording_track": "recording_track",
    "status_callback": "status_callback",
    "machine_detection": "machine_detection",
    "sip_auth_password": "sip_auth_password",
    "sip_auth_username": "sip_auth_username",
    "recording_channels": "recording_channels",
    "status_callback_event": "status_callback_event",
    "status_callback_method": "status_callback_method",
    "async_amd_status_callback": "async_amd_status_callback",
    "machine_detection_timeout": "machine_detection_timeout",
    "recording_status_callback": "recording_status_callback",
    "recording_status_callback_event": "recording_status_callback_event",
    "async_amd_status_callback_method": "async_amd_status_callback_method",
    "recording_status_callback_method": "recording_status_callback_method",
    "machine_detection_silence_timeout": "machine_detection_silence_timeout",
    "machine_detection_speech_threshold": "machine_detection_speech_threshold",
    "machine_detection_speech_end_threshold": "machine_detection_speech_end_threshold"
  },
  "remote_queue_response": {
  },
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "remotely_queued_at": null,
  "created_at": "2021-02-17T23:10:25.055Z",
  "updated_at": "2021-02-17T23:10:25.055Z",
  "duration": 0,
  "lock_version": 0,
  "account_id": 603
}

Update a Phone Call

Request

curl "https://scfm.somleng.org/api/phone_calls/220" -d '{
  "msisdn": "252662346059",
  "remote_request_params": {
    "to": "to",
    "from": "from",
    "method": "method",
    "fallback_url": "fallback_url",
    "fallback_method": "fallback_method",
    "status_callback": "status_callback",
    "status_callback_event": "status_callback_event",
    "status_callback_method": "status_callback_method",
    "send_digits": "send_digits",
    "timeout": "timeout",
    "record": "record",
    "recording_channels": "recording_channels",
    "recording_status_callback": "recording_status_callback",
    "recording_status_callback_method": "recording_status_callback_method",
    "sip_auth_username": "sip_auth_username",
    "sip_auth_password": "sip_auth_password",
    "machine_detection": "machine_detection",
    "machine_detection_timeout": "machine_detection_timeout",
    "recording_status_callback_event": "recording_status_callback_event",
    "trim": "trim",
    "caller_id": "caller_id",
    "machine_detection_speech_threshold": "machine_detection_speech_threshold",
    "machine_detection_speech_end_threshold": "machine_detection_speech_end_threshold",
    "machine_detection_silence_timeout": "machine_detection_silence_timeout",
    "async_amd": "async_amd",
    "async_amd_status_callback": "async_amd_status_callback",
    "async_amd_status_callback_method": "async_amd_status_callback_method",
    "byoc": "byoc",
    "call_reason": "call_reason",
    "recording_track": "recording_track",
    "url": "url",
    "twiml": "twiml",
    "application_sid": "application_sid"
  },
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "metadata": {
    "bar": "foo"
  },
  "metadata_merge_mode": "replace"
}' -X PATCH \
    -H "Authorization: Bearer f6Ny779V4RjloU8h8F4KwbH4_22mp4cStgfwD4EJdBs"

Endpoint

PATCH /api/phone_calls/:id

PATCH /api/phone_calls/220

Parameters

{
  "msisdn": "252662346059",
  "remote_request_params": {
    "to": "to",
    "from": "from",
    "method": "method",
    "fallback_url": "fallback_url",
    "fallback_method": "fallback_method",
    "status_callback": "status_callback",
    "status_callback_event": "status_callback_event",
    "status_callback_method": "status_callback_method",
    "send_digits": "send_digits",
    "timeout": "timeout",
    "record": "record",
    "recording_channels": "recording_channels",
    "recording_status_callback": "recording_status_callback",
    "recording_status_callback_method": "recording_status_callback_method",
    "sip_auth_username": "sip_auth_username",
    "sip_auth_password": "sip_auth_password",
    "machine_detection": "machine_detection",
    "machine_detection_timeout": "machine_detection_timeout",
    "recording_status_callback_event": "recording_status_callback_event",
    "trim": "trim",
    "caller_id": "caller_id",
    "machine_detection_speech_threshold": "machine_detection_speech_threshold",
    "machine_detection_speech_end_threshold": "machine_detection_speech_end_threshold",
    "machine_detection_silence_timeout": "machine_detection_silence_timeout",
    "async_amd": "async_amd",
    "async_amd_status_callback": "async_amd_status_callback",
    "async_amd_status_callback_method": "async_amd_status_callback_method",
    "byoc": "byoc",
    "call_reason": "call_reason",
    "recording_track": "recording_track",
    "url": "url",
    "twiml": "twiml",
    "application_sid": "application_sid"
  },
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "metadata": {
    "bar": "foo"
  },
  "metadata_merge_mode": "replace"
}

None known.

Response

Location: /api/phone_calls/220
204 No Content

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

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": 37,
    "phone_call_id": 226,
    "details": {
      "To": "345",
      "From": "252662346066",
      "CallSid": "326b4a1c-ae2b-474a-9a76-d7dd2573e93b",
      "Direction": "inbound",
      "AccountSid": "b0c16447-1f5a-44a6-be93-2b8230c55a3d",
      "ApiVersion": "2010-04-01",
      "CallStatus": "completed"
    },
    "metadata": {
      "foo": "bar"
    },
    "remote_call_id": "326b4a1c-ae2b-474a-9a76-d7dd2573e93b",
    "remote_direction": "inbound",
    "call_flow_logic": "CallFlowLogic::HelloWorld",
    "created_at": "2021-02-17T23:10:25.467Z",
    "updated_at": "2021-02-17T23:10:25.467Z",
    "call_duration": 0
  }
]

Retrieve a Remote Phone Call Event

Request

curl -g "https://scfm.somleng.org/api/remote_phone_call_events/48" -X GET \
    -H "Authorization: Bearer knOWZIboEPTmmjmX2VwjRLgALNLx-3Vl87FizKcBX6g"

Endpoint

GET /api/remote_phone_call_events/:id

GET /api/remote_phone_call_events/48

Parameters

None known.

Response

Location: /api/remote_phone_call_events/48
200 OK
{
  "id": 48,
  "phone_call_id": 237,
  "details": {
    "To": "345",
    "From": "252662346088",
    "CallSid": "d7a68f76-e4fd-40f0-be41-c2429236860f",
    "Direction": "inbound",
    "AccountSid": "1c14e4b1-937d-4ff7-9821-8ad067ec5824",
    "ApiVersion": "2010-04-01",
    "CallStatus": "completed"
  },
  "metadata": {
  },
  "remote_call_id": "d7a68f76-e4fd-40f0-be41-c2429236860f",
  "remote_direction": "inbound",
  "call_flow_logic": "CallFlowLogic::HelloWorld",
  "created_at": "2021-02-17T23:10:25.848Z",
  "updated_at": "2021-02-17T23:10:25.848Z",
  "call_duration": 0
}

Update a Remote Phone Call Event

Request

curl "https://scfm.somleng.org/api/remote_phone_call_events/49" -d '{
  "metadata": {
    "foo": "bar"
  },
  "metadata_merge_mode": "replace"
}' -X PATCH \
    -H "Authorization: Bearer 5GiedlYM6EOWdGVWE5rY_86aCLbFn6abXsJ9uf4nHro"

Endpoint

PATCH /api/remote_phone_call_events/:id

PATCH /api/remote_phone_call_events/49

Parameters

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

None known.

Response

Location: /api/remote_phone_call_events/49
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-02-16&sort=-id%2Ccreated_at" -X GET \
    -H "Authorization: Bearer UXY28ae5pjGiw7qdupEVDpwoGLZAx-JoIbZRNeqEaHw"

Endpoint

GET /api/contacts

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

Parameters

q: {"metadata"=>{"gender"=>"f"}, "created_at_after"=>"2021-02-16"}
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": 347,
    "msisdn": "+252662346117",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-02-17T23:10:26.163Z",
    "updated_at": "2021-02-17T23:10:26.163Z",
    "account_id": 623
  },
  {
    "id": 346,
    "msisdn": "+252662346116",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-02-17T23:10:26.161Z",
    "updated_at": "2021-02-17T23:10:26.161Z",
    "account_id": 623
  },
  {
    "id": 345,
    "msisdn": "+252662346115",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-02-17T23:10:26.158Z",
    "updated_at": "2021-02-17T23:10:26.158Z",
    "account_id": 623
  },
  {
    "id": 344,
    "msisdn": "+252662346114",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-02-17T23:10:26.155Z",
    "updated_at": "2021-02-17T23:10:26.155Z",
    "account_id": 623
  },
  {
    "id": 343,
    "msisdn": "+252662346113",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-02-17T23:10:26.153Z",
    "updated_at": "2021-02-17T23:10:26.153Z",
    "account_id": 623
  },
  {
    "id": 342,
    "msisdn": "+252662346112",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-02-17T23:10:26.150Z",
    "updated_at": "2021-02-17T23:10:26.150Z",
    "account_id": 623
  },
  {
    "id": 341,
    "msisdn": "+252662346111",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-02-17T23:10:26.147Z",
    "updated_at": "2021-02-17T23:10:26.147Z",
    "account_id": 623
  },
  {
    "id": 340,
    "msisdn": "+252662346110",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-02-17T23:10:26.145Z",
    "updated_at": "2021-02-17T23:10:26.145Z",
    "account_id": 623
  },
  {
    "id": 339,
    "msisdn": "+252662346109",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-02-17T23:10:26.142Z",
    "updated_at": "2021-02-17T23:10:26.142Z",
    "account_id": 623
  },
  {
    "id": 338,
    "msisdn": "+252662346108",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-02-17T23:10:26.139Z",
    "updated_at": "2021-02-17T23:10:26.139Z",
    "account_id": 623
  },
  {
    "id": 337,
    "msisdn": "+252662346107",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-02-17T23:10:26.137Z",
    "updated_at": "2021-02-17T23:10:26.137Z",
    "account_id": 623
  },
  {
    "id": 336,
    "msisdn": "+252662346106",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-02-17T23:10:26.134Z",
    "updated_at": "2021-02-17T23:10:26.134Z",
    "account_id": 623
  },
  {
    "id": 335,
    "msisdn": "+252662346105",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-02-17T23:10:26.131Z",
    "updated_at": "2021-02-17T23:10:26.131Z",
    "account_id": 623
  },
  {
    "id": 334,
    "msisdn": "+252662346104",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-02-17T23:10:26.129Z",
    "updated_at": "2021-02-17T23:10:26.129Z",
    "account_id": 623
  },
  {
    "id": 333,
    "msisdn": "+252662346103",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-02-17T23:10:26.126Z",
    "updated_at": "2021-02-17T23:10:26.126Z",
    "account_id": 623
  },
  {
    "id": 332,
    "msisdn": "+252662346102",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-02-17T23:10:26.123Z",
    "updated_at": "2021-02-17T23:10:26.123Z",
    "account_id": 623
  },
  {
    "id": 331,
    "msisdn": "+252662346101",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-02-17T23:10:26.120Z",
    "updated_at": "2021-02-17T23:10:26.120Z",
    "account_id": 623
  },
  {
    "id": 330,
    "msisdn": "+252662346100",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-02-17T23:10:26.118Z",
    "updated_at": "2021-02-17T23:10:26.118Z",
    "account_id": 623
  },
  {
    "id": 329,
    "msisdn": "+252662346099",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-02-17T23:10:26.114Z",
    "updated_at": "2021-02-17T23:10:26.114Z",
    "account_id": 623
  },
  {
    "id": 328,
    "msisdn": "+252662346098",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-02-17T23:10:26.111Z",
    "updated_at": "2021-02-17T23:10:26.111Z",
    "account_id": 623
  },
  {
    "id": 327,
    "msisdn": "+252662346097",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-02-17T23:10:26.109Z",
    "updated_at": "2021-02-17T23:10:26.109Z",
    "account_id": 623
  },
  {
    "id": 326,
    "msisdn": "+252662346096",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-02-17T23:10:26.105Z",
    "updated_at": "2021-02-17T23:10:26.105Z",
    "account_id": 623
  },
  {
    "id": 325,
    "msisdn": "+252662346095",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-02-17T23:10:26.102Z",
    "updated_at": "2021-02-17T23:10:26.102Z",
    "account_id": 623
  },
  {
    "id": 324,
    "msisdn": "+252662346094",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-02-17T23:10:26.099Z",
    "updated_at": "2021-02-17T23:10:26.099Z",
    "account_id": 623
  },
  {
    "id": 323,
    "msisdn": "+252662346093",
    "metadata": {
      "gender": "f"
    },
    "created_at": "2021-02-17T23:10:26.097Z",
    "updated_at": "2021-02-17T23:10:26.097Z",
    "account_id": 623
  }
]

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/350" -d '{
  "metadata": {
    "name": "Kate"
  },
  "metadata_merge_mode": "replace"
}' -X PATCH \
    -H "Authorization: Bearer MxwJ2uodtatY1LZm_QgIVO9Ec-yrAznQPv6EnU20tR0"

Endpoint

PATCH /api/contacts/:id

PATCH /api/contacts/350

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/350
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 zv9urozxCTo_WbmGn7Qi6oRKnUhjzeQl16KlLJOnc7c"

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": 630,
  "metadata": {
    "foo": "bar"
  },
  "email": "user32@example.com",
  "created_at": "2021-02-17T23:10:26.339Z",
  "updated_at": "2021-02-17T23:10:26.339Z",
  "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 -StZoP7rUWKH9tP0zqf1NAEcLQDQ51vDFVdXAvwL1Ew"

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": 636,
  "id": 30,
  "metadata": {
  },
  "email": "user37@example.com",
  "created_at": "2021-02-17T23:10:26.527Z",
  "updated_at": "2021-02-17T23:10:26.545Z",
  "locale": "en"
}

Delete a User

Request

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

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 18xnDnb5Z8K08dZytl0ckcuyMjOzStjLwRsxXwAjN4g"

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": 626,
    "metadata": {
      "foo": "bar"
    },
    "email": "user27@example.com",
    "created_at": "2021-02-17T23:10:26.238Z",
    "updated_at": "2021-02-17T23:10:26.238Z",
    "locale": "en"
  }
]

Retrieve a User

Request

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

Endpoint

GET /api/users/:id

GET /api/users/27

Parameters

None known.

Response

Location: /api/users/27
200 OK
{
  "id": 27,
  "account_id": 633,
  "metadata": {
  },
  "email": "user34@example.com",
  "created_at": "2021-02-17T23:10:26.387Z",
  "updated_at": "2021-02-17T23:10:26.387Z",
  "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 IZHWgY7gk3PYR4moMsxY6VLYlcGbbPYlPRJjqmTnhcY"

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