Manual

Available Methods

2. Available Methods

GET /cdrs

Returns collection of Call Details Records.

Returned data:

  • id - CDR id;
  • billsec- billed call duration;
  • calldate - call date;
  • charge - call cost;
  • clid - client name (if available) with number;
  • destination - destination type: in or out;
  • disposition - call status: INITIAL, CONNECTED, RINGING or ON_HOLD;
  • dst - destination number or extension;
  • dst_id - callee id if available (internal calls);
  • dst_name" - destination name if available;
  • duration - total call duration;
  • live_id - LIVE call id (useful for termination);
  • rate - call rate;
  • server_id - internal server id;
  • sip_endpoint_id - internal SIP endpoint id;
  • src - caller number;
  • src_id - caller id if available;
  • t_cause - call termination reason;
  • type - call type: O (outbound), I(inbound), M(missed) or U(not accessible for customers)

Example request:

curl -u user_id:user_token -H "Content-Type: application/json" https://l7api.com/v1/gotrunk/cdrs

Example response:

{
  "data": [
    {
      "billsec": 42,
      "calldate": "2016-07-25 10:25:39",
      "charge": 0,
      "clid": "anonymous <anonymous>",
      "destination": "in",
      "disposition": "CONNECTED",
      "dst": "44123456789",
      "dst_id": "123456",
      "dst_name": "John Smith",
      "duration": 65,
      "id": 525076362,
      "live_id": 711987072,
      "rate": 0,
      "server_id": 1142,
      "sip_endpoint_id": 0,
      "src": "anonymous",
      "src_id": "0",
      "t_cause": "Normal Clearing",
      "type": "I"
    }
  ],
  "total": 1
}

GET /voicemessages

Returns collection of Voicemessages.

Returned data:

  • id - Voicemessage id;
  • caller - caller number or extension;
  • callerid - caller id (name) if available;
  • dialled - dialled number or extension;
  • origtime - creation date;
  • duration - voicemessage duration;
  • is_new - indicates if the message has been read.

Example request:

curl -u user_id:user_token -H "Content-Type: application/json" https://l7api.com/v1/gotrunk/voicemessages

Example response:

{
  "data": [
    {
      "id": 12,
      "caller": "1234567890",
      "callerid": "John Smith",
      "dialled": "+44123456789",
      "origtime": "2016-10-18 12:25:04",
      "duration": 99,
      "is_new": true
     }
  ],
  "total": 1
}

GET /voicemessages/{id}

Returns single Voicemessage resource fo given id.

Returned data:

  • id - Voicemessage id;
  • caller - caller number or extension;
  • callerid - caller id (name) if available;
  • dialled - dialled number or extension;
  • origtime - creation date;
  • duration - voicemessage duration;
  • is_new - indicates if the message has been read;
  • base64 - base64 encoded file;
  • md5 - md5 file hash;
  • mime_type - mp4 file mime type.

Returned links:

  • file - url for downloading Voicemessage` mp3 file;

Example request:

curl -u user_id:user_token -H "Content-Type: application/json" https://l7api.com/v1/gotrunk/voicemessages/12

Example response:

{
  "data": [
    {
      "id": 12,
      "caller": "1234567890",
      "callerid": "John Smith",
      "dialled": "+44123456789",
      "origtime": "2016-10-18 12:25:04",
      "duration": 99,
      "is_new": true,
      "base64": "{BASE64}",
      "md5": "{MD5}",
      "mime_type": "audio/mpeg3"
    },
    "links": {
        "file": "/v1/gotrunk/voicemessages/12.mp3"
    }
}

GET /monitors

Returns collection of recorded calls.

Returned data:

  • id - recorded call id;
  • user_id - user ID if available (VoIPstudio);
  • sip_endpoint_id - sip endoint ID if available (GoTrunk);
  • timestamp - call date and time;
  • caller - caller number or extension;
  • called - dialled number or extension;
  • duration - call duration;
  • size - recorded call file size in bytes.

Example request:

curl -u user_id:user_token -H "Content-Type: application/json" https://l7api.com/v1/gotrunk/monitors

Example response:

{
  "data": [
    {
      "id": 12,
      "user_id": 0,
      "sip_endpoint_id": 101,
      "timestamp": "2016-10-18 12:25:04",
      "caller": "1234567890",
      "called": "+44123456789",
      "duration": 99,
      "size": 21400,
     }
  ],
  "total": 1
}

GET /monitors/{id}

Returns single recorded call resource for given id.

Returned data:

  • id - recorded call id;
  • user_id - user ID if available (VoIPstudio);
  • sip_endpoint_id - sip endoint ID if available (GoTrunk);
  • timestamp - call date and time;
  • caller - caller number or extension;
  • called - dialled number or extension;
  • duration - call duration;
  • size - recorded call file size in bytes;
  • base64 - base64 encoded file;
  • md5 - md5 file hash;
  • mime_type - file mime type.

Returned links:

  • file - url for downloading recorded call as mp3 file;

Example request:

curl -u user_id:user_token -H "Content-Type: application/json" https://l7api.com/v1/gotrunk/monitors/12

Example response:

{
  "data": [
    {
      "id": 12,
      "user_id": 0,
      "sip_endpoint_id": 101,
      "timestamp": "2016-10-18 12:25:04",
      "caller": "1234567890",
      "called": "+44123456789",
      "duration": 99,
      "size": 21400,
    },
    "links": {
        "file": "/v1/gotrunk/monitors/12.mp3"
    }
}

GET /sms

Returns collection of sent SMS.

Returned data:

  • id - internal message id;
  • from - your registered mobile number;
  • to - receiver number in e164 format;
  • message - sent message content;
  • created_at - SMS sending date.

Example request:

curl -u user_id:user_token -H "Content-Type: application/json" https://l7api.com/v1/gotrunk/sms

Example response:

{
  "data": [
    {
      "id": 1,
      "from": "44123456789",
      "to": "44987654321",
      "message": "Sample text"
      "created_at": "2017-01-18 12:25:04"
    }
  ],
  "total": 1
}

POST/sms

Send SMS to to number with message content.

Required fields:

  • to - receiver number in e164 format;
  • message - text message that will be sent to given number;

Example request:

curl -u user_id:user_token -X POST -H "Content-Type: application/json" -d '{"to":"44987654321","message":"Sample text"}' https://l7api.com/v1/gotrunk/sms

Example response:

{
  "data": [
    {
      "id": 1,
      "from": "44123456789",
      "to": "44987654321",
      "message": "Sample text"
      "created_at": "2017-01-18 12:25:04"
    },
    "links": {
    }
}

GET /contacts

Returns collection of contacts.

Returned data:

  • id - internal contactid;
  • global - is this global contact;
  • rel_user_id - related user ID;
  • id - internal contact id;
  • group_name - contact group name;
  • first_name - first name;
  • last_name - last name;
  • created_at - creation date;
  • user_id - ID of the user to whom contacts belongs;
  • mobile - mobile phone number;
  • tel - phone number;
  • email - e-mail address;
  • notes - some notes;
  • speed_dial_phone - speed dial phone number;
  • speed_dial_mobile - mobile speed dial phone number;

Example request:

curl -u user_id:user_token -H "Content-Type: application/json" https://l7api.com/v1/gotrunk/contacts

Example response:

{
  "data": [
    {
      "global":false,
      "rel_user_id":null,
      "id":82,
      "group_name":"Work",
      "first_name":"John",
      "last_name":"Smith",
      "created_at":"2017-04-26 13:02:01",
      "user_id":10002,
      "mobile":"4490098765432",
      "tel":"448012345678",
      "email":"john.smith@example.com",
      "notes":"Sample notes.",
      "speed_dial_phone":5432,
      "speed_dial_mobile":4444
    },
    {
      "global":false,
      "rel_user_id":null,
      "id":72,
      (...)
    },
    (...)
  ],
  "total": 7
}

GET /contacts{id}

Returns contact for given ID.

Returned data:

  • global - is this global contact;
  • rel_user_id - related user ID;
  • id - internal contact id;
  • group_name - contact group name;
  • first_name - first name;
  • last_name - last name;
  • created_at - creation date;
  • user_id - ID of the user to whom contacts belongs;
  • mobile - mobile phone number;
  • tel - phone number;
  • email - e-mail address;
  • notes - some notes;
  • speed_dial_phone - speed dial phone number;
  • speed_dial_mobile - mobile speed dial phone number;

Returned links:

  • none;

Example request:

curl -u user_id:user_token -H "Content-Type: application/json" https://l7api.com/v1/gotrunk/contacts/82

Example response:

{
  "data":
    {
      "global":false,
      "rel_user_id":null,
      "id":82,
      "group_name":"Work",
      "first_name":"John",
      "last_name":"Smith",
      "created_at":"2017-04-26 11:35:22",
      "user_id":10002,
      "mobile":"4490098765432",
      "tel":"448012345678",
      "email":"john.smith@example.com",
      "notes":"Sample notes.",
      "speed_dial_phone":5432,
      "speed_dial_mobile":4444
    },
  "links":
    {
    }
}

POST/contacts

Post a new contact.

Required fields:

  • group_name - contact's group name;
  • first_name - contact's first name;
  • last_name - contact's last name;
  • email - e-mail address;
  • tel - phone number;
  • speed_dial_phone - speed dial phone number;
  • mobile - mobile phone number;
  • speed_dial_mobile - speed dial mobile number;
  • notes - some notes;
  • global - is contact global (allowed for administrators);

Example request:

curl -u user_id:user_token -X POST -H "Content-Type: application/json" -d '{"group_name":"Work","first_name":"John","last_name":"Smith","email":"john.smith@exa...}' https://l7api.com/v1/gotrunk/contacts

Example response:

{
  "data":
    {
      "global":false,
      "rel_user_id":null,
      "id":82,
      "group_name":"Work",
      "first_name":"John",
      "last_name":"Smith",
      "created_at":"2017-04-26 11:35:22",
      "user_id":10002,
      "email":"john.smith@example.com",
      "mobile":"4490098765432",
      "tel":"448012345678",
      "notes":"Sample notes.",
      "speed_dial_phone":5432,
      "speed_dial_mobile":4444
    },
  "links":
    {
    }
}

POST/contacts.csv

Import contacts from a CSV file.

Required fields:

  • data - Base64 encoded CSV file;
  • preview - determines if data is processed for preview or should be saved to the DB;

Example request:

curl -u user_id:user_token -X POST -H "Content-Type: application/json" -d '{"data":"Rmlyc3QgTmFtZSxNaW...","preview":"true"}' https://l7api.com/v1/gotrunk/contacts.csv

Example response:

{
  "data":
    {
      [
        {
          "group_name":"Imported",
          "first_name":"Agnieszka",
          "last_name":"Black",
          "email":"aga_black@poczta.wp.pl",
          "tel":"",
          "mobile":"48600680109"},
        },
        {
          "group_name":
          (...)
        }
      ]
    }
  "links":
    {
    }
}

PATCH/contacts/{id}

Patch (edit) contact for given ID.

Allowed fields:

  • group_name - contact's group name;
  • first_name - contact's first name;
  • last_name - contact's last name;
  • email - e-mail address;
  • tel - phone number;
  • speed_dial_phone - speed dial phone number;
  • mobile - mobile phone number;
  • speed_dial_mobile - speed dial mobile number;
  • notes - some notes;
  • global - is contact global (allowed for administrators);

Example request:

curl -u user_id:user_token -X PATCH -H "Content-Type: application/json" -d '{"last_name":"Updated"}' https://l7api.com/v1/gotrunk/contacts/82

Example response:

{
  "data":
    {
      "global":false,
      "rel_user_id":null,
      "id":82,
      "group_name":"Work",
      "first_name":"John",
      "last_name":"Updated",
      "created_at":"2017-04-26 11:35:22",
      "user_id":10002,
      "email":"john.smith@example.com",
      "mobile":"4490098765432",
      "tel":"448012345678",
      "notes":"Sample notes.",
      "speed_dial_phone":5432,
      "speed_dial_mobile":4444
    },
  "links":
    {
    }
}

DELETE/contacts/{id}

Delete contact for given ID.

Example request:

curl -u user_id:user_token -X DELETE https://l7api.com/v1/gotrunk/contacts/82

Take a 30-day FREE TRIAL

You can use our service totally free of charge for 30 days. No credit card information required.

REGISTER
Click to Chat
chat

CLICK TO CHAT