Apps are identified using their respective guid. You need to store the guid in your app database table to be able to be identified during a call event. List of apps can be retrieved using app list API (seetopic 2.1)
Agent groups are identified using their names
All API responses are JSON encoded, http code 200 indicates success, other codes should be considered as errors.
eg. response:
{'page': {
'endIndex': 1,
'last': 'http://localhost/api/v1/app/list?apikey=61e801bcc21f430aa1ff6edb5421af31&pg=1',
'first': 'http://localhost/api/v1/app/list?apikey=61e801bcc21f430aa1ff6edb5421af31&pg=1',
'startIndex': 1,
'totalItems': 1,
'cur': 'http://localhost/api/v1/app/list?apikey=61e801bcc21f430aa1ff6edb5421af31',
'totalPages': 1
},
'data': [
{
'guid': '1a11fe2082b044b4a3b55718c79c29d5',
'number.virtual': '33047316',
'number.physical': '33047316',
'name': 'test'
}
]
}
eg. response:
{ 'data': [
{
'name': 'default',
'display_name': 'default'
}
]
}
{ 'sticky': false,
'name': 'default',
'ringtime': 15,
'recording': 'enabled',
'distribution': 'RR',
'sticky_days': 30
}
eg. response:
{ 'sticky': false,
'name': 'default',
'ringtime': 15,
'recording': 'enabled',
'distribution': 'RR',
'sticky_days': 30
}
group lists the group parameters for object def ref:
eg. response:
{ 'maxPriority': 1,
'agents': [
{
'type': 'USER',
'number': '971670XXXX',
'priority': 1,
'guid': '21c50d57625040419a7bef92ea4c6c6c',
'name': 'Anil Gupta'
}
]
}
maxPriorityis the highest priority entry in the group, useful for new agent entries
agentsarray lists all agents in a group for object def ref:topic 1.3
Adding agents is a 2 step process. All agent numbers are to be verified before they could be placed in the system. A number needs to be verified only once for a given subscriber.
Every time you need to add an agent into a group you must call Number verification API first (see below) with a preferred method. The API will respond with either ‘passed’ or ‘pending’. ‘pending’ indicates that this is the first time this number is being added, you must call the verification API again along with the `key` parameter before proceeding to add agent. See examples below.
Check if number 971670XXXX is verified, if not verify it
Request:
POST: https://mycalls.sukamapps.com/api/v1/app/21c50d57625040419a7bef92ea4c6c6c/verifyagent
Header: X-APIKey=xxxxxxxxxxxxxx
POST Data: number=971670XXXX&method=sms
Response
{ 'verification': 'pending'
}
Number is not verified, let”s verify it using the key received.
Request:
POST: https://mycalls.sukamapps.com/api/v1/app/21c50d57625040419a7bef92ea4c6c6c/verifyagent
Header: X-APIKey=xxxxxxxxxxxxxx
POST Data: number=971670XXXX&key=0805
Response
{ 'verification': 'passed'
}
Number is now verified, we can add it to a group now using add agent API in the next section.
Add 971670XXXX to group default in an app
Request:
POST: https://mycalls.sukamapps.com/api/v1/app/21c50d57625040419a7bef92ea4c6c6c/ag/default/addAgent
Header: X-APIKey=xxxxxxxxxxxxxx
POST Data: number=971670XXXX&name=testagent
Response
{ 'result': 'success'
}
Remove 971670XXXX from group default in an app
Request:
POST: https://mycalls.sukamapps.com/api/v1/app/21c50d57625040419a7bef92ea4c6c6c/ag/default/remAgent
Header: X-APIKey=xxxxxxxxxxxxxx
POST Data: number=971670XXXX
Response
{ 'result': 'success'
}
{ 'page': {
'totalItems': 1,
'last': 'http://mycalls.sukamapps.com/api/v1/app/1a11fe2082b044b4a3b55718c79c29d5/calls?pg=1',
'pageItems': 1,
'pageNumber': 1,
'cur': 'http://mycalls.sukamapps.com/api/v1/app/1a11fe2082b044b4a3b55718c79c29d5/calls',
'endIndex': 1,
'startIndex': 1,
'totalPages': 1,
'first': 'http://mycalls.sukamapps.com/api/v1/app/1a11fe2082b044b4a3b55718c79c29d5/calls?pg=1'
},
'data': [
{
'log': [
{
'desc': 'TRANSFER SOON',
'id': 'TRANSFER_INIT'
}
],
'hot': 0,
'cli': '9716700271',
'uid': '1498110438.13',
'time': '2017-06-22T11:17:18+05:30',
'active': false,
'duration': '19',
'transfer': [
{
'attemptId': '1498110438.13.2',
'du': '3',
'name': 'Anil Gupta',
'seq': '7',
'time': '2017-06-22T11:17:36+05:30',
'to': '971670XXXX',
'group': 'default',
'disposition': 'answered'
},
{
'attemptId': '1498110438.13.1',
'du': '0',
'name': 'Anil Gupta',
'seq': '5',
'time': '2017-06-22T11:17:20+05:30',
'to': '971670XXXX',
'group': 'default',
'disposition': 'noanswer'
}
]
}
]
}
For incremental call log pass `since` parameter to the call log api.
eg. response:
{
url: "someurl/s.745726.wav"
}
Your API key is listed on your profile page https://mycalls.sukamapps.com/profile
API key can be used in 2 different ways,
a) by appending it to the url as apikey parameter. eg. https://mycalls.sukamapps.com/api/v1/acc/list?apikey=yourlongapikey
b) by using X-APIKey header in the request
method a) only works for get requests like getting a list of apps or subscribers and will not work for post requests like adding an operator, hence it is advisable to use method b