Skip to main content

Agent Authentication

When an integration with uContact involving agent activities is required, authentication is performed through this resource, which logs the agent into the SIP. This allows the agent to be considered for calls and to interact via VoIP, in addition to having access.

You can check the Postman Collection to test in your instance.

All data enclosed in "{{ }}" are values that will be replaced with the client's own data and/or the corresponding instance.


HTTP Request

Method Value
POST /Integra/resources/auth/AgentLogin

Request Header

Key Value
Content-Type application/x-www-form-urlencoded

Request Body

Parameter Type
Description
agent Text (String) User Agent
password Text (String) Password



Code Examples

You can copy the following code examples and replace the "{{variable}}" with the correct data.

HTTP

POST /Integra/resources/auth/AgentLogin HTTP/1.1
Host: {{dominio}}.ucontactcloud.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 33

agent={{User}}&password={{Password}}
cURL
curl --location --request POST 'https://{{dominio}}.ucontactcloud.com/Integra/resources/auth/AgentLogin' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'agent={{Usuario}}' \
--data-urlencode 'password={{AgentPassword}}'
JavaScript
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");

var urlencoded = new URLSearchParams();
urlencoded.append("agent", "{{User}}");
urlencoded.append("password", "{{Password}}");

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: urlencoded,
  redirect: 'follow'
};

fetch("https://{{domain}}.ucontactcloud.com/Integra/resources/auth/AgentLogin", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
JQuery
var settings = {
  "url": "https://{{domain}}.ucontactcloud.com/Integra/resources/auth/AgentLogin",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Content-Type": "application/x-www-form-urlencoded"
  },
  "data": {
    "agent": "{{User}}",
    "password": "{{Password}}"
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
C#
var client = new RestClient("https://{{domain}}.ucontactcloud.com/Integra/resources/auth/AgentLogin");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.AddParameter("agent", "{{User}}");
request.AddParameter("password", "{{Password}}");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
Java
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "agent={{User}}&password={{Password}}");
Request request = new Request.Builder()
  .url("https://{{domain}}.ucontactcloud.com/Integra/resources/auth/AgentLogin")
  .method("POST", body)
  .addHeader("Content-Type", "application/x-www-form-urlencoded")
  .build();
Response response = client.newCall(request).execute();
Python
import http.client

conn = http.client.HTTPSConnection("{{domain}}.ucontactcloud.com")
payload = 'agent={{User}}&password={{Password}}'
headers = {
  'Content-Type': 'application/x-www-form-urlencoded'
}
conn.request("POST", "/Integra/resources/auth/AgentLogin", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))




HTTP Response

Responses that indicate an error due to the data sent will generally be returned with an HTTP 200 code and a "0" or "Error" in the body of the response, so caution should be exercised when validating the HTTP Response Code.

The received response is in text format, so it will need to be converted to JSON in order to view the data correctly.

Response converted to JSON

{
    "id": 4,
    "name": "1997",
    "host": "{{domain}}.ucontactcloud.com",
    "nat": "yes",
    "type": "friend",
    "accountcode": "Vcisneros",
    "callgroup": "",
    "callerid": "1997",
    "canreinvite": "",
    "context": "agents",
    "dtmfmode": "rfc2833",
    "insecure": "",
    "language": "es",
    "mailbox": "",
    "md5secret": "07a46a13aa5434e21e6a9aa870482720",
    "pickupgroup": "",
    "qualify": "yes",
    "secret": "",
    "disallow": "all",
    "allow": "alaw;ulaw",
    "port": "",
    "defaultuser": "1997",
    "subscribecontext": "default",
    "record": "agent",
    "email": "",
    "phonetype": "SoftPhone",
    "LogLevel": "SEVERE",
    "limite": 0,
    "transport": "wss",
    "encryption": "yes",
    "did": "",
    "outboundproxy": "",
    "fullname": "Victor Cisneros",
    "token": "VmNpc25lcm9zOjJhZGUzNjAxLTNhMjgtNDhjNy1hNDg2LTczNTY3ZmI1ZDI2MQ=="
}

Error Response

0