NAV
cURL

Introduction

Somleng Twilreapi is an Open Source implementation of Twilio's REST API. Currently it only supports a tiny subset of Twilio's REST API. More features may be added in the future.

Make an HTTP Request to Somleng Twilreapi

There are a lot of ways you can make an HTTP request to Somleng Twilreapi. You can make a raw HTTP request in your code (for example, using a module like got in NodeJS) or by using a tool like Postman. You might find it easier to use the Twilio Helper Library or SDK for your preferred programming language. These libraries can be usually be used with Somleng Twilreapi by overriding the URL parameter from api.twilio.com to twilreapi.somleng.org or your own host.

OpenAPI Specification

You can download the OpenAPI specification and import it into your favourite HTTP Client such as Postman.

Credentials

All requests to Somleng Twilreapi need to be authenticated. Twilreapi using HTTP basic auth, which use the following username/password schemes:

Account SID and Auth Token

The account SID and auth token are the master keys to your account.

Username Password
AccountSid AuthToken

Phone Calls

Create a call

Request

curl "https://twilreapi.somleng.org/2010-04-01/Accounts/cf96be09-526d-46f4-81ad-e5fce100e08e/Calls" -d 'To=%2B299221234&From=1234&Url=https%3A%2F%2Fdemo.twilio.com%2Fdocs%2Fvoice.xml' -X POST \
    -H "Content-Type: application/x-www-form-urlencoded" \
    -u cf96be09-526d-46f4-81ad-e5fce100e08e:nx_dGJ3toBeO3GLEIwKsKXWa-YgOpZi8W-FrhklDQN8

Endpoint

POST /2010-04-01/Accounts/:account_sid/Calls

POST /2010-04-01/Accounts/cf96be09-526d-46f4-81ad-e5fce100e08e/Calls

Parameters

To=%2B299221234&From=1234&Url=https%3A%2F%2Fdemo.twilio.com%2Fdocs%2Fvoice.xml
Name Description
To required The phone number to call.
From required The phone number to use as the caller id
Url required The absolute URL that returns the TwiML instructions for the call. We will call this URL using the method when the call connects.
Method The HTTP method we should use when calling the url parameter's value. Can be: GET or POST and the default is POST.
StatusCallback The URL we should call using the status_callback_method to send status information to your application. URLs must contain a valid hostname (underscores are not permitted).
StatusCallbackMethod The HTTP method we should use when calling the status_callback URL. Can be: GET or POST and the default is POST.

Response


201 Created
{
  "api_version": "2010-04-01",
  "sid": "baac9c49-e863-449a-a68b-24359bcda1d5",
  "account_sid": "cf96be09-526d-46f4-81ad-e5fce100e08e",
  "date_created": "Wed, 14 Apr 2021 07:33:44 -0000",
  "date_updated": "Wed, 14 Apr 2021 07:33:44 -0000",
  "annotation": null,
  "answered_by": null,
  "caller_name": null,
  "direction": "outbound-api",
  "duration": null,
  "end_time": null,
  "forwarded_from": null,
  "from": "1234",
  "from_formatted": "1234",
  "group_sid": null,
  "parent_call_sid": null,
  "phone_number_sid": null,
  "price": null,
  "price_unit": null,
  "start_time": null,
  "status": "queued",
  "subresource_uris": {
  },
  "to": "+299221234",
  "to_formatted": "+299 22 1234",
  "uri": "https://twilreapi.somleng.org/2010-04-01/Accounts/cf96be09-526d-46f4-81ad-e5fce100e08e/Calls/baac9c49-e863-449a-a68b-24359bcda1d5"
}

Fetch a call

Request

curl -g "https://twilreapi.somleng.org/2010-04-01/Accounts/37508df0-fd5a-448c-9e5f-989b616629ee/Calls/4789655a-375b-44ad-8338-cd4b40acf619" -X GET \
    -H "Content-Type: application/x-www-form-urlencoded" \
    -u 37508df0-fd5a-448c-9e5f-989b616629ee:UqQbsaMyQMIc0Xp2qG6s4Kt3RHBISAcHxtMxndnTccU

Endpoint

GET /2010-04-01/Accounts/:account_sid/Calls/:call_sid

GET /2010-04-01/Accounts/37508df0-fd5a-448c-9e5f-989b616629ee/Calls/4789655a-375b-44ad-8338-cd4b40acf619

Parameters

None known.

Response


200 OK
{
  "api_version": "2010-04-01",
  "sid": "4789655a-375b-44ad-8338-cd4b40acf619",
  "account_sid": "37508df0-fd5a-448c-9e5f-989b616629ee",
  "date_created": "Wed, 14 Apr 2021 07:33:44 -0000",
  "date_updated": "Wed, 14 Apr 2021 07:33:44 -0000",
  "annotation": null,
  "answered_by": null,
  "caller_name": null,
  "direction": "outbound-api",
  "duration": null,
  "end_time": null,
  "forwarded_from": null,
  "from": "2442",
  "from_formatted": "2442",
  "group_sid": null,
  "parent_call_sid": null,
  "phone_number_sid": null,
  "price": null,
  "price_unit": null,
  "start_time": null,
  "status": "queued",
  "subresource_uris": {
  },
  "to": "+85512334667",
  "to_formatted": "+855 12 334 667",
  "uri": "https://twilreapi.somleng.org/2010-04-01/Accounts/37508df0-fd5a-448c-9e5f-989b616629ee/Calls/4789655a-375b-44ad-8338-cd4b40acf619"
}