# APIs

# Client Authentication

This resource is used to obtain a token authentication to access the uContact APIs, created for logging in from another application to enable integrations.

<p class="callout info">You can check the [Postman Collection](https://www.postman.com/dev-clever-ideas/ucontact/request/m41rw3t/getusertoken?tab=overview "Client Authentication") to test in your instance.</p>

<p class="callout info">All data enclosed in "{{ }}" are values that will be replaced with the client's own data and/or the corresponding instance.</p>

---

### HTTP Request

<table border="1" id="bkmrk-opcion-http-valor-re" style="border-collapse: collapse; width: 100%; height: 89.3625px;"><tbody><tr style="height: 29.7875px;"><td class="align-center" style="width: 20.3971%; height: 29.7875px;">**Method**</td><td class="align-center" style="width: 79.6029%; height: 29.7875px;">**Resource**</td></tr><tr style="height: 29.7875px;"><td style="width: 20.3971%; height: 29.7875px;">POST</td><td style="width: 79.6029%; height: 29.7875px;">/Integra/resources/auth/getUserToken</td></tr></tbody></table>

#### Request Header


<table border="1" id="bkmrk-key-value-content-ty" style="border-collapse: collapse; width: 100%; height: 89.3907px;"><tbody><tr style="height: 29.7969px;"><td class="align-center" style="width: 20.3971%; height: 29.7969px;">**Key**</td><td class="align-center" style="width: 79.6029%; height: 29.7969px;">**Value**</td></tr><tr style="height: 29.7969px;"><td style="width: 20.3971%; height: 29.7969px;">Content-Type</td><td style="width: 79.6029%; height: 29.7969px;">application/x-www-form-urlencoded</td></tr></tbody></table>

#### Request Body

<table border="1" class="align-center" id="bkmrk-parametro-tipo-descr" style="border-collapse: collapse; width: 100%; height: 89.175px;"><tbody><tr style="height: 29.7875px;"><td style="width: 21.0136%; height: 29.7875px;">**Key**</td><td style="width: 24.9735%; height: 29.7875px;">**Type**</td><td style="width: 54.0129%; height: 29.7875px;">**Description**</td></tr><tr style="height: 29.7875px;"><td class="align-left" style="width: 21.0136%; height: 29.7875px;">user</td><td class="align-left" style="width: 24.9735%; height: 29.7875px;">Text (String)</td><td class="align-left" style="width: 54.0129%; height: 29.7875px;">User Name</td></tr><tr style="height: 29.6px;"><td class="align-left" style="width: 21.0136%; height: 29.6px;">password</td><td class="align-left" style="width: 24.9735%; height: 29.6px;">Text (String)</td><td class="align-left" style="width: 54.0129%; height: 29.6px;">User Password</td></tr></tbody></table>

---

### Code Examples  


<p class="callout info">You can copy the following code examples and replace the "{{variable}}" with the correct data.</p>

#### HTTP

```HTTP
POST /Integra/resources/auth/getUserToken HTTP/1.1
Host: {{domain}}.ucontactcloud.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 32

user={{User}}&password={{Password}}
```

##### cURL

```
curl --location --request POST 'https://{{domain}}.ucontactcloud.com/Integra/resources/auth/getUserToken' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'user={{UserName}}' \
--data-urlencode 'password={{PasswordUser}}'
```

##### JavaScript

```JavaScript
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");

var urlencoded = new URLSearchParams();
urlencoded.append("user", "{{UserName}}");
urlencoded.append("password", "{{PasswordUser}}");

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

fetch("https://{{domain}}.ucontactcloud.com/Integra/resources/auth/getUserToken", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

##### JQuery

```JavaScript
var settings = {
  "url": "https://{{domain}}.ucontactcloud.com/Integra/resources/auth/getUserToken",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Content-Type": "application/x-www-form-urlencoded"
  },
  "data": {
    "user": "{{UserName}}",
    "password": "{{PasswordUser}}"
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

##### C#

```C#
var client = new RestClient("https://{{domain}}.ucontactcloud.com/Integra/resources/auth/getUserToken");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.AddParameter("user", "{{User}}");
request.AddParameter("password", "{{UserPassword}}");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
```

##### Java

```Java
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "user={{User}}&password={{UserPassword}}");
Request request = new Request.Builder()
  .url("https://{{domain}}.ucontactcloud.com/Integra/resources/auth/getUserToken")
  .method("POST", body)
  .addHeader("Content-Type", "application/x-www-form-urlencoded")
  .build();
Response response = client.newCall(request).execute();
```

---

### HTTP Response

```
"{{token}}"
```

#### Respuesta de error

```
"0"
```

# 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.

<p class="callout info">You can check the [Postman Collection](https://www.postman.com/dev-clever-ideas/ucontact/request/ixfd2hv/agentlogin?tab=overview "Agent Authentication") to test in your instance.</p>

<p class="callout info">All data enclosed in "{{ }}" are values that will be replaced with the client's own data and/or the corresponding instance.</p>

---

### HTTP Request

<table border="1" id="bkmrk-opci%C3%B3n-http-valor-re" style="border-collapse: collapse; width: 100%; height: 89.3907px;"><tbody><tr style="height: 29.7969px;"><td class="align-center" style="width: 22.284%; height: 29.7969px;">**Method**</td><td class="align-center" style="width: 77.8396%; height: 29.7969px;">**Value**</td></tr><tr style="height: 29.7969px;"><td style="width: 22.284%; height: 29.7969px;">POST</td><td style="width: 77.8396%; height: 29.7969px;">/Integra/resources/auth/AgentLogin</td></tr></tbody></table>

#### Request Header

<table border="1" id="bkmrk-key-value-content-ty" style="border-collapse: collapse; width: 100%; height: 89.3907px;"><tbody><tr style="height: 29.7969px;"><td class="align-center" style="width: 22.284%; height: 29.7969px;">**Key**</td><td class="align-center" style="width: 77.8396%; height: 29.7969px;">**Value**</td></tr><tr style="height: 29.7969px;"><td style="width: 22.284%; height: 29.7969px;">Content-Type</td><td style="width: 77.8396%; height: 29.7969px;">application/x-www-form-urlencoded</td></tr></tbody></table>



#### Request Body

<table border="1" id="bkmrk-parametro-tipo-descr" style="border-collapse: collapse; width: 100%; height: 89.3907px;"><tbody><tr style="height: 29.7969px;"><td class="align-center" style="width: 33.2909%; height: 29.7969px;">**Parameter**</td><td class="align-center" style="width: 33.2909%; height: 29.7969px;">**Type**  
</td><td class="align-center" style="width: 33.2948%; height: 29.7969px;">**Description**</td></tr><tr style="height: 29.7969px;"><td style="width: 33.2909%; height: 29.7969px;">agent</td><td style="width: 33.2909%; height: 29.7969px;">Text (String)</td><td style="width: 33.2948%; height: 29.7969px;">User Agent</td></tr><tr style="height: 29.7969px;"><td style="width: 33.2909%; height: 29.7969px;">password</td><td style="width: 33.2909%; height: 29.7969px;">Text (String)</td><td style="width: 33.2948%; height: 29.7969px;">Password</td></tr></tbody></table>

---

### Code Examples

<p class="callout info">You can copy the following code examples and replace the "{{variable}}" with the correct data.</p>

#### HTTP

```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
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

```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

```JavaScript
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#

```JavaScript
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

```JavaScript
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

```JavaScript
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

<p class="callout warning">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.</p>

<p class="callout warning">The received response is in text format, so it will need to be converted to JSON in order to view the data correctly.</p>

#### Response converted to JSON

```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

```JavaScript
0
```

# Log Out

This API is used to log out the agent or user once they are no longer in use.

<p class="callout info">You can check the [Postman Collection](https://www.postman.com/dev-clever-ideas/ucontact/request/jll18s1/agentlogoff?tab=overview "Agent Logoff") to test in your instance.</p>

<p class="callout info">All data enclosed in "{{ }}" are values that will be replaced with the client's own data and/or the corresponding instance.</p>

### HTTP Request

<table border="1" id="bkmrk-opcion-http-valor-re" style="border-collapse: collapse; width: 100%; height: 89.3907px;"><tbody><tr style="height: 29.7969px;"><td class="align-center" style="width: 20.3971%; height: 29.7969px;">**Method**</td><td class="align-center" style="width: 79.6029%; height: 29.7969px;">**Resource**</td></tr><tr style="height: 29.7969px;"><td style="width: 20.3971%; height: 29.7969px;">POST</td><td style="width: 79.6029%; height: 29.7969px;">/Integra/resources/api/AgentLogoff</td></tr></tbody></table>

#### Request Header

<table border="1" id="bkmrk-key-value-content-ty" style="border-collapse: collapse; width: 100%; height: 89.3907px;"><tbody><tr style="height: 29.7969px;"><td class="align-center" style="width: 20.3971%; height: 29.7969px;">**Key**</td><td class="align-center" style="width: 79.6029%; height: 29.7969px;">**Value**</td></tr><tr style="height: 29.7969px;"><td style="width: 20.3971%; height: 29.7969px;">Content-Type</td><td style="width: 79.6029%; height: 29.7969px;">application/x-www-form-urlencoded</td></tr><tr><td style="width: 20.3971%;">Authorization</td><td style="width: 79.6029%;">Basic Token</td></tr></tbody></table>


#### Request Body

<table border="1" class="align-center" id="bkmrk-parametro-tipo-descr" style="border-collapse: collapse; width: 100%; height: 89.3907px;"><tbody><tr style="height: 29.7969px;"><td style="width: 21.0136%; height: 29.7969px;">**Parameter**</td><td style="width: 20.5192%; height: 29.7969px;">**Type**</td><td style="width: 13.8485%;">**Required**</td><td style="width: 44.6187%; height: 29.7969px;">**Description**</td></tr><tr style="height: 29.7969px;"><td class="align-left" style="width: 21.0136%; height: 29.7969px;">agent</td><td class="align-left" style="width: 20.5192%; height: 29.7969px;">Text (String)</td><td style="width: 13.8485%;">Yes</td><td class="align-left" style="width: 44.6187%; height: 29.7969px;">Username to log out</td></tr><tr><td class="align-left" style="width: 21.0136%;">interface</td><td class="align-left" style="width: 20.5192%;">Text (String)</td><td style="width: 13.8485%;">No</td><td class="align-left" style="width: 44.6187%;">Phone number/extension of the SIP for the agent</td></tr><tr style="height: 29.7969px;"><td class="align-left" style="width: 21.0136%; height: 29.7969px;">message</td><td class="align-left" style="width: 20.5192%; height: 29.7969px;">Text (String)</td><td style="width: 13.8485%;">No</td><td class="align-left" style="width: 44.6187%; height: 29.7969px;">Message to save</td></tr></tbody></table>

---

### Code Examples

<p class="callout info">You can copy the following code examples and replace the "{{variable}}" with the correct data.</p>

#### HTTP

```HTTP
POST /Integra/resources/api/AgentLogoff HTTP/1.1
Host: {{domain}}.ucontactcloud.com
Authorization: Basic {{Token}}
Content-Type: application/x-www-form-urlencoded
Content-Length: 55

agent=Vcisneros&interface=SIP%2F1997&message=Desloguear
```

##### cURL

```
curl --location --request POST 'https://{{domain}}.ucontactcloud.com/Integra/resources/api/AgentLogoff' \
--header 'Authorization: Basic {{Token}}' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'agent={{User}}' \
--data-urlencode 'interface=SIP/{{Extension}}' \
--data-urlencode 'message={{Mensaje}}'
```

##### JavaScript

```JavaScript
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic {{Token}}");
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");

var urlencoded = new URLSearchParams();
urlencoded.append("agent", "{{User}}");
urlencoded.append("interface", "SIP/{{Extension}}");
urlencoded.append("message", "{{Mensaje}}");

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

fetch("https://{{domain}}.ucontactcloud.com/Integra/resources/api/AgentLogoff", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

##### JQuery

```JavaScript
var settings = {
  "url": "https://{{domain}}.ucontactcloud.com/Integra/resources/api/AgentLogoff",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Authorization": "Basic {{Token}}",
    "Content-Type": "application/x-www-form-urlencoded"
  },
  "data": {
    "agent": "{{User}}",
    "interface": "SIP/{{Extension}}",
    "message": "{{Mensaje}}"
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

##### C#

```C#
var client = new RestClient("https://{{domain}}.ucontactcloud.com/Integra/resources/api/AgentLogoff");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Basic {{Token}}");
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.AddParameter("agent", "{{User}}");
request.AddParameter("interface", "SIP/{{Extension}}");
request.AddParameter("message", "{{Mensaje}}");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
```

##### Java

```Java
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "agent={{User}}&interface=SIP/{{Extension}}&message={{Mensaje}}");
Request request = new Request.Builder()
  .url("https://{{domain}}.ucontactcloud.com/Integra/resources/api/AgentLogoff")
  .method("POST", body)
  .addHeader("Authorization", "Basic {{Token}}")
  .addHeader("Content-Type", "application/x-www-form-urlencoded")
  .build();
Response response = client.newCall(request).execute();
```

##### Python

```Python
import http.client

conn = http.client.HTTPSConnection("{{domain}}.ucontactcloud.com")
payload = 'agent={{User}}&interface=SIP/{{Extension}}&message={{Mensaje}}'
headers = {
  'Authorization': 'Basic {{Token}}',
  'Content-Type': 'application/x-www-form-urlencoded'
}
conn.request("POST", "/Integra/resources/api/AgentLogoff", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```

---

### HTTP Response

#### Successful Response

```Text
Success
```

#### Error Response

```JSON
0
```

# Hang Up Call

When you want to hang up a call from outside of uContact, this API is used, allowing for a more complete integration.

<p class="callout info">You can check the [Postman Collection](https://www.postman.com/dev-clever-ideas/ucontact/request/wng0qmj/hangupphone?tab=overview "HangUp") to test in your instance.</p>

<p class="callout info">All data enclosed in "{{ }}" are values that will be replaced with the client's own data and/or the corresponding instance.</p>

### Request Information

<table border="1" id="bkmrk-opcion-http-valor-re" style="border-collapse: collapse; width: 100%; height: 148.984px;"><tbody><tr style="height: 29.7969px;"><td class="align-center" style="width: 20.3956%; height: 29.7969px;">**Method**</td><td class="align-center" style="width: 79.6044%; height: 29.7969px;">**Resource**</td></tr><tr style="height: 29.7969px;"><td style="width: 20.3956%; height: 29.7969px;">POST</td><td style="width: 79.6044%; height: 29.7969px;">/Integra/resources/Agents/HangupPhone</td></tr></tbody></table>

#### Request Header

<table border="1" id="bkmrk-opcion-valor-content" style="border-collapse: collapse; width: 100%; height: 89.3907px;"><tbody><tr style="height: 29.7969px;"><td class="align-center" style="width: 20.7658%; height: 29.7969px;">**Option**</td><td class="align-center" style="width: 79.2342%; height: 29.7969px;">**Value**</td></tr><tr style="height: 29.7969px;"><td style="width: 20.7658%; height: 29.7969px;">Content-Type</td><td style="width: 79.2342%; height: 29.7969px;">application/x-www-form-urlencoded</td></tr><tr style="height: 29.7969px;"><td style="width: 20.7658%; height: 29.7969px;">Authorization</td><td style="width: 79.2342%; height: 29.7969px;">Basic {{Token}}</td></tr></tbody></table>

#### Request Body

<table border="1" class="align-center" id="bkmrk-parametro-tipo-descr" style="border-collapse: collapse; width: 100%; height: 59.5938px;"><tbody><tr style="height: 29.7969px;"><td style="width: 20.5192%; height: 29.7969px;">**Parameter**</td><td style="width: 17.4289%; height: 29.7969px;">**Type**</td><td style="width: 13.8443%;">**Required**</td><td style="width: 48.2077%; height: 29.7969px;">**Description**</td></tr><tr style="height: 29.7969px;"><td data-colwidth="210" style="width: 20.5192%;">phone

</td><td data-colwidth="549" style="width: 17.4289%;">Number (Integer)</td><td style="width: 13.8443%;">Yes</td><td class="align-left" style="width: 48.2077%; height: 29.7969px;">Agent's phone number/extension</td></tr></tbody></table>

---

### HTTP Request

#### Code Examples

<p class="callout info">You can copy the following code examples and replace the "{{variable}}" with the correct data.</p>

##### HTTP

```VBScript
POST /Integra/resources/Agents/HangupPhone HTTP/1.1
Host: {{instance}}.ucontactcloud.com
Authorization: Basic {{Token}}
Content-Type: application/x-www-form-urlencoded
Content-Length: 10

phone={{AgentPhone}}
```

##### cURL

```VBScript
curl --location --request POST 'https://{{instance}}.ucontactcloud.com/Integra/resources/Agents/HangupPhone' \
--header 'Authorization: Basic {{Token}}' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'phone={{AgentPhone}}'
```

##### JavaScript

```JavaScript
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic {{Token}}");
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");

var urlencoded = new URLSearchParams();
urlencoded.append("phone", "{{AgentPhone}}");

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

fetch("https://{{Instance}}.ucontactcloud.com/Integra/resources/Agents/HangupPhone", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

##### JQuery

```JavaScript
var settings = {
  "url": "https://{{Instance}}.ucontactcloud.com/Integra/resources/Agents/HangupPhone",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Authorization": "Basic {{Token}}",
    "Content-Type": "application/x-www-form-urlencoded"
  },
  "data": {
    "phone": "{{AgentPhone}}"
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

##### C#

```C#
var client = new RestClient("https://{{Instance}}.ucontactcloud.com/Integra/resources/Agents/HangupPhone");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Basic {{Token}}");
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.AddParameter("phone", "{{AgentPhone}}");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
```

##### Java

```Java
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "phone={{AgentPhone}}");
Request request = new Request.Builder()
  .url("https://{{Instance}}.ucontactcloud.com/Integra/resources/Agents/HangupPhone")
  .method("POST", body)
  .addHeader("Authorization", "Basic {{Token}}")
  .addHeader("Content-Type", "application/x-www-form-urlencoded")
  .build();
Response response = client.newCall(request).execute();
```

##### Python

```Python
import http.client

conn = http.client.HTTPSConnection("{{Instance}}.ucontactcloud.com")
payload = 'phone={{AgentPhone}}'
headers = {
  'Authorization': 'Basic {{Token}}',
  'Content-Type': 'application/x-www-form-urlencoded'
}
conn.request("POST", "/Integra/resources/Agents/HangupPhone", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```

---

### HTTP Response

#### Successful Response

```JSON
1
```

#### Error Response

```JSON
0
```

# Add Record to Dialer

Adds a record to a dialer to launch the call as soon as an agent is available. This record will be added to the queue, meaning that records already in the queue will be dialed first, regardless; this queue will only consider records that do not belong to a dialing list.

<p class="callout info">You can check the [Postman Collection](https://www.postman.com/dev-clever-ideas/ucontact/request/86fjj0d/dialertask?tab=overview "dialerTask") to test in your instance.</p>

<p class="callout info">All data enclosed in "{{ }}" are values that will be replaced with the client's own data and/or the corresponding instance.</p>

### HTTP Request

<table border="1" id="bkmrk-opcion-http-valor-re" style="border-collapse: collapse; width: 100%; height: 148.984px;"><tbody><tr style="height: 29.7969px;"><td class="align-center" style="width: 20.3956%; height: 29.7969px;">**Method**</td><td class="align-center" style="width: 79.6044%; height: 29.7969px;">**Resource**</td></tr><tr style="height: 29.7969px;"><td style="width: 20.3956%; height: 29.7969px;">POST</td><td style="width: 79.6044%; height: 29.7969px;">/Integra/resources/Dialers/DialerTask</td></tr></tbody></table>

#### Request Header

<table border="1" id="bkmrk-opcion-valor-content" style="border-collapse: collapse; width: 100%; height: 89.3907px;"><tbody><tr style="height: 29.7969px;"><td class="align-center" style="width: 20.7664%; height: 29.7969px;">**Key**</td><td class="align-center" style="width: 79.2336%; height: 29.7969px;">**Value**</td></tr><tr style="height: 29.7969px;"><td style="width: 20.7664%; height: 29.7969px;">Content-Type</td><td style="width: 79.2336%; height: 29.7969px;">application/x-www-form-urlencoded</td></tr><tr style="height: 29.7969px;"><td style="width: 20.7664%; height: 29.7969px;">Authorization</td><td style="width: 79.2336%; height: 29.7969px;">Basic {{Token}}</td></tr></tbody></table>

#### Request Body

<table border="1" class="align-center" id="bkmrk-parametro-tipo-descr" style="border-collapse: collapse; width: 100%; height: 59.5938px;"><tbody><tr style="height: 29.7969px;"><td style="width: 20.5192%; height: 29.7969px;">**Parameter**</td><td style="width: 17.4289%; height: 29.7969px;">**Type**</td><td style="width: 13.8443%;">**Required**</td><td style="width: 48.2077%; height: 29.7969px;">**Description**</td></tr><tr style="height: 29.7969px;"><td data-colwidth="210" style="width: 20.5192%;">call

</td><td data-colwidth="549" style="width: 17.4289%;">JSON String (String)</td><td style="width: 13.8443%;">Yes</td><td class="align-left" style="width: 48.2077%; height: 29.7969px;">JSON Object Converted to Text with the added data in the following example.</td></tr></tbody></table>

##### JSON Example

<p class="callout warning">The data added in the following example is purely demonstrative; you will need to replace the data with those corresponding to your instance.</p>

```JSON
{
  "calldate": null,             // If you need to call at a specific time, example: '1900-01-01 00:00:00'
  "campaign": "POWER<-",        // Name of the campaign to add the record to
  "destination": "0123456789",  // Phone number to be dialed
  "alternatives": "",           // Alternative number to call if the first number is not reachable
  "agent": "",                  // Phone/Extension of the agent if you want a specific agent to take the call
  "data": "idcustomer=7",       // Data to show on the instance's form or for specific use
  "source": "source",           // Pending
  "bulk": false,                // Pending
  "automatic": true              // Pending
}
```

##### Description of JSON Object

<p class="callout warning">In the JSON, all keys must be included. If a field states that it is not mandatory, it can be added with an empty value.</p>

<table border="1" id="bkmrk-parametro-tipo-reque" style="border-collapse: collapse; width: 100%; height: 364.325px;"><tbody><tr style="height: 29.7875px;"><td class="align-center" style="width: 20.5192%; height: 29.7875px;">**Parameter**</td><td class="align-center" style="width: 17.4289%; height: 29.7875px;">**Type**</td><td class="align-center" style="width: 13.8443%; height: 29.7875px;">**Required**</td><td class="align-center" style="width: 48.2077%; height: 29.7875px;">**Description**</td></tr><tr style="height: 46.4px;"><td style="width: 20.5192%; height: 46.4px;">calldate</td><td style="width: 17.4289%; height: 46.4px;">Text (String)</td><td class="align-center" style="width: 13.8443%; height: 46.4px;">No</td><td style="width: 48.2077%; height: 46.4px;">Defines the time at which the call will be made; it can be 'null' or a date in the format '1900-01-01 00:00:00'.</td></tr><tr style="height: 29.7875px;"><td style="width: 20.5192%; height: 29.7875px;">campaign</td><td style="width: 17.4289%; height: 29.7875px;">Text (String)</td><td class="align-center" style="width: 13.8443%; height: 29.7875px;">Yes</td><td style="width: 48.2077%; height: 29.7875px;">Name of the campaign to which the record will be added.</td></tr><tr style="height: 29.7875px;"><td style="width: 20.5192%; height: 29.7875px;">destination</td><td style="width: 17.4289%; height: 29.7875px;">Text (String)</td><td class="align-center" style="width: 13.8443%; height: 29.7875px;">Yes</td><td style="width: 48.2077%; height: 29.7875px;">Phone number to be called.</td></tr><tr style="height: 46.4px;"><td style="width: 20.5192%; height: 46.4px;">alternatives</td><td style="width: 17.4289%; height: 46.4px;">Text (String)</td><td class="align-center" style="width: 13.8443%; height: 46.4px;">No</td><td style="width: 48.2077%; height: 46.4px;">Alternative numbers to contact if the first number cannot be reached; can be left empty.</td></tr><tr style="height: 46.4px;"><td style="width: 20.5192%; height: 46.4px;">agent</td><td style="width: 17.4289%; height: 46.4px;">Text (String)</td><td class="align-center" style="width: 13.8443%; height: 46.4px;">No</td><td style="width: 48.2077%; height: 46.4px;">Phone number/extension of the agent if a specific agent is required to take the call.</td></tr><tr style="height: 46.4px;"><td style="width: 20.5192%; height: 46.4px;">data</td><td style="width: 17.4289%; height: 46.4px;">Text (String)</td><td class="align-center" style="width: 13.8443%; height: 46.4px;">No</td><td style="width: 48.2077%; height: 46.4px;">Data to be added for display in forms, surveys, or for other purposes within the platform.</td></tr><tr style="height: 29.7875px;"><td style="width: 20.5192%; height: 29.7875px;">source</td><td style="width: 17.4289%; height: 29.7875px;">Text (String)</td><td class="align-center" style="width: 13.8443%; height: 29.7875px;">Yes</td><td style="width: 48.2077%; height: 29.7875px;">  
</td></tr><tr style="height: 29.7875px;"><td style="width: 20.5192%; height: 29.7875px;">bulk</td><td style="width: 17.4289%; height: 29.7875px;">Boolean</td><td class="align-center" style="width: 13.8443%; height: 29.7875px;">yes</td><td style="width: 48.2077%; height: 29.7875px;">  
</td></tr><tr style="height: 29.7875px;"><td style="width: 20.5192%; height: 29.7875px;">automatic</td><td style="width: 17.4289%; height: 29.7875px;">Boolean</td><td class="align-center" style="width: 13.8443%; height: 29.7875px;">yes</td><td style="width: 48.2077%; height: 29.7875px;">  
</td></tr></tbody></table>

---

### Code Examples

<p class="callout info">You can copy the following code examples and replace the "{{variable}}" with the correct data.</p>

##### HTTP

```VBScript
POST /Integra/resources/Dialers/DialerTask HTTP/1.1
Host: {{Instance}}.ucontactcloud.com
Authorization: Basic {{Token}}
Content-Type: application/x-www-form-urlencoded
Content-Length: 310

call={{Objeto Json}}
```

##### cURL

```VBScript
curl --location --request POST 'https://testclever.ucontactcloud.com/Integra/resources/Dialers/DialerTask' \
--header 'Authorization: Basic VmNpc25lcm9zOjY3NDdjODIzLWY5ZmItNDY0My05NTc0LWNjMjJhOTlhZDRlMQ==' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'call={"calldate" : null,"campaign" : "POWER<-","destination": "1234567890","alternatives": "","agent" : "","data": "idcustomer=7","source": "source","bulk": false,"automatic": true }'
```

##### JavaScript

```JavaScript
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic {{Token}}");
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");

var urlencoded = new URLSearchParams();
urlencoded.append("call", "{\"calldate\" : null,\"campaign\" : \"POWER<-\",\"destination\": \"0123456789\",\"alternatives\": \"\",\"agent\" : \"\",\"data\": \"idcustomer=7\",\"source\": \"source\",\"bulk\": false,\"automatic\": true }");

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

fetch("https://{{Instance}}.ucontactcloud.com/Integra/resources/Dialers/DialerTask", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

##### JQuery

```JavaScript
var settings = {
  "url": "https://{{Instance}}.ucontactcloud.com/Integra/resources/Dialers/DialerTask",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Authorization": "Basic {{Token}}",
    "Content-Type": "application/x-www-form-urlencoded"
  },
  "data": {
    "call": "{\"calldate\" : null,\"campaign\" : \"POWER<-\",\"destination\": \"0123456789\",\"alternatives\": \"\",\"agent\" : \"\",\"data\": \"idcustomer=7\",\"source\": \"source\",\"bulk\": false,\"automatic\": true }"
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

##### C#

```C#
var client = new RestClient("https://{{Instance}}.ucontactcloud.com/Integra/resources/Dialers/DialerTask");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Basic {{Token}}");
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.AddParameter("call", "{\"calldate\" : null,\"campaign\" : \"POWER<-\",\"destination\": \"0123456789\",\"alternatives\": \"\",\"agent\" : \"\",\"data\": \"idcustomer=7\",\"source\": \"source\",\"bulk\": false,\"automatic\": true }");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
```

##### Java

```Java
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "call={\"calldate\" : null,\"campaign\" : \"POWER<-\",\"destination\": \"0123456789\",\"alternatives\": \"\",\"agent\" : \"\",\"data\": \"idcustomer=7\",\"source\": \"source\",\"bulk\": false,\"automatic\": true }");
Request request = new Request.Builder()
  .url("https://{{Instance}}.ucontactcloud.com/Integra/resources/Dialers/DialerTask")
  .method("POST", body)
  .addHeader("Authorization", "Basic {{Token}}")
  .addHeader("Content-Type", "application/x-www-form-urlencoded")
  .build();
Response response = client.newCall(request).execute();
```

##### Python

```Python
import http.client

conn = http.client.HTTPSConnection("{{Instance}}.ucontactcloud.com")
payload = 'call={{Objeto Json}}'
headers = {
  'Authorization': 'Basic {{Token}}',
  'Content-Type': 'application/x-www-form-urlencoded'
}
conn.request("POST", "/Integra/resources/Dialers/DialerTask", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```

---

### HTTP Response

#### Successful Response

```JSON
1
```

#### Error Response

```JSON
0
```

# Upload Base

Uploads a dialing list via a CSV or TXT file to a dialer for integration with an external system to uContact.

<p class="callout info">You can check the [Postman Collection](https://www.postman.com/dev-clever-ideas/ucontact/request/lsahl8e/uploadbase?tab=overview "uploadBase") to test in your instance.</p>

<p class="callout info">All data enclosed in "{{ }}" are values that will be replaced with the client's own data and/or the corresponding instance.</p>

---

### HTTP Request

<table border="1" id="bkmrk-opcion-http-valor-re" style="border-collapse: collapse; width: 100%; height: 148.984px;"><tbody><tr style="height: 29.7969px;"><td class="align-center" style="width: 20.3956%; height: 29.7969px;">**Method**</td><td class="align-center" style="width: 79.6044%; height: 29.7969px;">**Resource**</td></tr><tr style="height: 29.7969px;"><td style="width: 20.3956%; height: 29.7969px;">POST</td><td style="width: 79.6044%; height: 29.7969px;">/Integra/resources/Dialers/uploadbase</td></tr></tbody></table>

#### Request Header

<table border="1" id="bkmrk-opcion-valor-content" style="border-collapse: collapse; width: 100%; height: 89.3907px;"><tbody><tr style="height: 29.7969px;"><td class="align-center" style="width: 20.7664%; height: 29.7969px;">**Option**</td><td class="align-center" style="width: 79.2336%; height: 29.7969px;">**Value**</td></tr><tr style="height: 29.7969px;"><td style="width: 20.7664%; height: 29.7969px;">Content-Type</td><td style="width: 79.2336%; height: 29.7969px;">application/x-www-form-urlencoded</td></tr><tr style="height: 29.7969px;"><td style="width: 20.7664%; height: 29.7969px;">Authorization</td><td style="width: 79.2336%; height: 29.7969px;">Basic {{Token}}</td></tr></tbody></table>

#### Request Body

<p class="callout info">The "cant" parameter can be set to a value of 0; once the list is activated, the number of records in the list will be updated.</p>

<p class="callout warning">In the **fileb64** field, only the content of the plain text file encoded in base64 should be sent. If the file is encoded as such and added to this field, it will result in an error in the request.</p>

<table border="1" class="align-center" id="bkmrk-parametro-tipo-descr" style="border-collapse: collapse; width: 100%; height: 59.5938px;"><tbody><tr style="height: 29.7969px;"><td style="width: 20.5192%; height: 29.7969px;">**Parameter**</td><td style="width: 18.54%; height: 29.7969px;">**Type**</td><td style="width: 12.7331%;">**Required**</td><td style="width: 48.2077%; height: 29.7969px;">**Description**</td></tr><tr style="height: 29.7969px;"><td data-colwidth="210" style="width: 20.5192%;">filename

</td><td class="align-left" data-colwidth="549" style="width: 18.54%;">Text (String)</td><td style="width: 12.7331%;">Yes</td><td class="align-left" style="width: 48.2077%; height: 29.7969px;">Nombre del archivo a subir</td></tr><tr><td style="width: 20.5192%;">fileb64

</td><td class="align-left" style="width: 18.54%;">Base64 Encoded Content File</td><td style="width: 12.7331%;">Yes</td><td class="align-left" style="width: 48.2077%;">Content file to upload encoded in Base64</td></tr><tr><td style="width: 20.5192%;">campaign

</td><td class="align-left" style="width: 18.54%;">Text (String)</td><td style="width: 12.7331%;">Yes</td><td class="align-left" style="width: 48.2077%;">Name of the campaign to which the file will be uploaded</td></tr><tr><td style="width: 20.5192%;">cant

</td><td class="align-left" style="width: 18.54%;">Number (Integer)</td><td style="width: 12.7331%;">Yes</td><td class="align-left" style="width: 48.2077%;">Number of records in the file

</td></tr><tr><td style="width: 20.5192%;">username

</td><td class="align-left" style="width: 18.54%;">Text (String)</td><td style="width: 12.7331%;">Yes</td><td class="align-left" style="width: 48.2077%;">Username uploading the Calling List file</td></tr></tbody></table>

---

### Code Examples

<p class="callout info">You can copy the following code examples and replace the "{{variable}}" with the correct data.</p>

##### HTTP

```VBScript
POST /Integra/resources/Dialers/uploadbase HTTP/1.1
Host: {{Instance}}.ucontactcloud.com
Authorization: Basic {{Token}}
Content-Type: application/x-www-form-urlencoded
Content-Length: 604

filename=base_prueba_2.csv&fileb64=UE9XRVI8LTswMTIzNDU2Nzg5O0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow0KUE9XRVI8LTs5ODc2NTQzMjEwO0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow0KUE9XRVI8LTswMTQ3ODUyMzY5O0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow0KUE9XRVI8LTszNjk4NTIwMTQ3O0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow0KUE9XRVI8LTs3NTMyMTQ2OTgwO0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow%3D%3D&campaign=POWER%3C-&cant=5&username=Vcisneros
```

##### cURL

```VBScript
curl --location --request POST 'https://{{Instance}}.ucontactcloud.com/Integra/resources/Dialers/uploadbase' \
--header 'Authorization: Basic {{Token}}' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'filename=base_prueba_2.csv' \
--data-urlencode 'fileb64=UE9XRVI8LTswMTIzNDU2Nzg5O0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow0KUE9XRVI8LTs5ODc2NTQzMjEwO0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow0KUE9XRVI8LTswMTQ3ODUyMzY5O0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow0KUE9XRVI8LTszNjk4NTIwMTQ3O0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow0KUE9XRVI8LTs3NTMyMTQ2OTgwO0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow==' \
--data-urlencode 'campaign=POWER<-' \
--data-urlencode 'cant=5' \
--data-urlencode 'username=Vcisneros'
```

##### JavaScript

```JavaScript
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic {{Token}}");
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");

var urlencoded = new URLSearchParams();
urlencoded.append("filename", "base_prueba_2.csv");
urlencoded.append("fileb64", "UE9XRVI8LTswMTIzNDU2Nzg5O0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow0KUE9XRVI8LTs5ODc2NTQzMjEwO0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow0KUE9XRVI8LTswMTQ3ODUyMzY5O0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow0KUE9XRVI8LTszNjk4NTIwMTQ3O0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow0KUE9XRVI8LTs3NTMyMTQ2OTgwO0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow==");
urlencoded.append("campaign", "POWER<-");
urlencoded.append("cant", "5");
urlencoded.append("username", "Vcisneros");

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

fetch("https://{{Instance}}.ucontactcloud.com/Integra/resources/Dialers/uploadbase", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

##### JQuery

```JavaScript
var settings = {
  "url": "https://{{Instance}}.ucontactcloud.com/Integra/resources/Dialers/uploadbase",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Authorization": "Basic {{Token}}",
    "Content-Type": "application/x-www-form-urlencoded"
  },
  "data": {
    "filename": "base_prueba_2.csv",
    "fileb64": "UE9XRVI8LTswMTIzNDU2Nzg5O0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow0KUE9XRVI8LTs5ODc2NTQzMjEwO0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow0KUE9XRVI8LTswMTQ3ODUyMzY5O0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow0KUE9XRVI8LTszNjk4NTIwMTQ3O0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow0KUE9XRVI8LTs3NTMyMTQ2OTgwO0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow==",
    "campaign": "POWER<-",
    "cant": "5",
    "username": "Vcisneros"
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

##### C#

```C#
var client = new RestClient("https://{{Instance}}.ucontactcloud.com/Integra/resources/Dialers/uploadbase");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Basic {{Token}}");
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.AddParameter("filename", "base_prueba_2.csv");
request.AddParameter("fileb64", "UE9XRVI8LTswMTIzNDU2Nzg5O0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow0KUE9XRVI8LTs5ODc2NTQzMjEwO0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow0KUE9XRVI8LTswMTQ3ODUyMzY5O0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow0KUE9XRVI8LTszNjk4NTIwMTQ3O0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow0KUE9XRVI8LTs3NTMyMTQ2OTgwO0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow==");
request.AddParameter("campaign", "POWER<-");
request.AddParameter("cant", "5");
request.AddParameter("username", "Vcisneros");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
```

##### Java

```Java
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "filename=base_prueba_2.csv&fileb64=UE9XRVI8LTswMTIzNDU2Nzg5O0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow0KUE9XRVI8LTs5ODc2NTQzMjEwO0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow0KUE9XRVI8LTswMTQ3ODUyMzY5O0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow0KUE9XRVI8LTszNjk4NTIwMTQ3O0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow0KUE9XRVI8LTs3NTMyMTQ2OTgwO0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow==&campaign=POWER<-&cant=5&username=Vcisneros");
Request request = new Request.Builder()
  .url("https://{{Instance}}.ucontactcloud.com/Integra/resources/Dialers/uploadbase")
  .method("POST", body)
  .addHeader("Authorization", "Basic {{Token}}")
  .addHeader("Content-Type", "application/x-www-form-urlencoded")
  .build();
Response response = client.newCall(request).execute();
```

##### Python

```Python
import http.client

conn = http.client.HTTPSConnection("{{Instance}}.ucontactcloud.com")
payload = 'filename=base_prueba_2.csv&fileb64=UE9XRVI8LTswMTIzNDU2Nzg5O0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow0KUE9XRVI8LTs5ODc2NTQzMjEwO0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow0KUE9XRVI8LTswMTQ3ODUyMzY5O0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow0KUE9XRVI8LTszNjk4NTIwMTQ3O0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow0KUE9XRVI8LTs3NTMyMTQ2OTgwO0lkPTIyMDE0MTpGb2xpbz0xOk5vbWJyZT1WaWN0b3IgQ2lzbmVyb3M6Zm9saW9DUk09Ozs5OTk5Ow%3D%3D&campaign=POWER%3C-&cant=5&username=Vcisneros'
headers = {
  'Authorization': 'Basic {{Token}}',
  'Content-Type': 'application/x-www-form-urlencoded'
}
conn.request("POST", "/Integra/resources/Dialers/uploadbase", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```

---

### HTTP Response

#### Successful Response

```JSON
1
```

#### Error Response

```JSON
0
```

# Call Disposition

When a call is ended in uContact, a disposition can be added to identify how the call concluded, allowing for reporting or creating actions based on the disposition.

<p class="callout info">All data enclosed in "{{ }}" are values that will be replaced with the client's own data and/or the corresponding instance.</p>

---

### HTTP Request

<table border="1" id="bkmrk-opcion-http-valor-re" style="border-collapse: collapse; width: 100%; height: 148.984px;"><tbody><tr style="height: 29.7969px;"><td class="align-center" style="width: 20.3956%; height: 29.7969px;">**Method**</td><td class="align-center" style="width: 79.6044%; height: 29.7969px;">**Resource**</td></tr><tr style="height: 29.7969px;"><td style="width: 20.3956%; height: 29.7969px;">POST</td><td style="width: 79.6044%; height: 29.7969px;">Integra/resources/api/DispositionCall</td></tr></tbody></table>

#### Request Header

<table border="1" id="bkmrk-opcion-valor-content" style="border-collapse: collapse; width: 100%; height: 89.3907px;"><tbody><tr style="height: 29.7969px;"><td class="align-center" style="width: 20.7664%; height: 29.7969px;">**Key**</td><td class="align-center" style="width: 79.2336%; height: 29.7969px;">**Value**</td></tr><tr style="height: 29.7969px;"><td style="width: 20.7664%; height: 29.7969px;">Content-Type</td><td style="width: 79.2336%; height: 29.7969px;">application/x-www-form-urlencoded</td></tr><tr style="height: 29.7969px;"><td style="width: 20.7664%; height: 29.7969px;">Authorization</td><td style="width: 79.2336%; height: 29.7969px;">Basic {{Token}}</td></tr></tbody></table>

#### Request Body

<table border="1" class="align-center" id="bkmrk-parametro-tipo-descr" style="border-collapse: collapse; width: 100%; height: 503.4px;"><tbody><tr style="height: 29.8px;"><td style="width: 20.5192%; height: 29.8px;">**Parameter**</td><td style="width: 17.4289%; height: 29.8px;">**Type**</td><td style="width: 13.8443%; height: 29.8px;">**Required**</td><td style="width: 48.2077%; height: 29.8px;">**Description**</td></tr><tr style="height: 35.4px;"><td data-colwidth="210" style="width: 20.5192%; height: 35.4px;">campaign

</td><td data-colwidth="549" style="width: 17.4289%; height: 35.4px;">Text</td><td style="width: 13.8443%; height: 35.4px;">Yes</td><td class="align-left" style="width: 48.2077%; height: 35.4px;">Name of the campaign</td></tr><tr style="height: 35.4px;"><td style="width: 20.5192%; height: 35.4px;">agent

</td><td style="width: 17.4289%; height: 35.4px;">Text</td><td style="width: 13.8443%; height: 35.4px;">Yes</td><td class="align-left" style="width: 48.2077%; height: 35.4px;">Agent's username</td></tr><tr style="height: 35.4px;"><td style="width: 20.5192%; height: 35.4px;">callerid

</td><td style="width: 17.4289%; height: 35.4px;">Text</td><td style="width: 13.8443%; height: 35.4px;">Yes</td><td class="align-left" style="width: 48.2077%; height: 35.4px;">Phone number of the contact</td></tr><tr style="height: 35.4px;"><td style="width: 20.5192%; height: 35.4px;">guid

</td><td style="width: 17.4289%; height: 35.4px;">Text</td><td style="width: 13.8443%; height: 35.4px;">Yes</td><td class="align-left" style="width: 48.2077%; height: 35.4px;">Unique call identifier</td></tr><tr style="height: 35.4px;"><td style="width: 20.5192%; height: 35.4px;">l1

</td><td style="width: 17.4289%; height: 35.4px;">Text</td><td style="width: 13.8443%; height: 35.4px;">Yes</td><td class="align-left" style="width: 48.2077%; height: 35.4px;">Level 1 disposition</td></tr><tr style="height: 35.4px;"><td style="width: 20.5192%; height: 35.4px;">l2

</td><td style="width: 17.4289%; height: 35.4px;">Text</td><td style="width: 13.8443%; height: 35.4px;">Yes</td><td class="align-left" style="width: 48.2077%; height: 35.4px;">Level 2 disposition (Can be empty)</td></tr><tr style="height: 35.4px;"><td style="width: 20.5192%; height: 35.4px;">l3

</td><td style="width: 17.4289%; height: 35.4px;">Text</td><td style="width: 13.8443%; height: 35.4px;">Yes</td><td class="align-left" style="width: 48.2077%; height: 35.4px;">Level 3 disposition (Can be empty)</td></tr><tr style="height: 35.4px;"><td style="width: 20.5192%; height: 35.4px;">d1

</td><td style="width: 17.4289%; height: 35.4px;">Text</td><td style="width: 13.8443%; height: 35.4px;">Yes</td><td class="align-left" style="width: 48.2077%; height: 35.4px;">Extra data to save (Can be empty)</td></tr><tr style="height: 35.4px;"><td style="width: 20.5192%; height: 35.4px;">d2

</td><td style="width: 17.4289%; height: 35.4px;">Text</td><td style="width: 13.8443%; height: 35.4px;">Yes</td><td class="align-left" style="width: 48.2077%; height: 35.4px;">Extra data to save (Can be empty)</td></tr><tr style="height: 35.4px;"><td style="width: 20.5192%; height: 35.4px;">comment

</td><td style="width: 17.4289%; height: 35.4px;">Text</td><td style="width: 13.8443%; height: 35.4px;">Yes</td><td class="align-left" style="width: 48.2077%; height: 35.4px;">Comment for the disposition (Can be empty)</td></tr><tr style="height: 48.8px;"><td style="width: 20.5192%; height: 48.8px;">schedule

</td><td style="width: 17.4289%; height: 48.8px;">Text</td><td style="width: 13.8443%; height: 48.8px;">Yes</td><td class="align-left" style="width: 48.2077%; height: 48.8px;">Date and time to schedule the call in the format AAAA-MM-DD HH:MI:SS (Can be empty)</td></tr><tr style="height: 35.4px;"><td style="width: 20.5192%; height: 35.4px;">camptoreschedule

</td><td style="width: 17.4289%; height: 35.4px;">Text</td><td style="width: 13.8443%; height: 35.4px;">Yes</td><td class="align-left" style="width: 48.2077%; height: 35.4px;">Dialer to schedule the call (Can be empty)</td></tr><tr style="height: 35.4px;"><td style="width: 20.5192%; height: 35.4px;">tag

</td><td style="width: 17.4289%; height: 35.4px;">Text</td><td style="width: 13.8443%; height: 35.4px;">Yes</td><td class="align-left" style="width: 48.2077%; height: 35.4px;">Text for disposition tag or empty (Can be empty)</td></tr></tbody></table>

---

### Code Examples

<p class="callout info">You can copy the following code examples and replace the "{{variable}}" with the correct data.</p>

##### HTTP

```VBScript
POST /Integra/resources/api/DispositionCall HTTP/1.1
Host: {{Instancia}}.ucontactcloud.com
Content-Type: application/x-www-form-urlencoded
Authorization: Basic {{Token}}
Content-Length: 173

campaign=campana-%3E&agent=Vcisneros&callerid=1234567890&guid=f9b7ada3-a4e5-4795-834d-aa1c1a37ee57&l1=Tipificacion1&l2=&l3=&d2=&d2=&comment=&schedule=&camptoreschedule=&tag=
```

##### cURL

```VBScript
curl --location --request POST 'https://{{Instancia}}.ucontactcloud.com/Integra/resources/api/DispositionCall' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Basic {{Token}}' \
--data-urlencode 'campaign=campana->' \
--data-urlencode 'agent=Vcisneros' \
--data-urlencode 'callerid=1234567890' \
--data-urlencode 'guid=f9b7ada3-a4e5-4795-834d-aa1c1a37ee57' \
--data-urlencode 'l1=Tipificacion1' \
--data-urlencode 'l2=' \
--data-urlencode 'l3=' \
--data-urlencode 'd2=' \
--data-urlencode 'd2=' \
--data-urlencode 'comment=' \
--data-urlencode 'schedule=' \
--data-urlencode 'camptoreschedule=' \
--data-urlencode 'tag='
```

##### JavaScript

```JavaScript
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");
myHeaders.append("Authorization", "Basic {{Token}}");

var urlencoded = new URLSearchParams();
urlencoded.append("campaign", "campana->");
urlencoded.append("agent", "Vcisneros");
urlencoded.append("callerid", "1234567890");
urlencoded.append("guid", "f9b7ada3-a4e5-4795-834d-aa1c1a37ee57");
urlencoded.append("l1", "Tipificacion1");
urlencoded.append("l2", "");
urlencoded.append("l3", "");
urlencoded.append("d2", "");
urlencoded.append("d2", "");
urlencoded.append("comment", "");
urlencoded.append("schedule", "");
urlencoded.append("camptoreschedule", "");
urlencoded.append("tag", "");

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

fetch("https://{{Instancia}}.ucontactcloud.com/Integra/resources/api/DispositionCall", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

##### JQuery

```JavaScript
var settings = {
  "url": "https://{{Instancia}}.ucontactcloud.com/Integra/resources/api/DispositionCall",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Content-Type": "application/x-www-form-urlencoded",
    "Authorization": "Basic {{Token}}"
  },
  "data": {
    "campaign": "campana->",
    "agent": "Vcisneros",
    "callerid": "1234567890",
    "guid": "f9b7ada3-a4e5-4795-834d-aa1c1a37ee57",
    "l1": "Tipificacion1",
    "l2": "",
    "l3": "",
    "d2": "",
    "d2": "",
    "comment": "",
    "schedule": "",
    "camptoreschedule": "",
    "tag": ""
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

##### C#

```C#
var client = new RestClient("https://{{Instancia}}.ucontactcloud.com/Integra/resources/api/DispositionCall");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.AddHeader("Authorization", "Basic {{Token}}");
request.AddParameter("campaign", "campana->");
request.AddParameter("agent", "Vcisneros");
request.AddParameter("callerid", "1234567890");
request.AddParameter("guid", "f9b7ada3-a4e5-4795-834d-aa1c1a37ee57");
request.AddParameter("l1", "Tipificacion1");
request.AddParameter("l2", "");
request.AddParameter("l3", "");
request.AddParameter("d2", "");
request.AddParameter("d2", "");
request.AddParameter("comment", "");
request.AddParameter("schedule", "");
request.AddParameter("camptoreschedule", "");
request.AddParameter("tag", "");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
```

##### Java

```Java
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "campaign=campana->&agent=Vcisneros&callerid=1234567890&guid=f9b7ada3-a4e5-4795-834d-aa1c1a37ee57&l1=Tipificacion1&l2=&l3=&d2=&d2=&comment=&schedule=&camptoreschedule=&tag=");
Request request = new Request.Builder()
  .url("https://{{Instancia}}.ucontactcloud.com/Integra/resources/api/DispositionCall")
  .method("POST", body)
  .addHeader("Content-Type", "application/x-www-form-urlencoded")
  .addHeader("Authorization", "Basic {{Token}}")
  .build();
Response response = client.newCall(request).execute();
```

##### Python

```Python
import http.client

conn = http.client.HTTPSConnection("{{Instancia}}.ucontactcloud.com")
payload = 'campaign=campana-%3E&agent=Vcisneros&callerid=1234567890&guid=f9b7ada3-a4e5-4795-834d-aa1c1a37ee57&l1=Tipificacion1&l2=&l3=&d2=&d2=&comment=&schedule=&camptoreschedule=&tag='
headers = {
  'Content-Type': 'application/x-www-form-urlencoded',
  'Authorization': 'Basic {{Token}}'
}
conn.request("POST", "/Integra/resources/api/DispositionCall", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```

---

### HTTP Response

#### Successful Response

```JSON
"OK"
```

#### Error Response

```JSON
"0"
```

# Create Agent

When an integration requires creating users from another platform, we can use this API to create agent-type users so they can make calls.

<p class="callout info">You can check the [Postman Collection](https://www.postman.com/dev-clever-ideas/ucontact/request/s8o7ma2/createagent?tab=overview "Create Agent") to test in your instance.  
</p>

<p class="callout info">All data enclosed in "{{ }}" are values that will be replaced with the client's own data and/or the corresponding instance.</p>

---

### HTTP Request

<table border="1" id="bkmrk-opci%C3%B3n-http-valor-re" style="border-collapse: collapse; width: 100%; height: 89.3907px;"><tbody><tr style="height: 29.7969px;"><td class="align-center" style="width: 22.284%; height: 29.7969px;">**Method**</td><td class="align-center" style="width: 77.8396%; height: 29.7969px;">**Resource**</td></tr><tr style="height: 29.7969px;"><td style="width: 22.284%; height: 29.7969px;">POST</td><td style="width: 77.8396%; height: 29.7969px;">/Integra/resources/sip/addsip</td></tr></tbody></table>

#### Request Header

<table border="1" id="bkmrk-key-value-content-ty" style="border-collapse: collapse; width: 100%; height: 89.3907px;"><tbody><tr style="height: 29.7969px;"><td class="align-center" style="width: 22.284%; height: 29.7969px;">**Key**</td><td class="align-center" style="width: 77.8396%; height: 29.7969px;">**Value**</td></tr><tr style="height: 29.7969px;"><td style="width: 22.284%; height: 29.7969px;">Content-Type</td><td style="width: 77.8396%; height: 29.7969px;">application/x-www-form-urlencoded</td></tr><tr><td style="width: 22.284%;">Authorization</td><td style="width: 77.8396%;">Basic {{Token}}</td></tr></tbody></table>


#### Request Body

<table border="1" id="bkmrk-parametro-tipo-descr" style="border-collapse: collapse; width: 100%; height: 148.562px;"><tbody><tr style="height: 29.7875px;"><td class="align-center" style="width: 21.997%; height: 29.7875px;">**Parameter**</td><td class="align-center" style="width: 17.4327%; height: 29.7875px;">**Type**  
</td><td class="align-center" style="width: 22.3597%; height: 29.7875px;">**Required**</td><td class="align-center" style="width: 38.3094%; height: 29.7875px;">**Description**</td></tr><tr style="height: 29.7875px;"><td style="width: 21.997%; height: 29.7875px;">Phone</td><td class="align-center" style="width: 17.4327%; height: 29.7875px;">Text</td><td class="align-center" style="width: 22.3597%; height: 29.7875px;">Yes</td><td style="width: 38.3094%; height: 29.7875px;">JSON Object</td></tr></tbody></table>

#### JSON Example

<p class="callout info">The data not enclosed in {{ }} will not be modified; they will be sent as fixed data.</p>

```JSON
{
    "LogLevel": "SEVERE",
    "fullname": "{{fullname}}",
    "accountcode": "{{userNameAgent}}",
    "allow": "alaw;ulaw",
    "callerid": "{{phoneNumber}}",
    "id": 407,
    "context": "agentes",
    "defaultuser": "{{phoneNumber}}",
    "did": "",
    "disallow": "all",
    "dtmfmode": "rfc2833",
    "email": "",
    "encryption": "yes",
    "canreinvite": "",
    "insecure": "",
    "host": "dynamic",
    "language": "es",
    "mailbox": "",
    "name": "{{phoneNumber}}",
    "nat": "yes",
    "phonetype": "SoftPhone",
    "pickupgroup": "",
    "callgroup": "",
    "qualify": "yes",
    "record": "agent",
    "secret": "{{passwordAgent}}",
    "subscribecontext": "default",
    "transport": "wss",
    "port": "",
    "outboundproxy": "",
    "type": "friend",
    "limite": "0"
}
```

#### JSON Object description

<table border="1" id="bkmrk-parameter-type-requi" style="border-collapse: collapse; width: 100%; height: 148.562px;"><tbody><tr style="height: 29.7875px;"><td class="align-center" style="width: 33.3663%; height: 29.7875px;">**Parameter**</td><td class="align-center" style="width: 14.2116%; height: 29.7875px;">**Type**  
</td><td class="align-center" style="width: 14.2116%; height: 29.7875px;">**Required**</td><td class="align-center" style="width: 38.3094%; height: 29.7875px;">**Description**</td></tr><tr style="height: 29.7875px;"><td style="width: 33.3663%; height: 29.7875px;">userName</td><td style="width: 14.2116%; height: 29.7875px;">Text</td><td class="align-center" style="width: 14.2116%; height: 29.7875px;">Yes</td><td style="width: 38.3094%; height: 29.7875px;">Agent's username</td></tr><tr style="height: 29.7875px;"><td style="width: 33.3663%; height: 29.7875px;">password</td><td style="width: 14.2116%; height: 29.7875px;">Text</td><td style="width: 14.2116%; height: 29.7875px;">Yes</td><td style="width: 38.3094%; height: 29.7875px;">User's password</td></tr><tr style="height: 29.6px;"><td style="width: 33.3663%; height: 29.6px;">fullname</td><td style="width: 14.2116%; height: 29.6px;">Text</td><td style="width: 14.2116%; height: 29.6px;">Yes</td><td style="width: 38.3094%; height: 29.6px;">Agent´s full name</td></tr><tr style="height: 29.6px;"><td style="width: 33.3663%; height: 29.6px;"><div><div>phoneNumber</div></div></td><td style="width: 14.2116%; height: 29.6px;">Text</td><td style="width: 14.2116%; height: 29.6px;">Yes</td><td style="width: 38.3094%; height: 29.6px;">Agent's phone number (Unique Data)</td></tr></tbody></table>

---

### Code Examples

<p class="callout info">You can copy the following code examples and replace the "{{variable}}" with the correct data.</p>

#### HTTP

```HTTP
POST /Integra/resources/sip/addsip HTTP/1.1
Host: {{dominio}}.ucontactcloud.com
Content-Type: application/x-www-form-urlencoded
Authorization: Basic {{Token}}
Content-Length: 1228

phone={ "LogLevel": "SEVERE", "fullname": "{{fullname}}", "accountcode": "{{userName}}", "allow": "alaw;ulaw", "callerid": "{{phoneNumber}}", "id": 407, "context": "agentes", "defaultuser": "{{phoneNumber}}", "did": "", "disallow": "all", "dtmfmode": "rfc2833", "email": "", "encryption": "yes", "canreinvite": "", "insecure": "", "host": "dynamic", "language": "es", "mailbox": "", "name": "{{phoneNumber}}", "nat": "yes", "phonetype": "SoftPhone", "pickupgroup": "", "callgroup": "", "qualify": "yes", "record": "agent", "secret": "{{password}}", "subscribecontext": "default", "transport": "wss", "port": "", "outboundproxy": "", "type": "friend", "limite": "0" }
```

##### cURL

```cURL
curl --location --globoff 'https://{{dominio}}.ucontactcloud.com/Integra/resources/sip/addsip' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Basic {{Token}}' \
--data-urlencode 'phone={ "LogLevel": "SEVERE", "fullname": "{{fullname}}", "accountcode": "{{userName}}", "allow": "alaw;ulaw", "callerid": "{{phoneNumber}}", "id": 407, "context": "agentes", "defaultuser": "{{phoneNumber}}", "did": "", "disallow": "all", "dtmfmode": "rfc2833", "email": "", "encryption": "yes", "canreinvite": "", "insecure": "", "host": "dynamic", "language": "es", "mailbox": "", "name": "{{phoneNumber}}", "nat": "yes", "phonetype": "SoftPhone", "pickupgroup": "", "callgroup": "", "qualify": "yes", "record": "agent", "secret": "{{password}}", "subscribecontext": "default", "transport": "wss", "port": "", "outboundproxy": "", "type": "friend", "limite": "0" }'
```

##### JavaScript

```JavaScript
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");
myHeaders.append("Authorization", "Basic VmNpc25lcm9zOjdjMjUyODAyLTljNGEtNDcyZi05MjJiLTQwNGFmY2JjM2Q2MA==");

const urlencoded = new URLSearchParams();
urlencoded.append("phone", "{ \"LogLevel\": \"SEVERE\", \"fullname\": \"{{fullname}}\", \"accountcode\": \"{{userName}}\", \"allow\": \"alaw;ulaw\", \"callerid\": \"{{phoneNumber}}\", \"id\": 407, \"context\": \"agentes\", \"defaultuser\": \"{{phoneNumber}}\", \"did\": \"\", \"disallow\": \"all\", \"dtmfmode\": \"rfc2833\", \"email\": \"\", \"encryption\": \"yes\", \"canreinvite\": \"\", \"insecure\": \"\", \"host\": \"dynamic\", \"language\": \"es\", \"mailbox\": \"\", \"name\": \"{{phoneNumber}}\", \"nat\": \"yes\", \"phonetype\": \"SoftPhone\", \"pickupgroup\": \"\", \"callgroup\": \"\", \"qualify\": \"yes\", \"record\": \"agent\", \"secret\": \"{{password}}\", \"subscribecontext\": \"default\", \"transport\": \"wss\", \"port\": \"\", \"outboundproxy\": \"\", \"type\": \"friend\", \"limite\": \"0\" }");

const requestOptions = {
  method: "POST",
  headers: myHeaders,
  body: urlencoded,
  redirect: "follow"
};

fetch("https://{{dominio}}.ucontactcloud.com/Integra/resources/sip/addsip", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
```

##### JQuery

```JavaScript
var settings = {
  "url": "https://{{dominio}}.ucontactcloud.com/Integra/resources/sip/addsip",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Content-Type": "application/x-www-form-urlencoded",
    "Authorization": "Basic {{Token}}"
  },
  "data": {
    "phone": "{ \"LogLevel\": \"SEVERE\", \"fullname\": \"{{fullname}}\", \"accountcode\": \"{{userName}}\", \"allow\": \"alaw;ulaw\", \"callerid\": \"{{phoneNumber}}\", \"id\": 407, \"context\": \"agentes\", \"defaultuser\": \"{{phoneNumber}}\", \"did\": \"\", \"disallow\": \"all\", \"dtmfmode\": \"rfc2833\", \"email\": \"\", \"encryption\": \"yes\", \"canreinvite\": \"\", \"insecure\": \"\", \"host\": \"dynamic\", \"language\": \"es\", \"mailbox\": \"\", \"name\": \"{{phoneNumber}}\", \"nat\": \"yes\", \"phonetype\": \"SoftPhone\", \"pickupgroup\": \"\", \"callgroup\": \"\", \"qualify\": \"yes\", \"record\": \"agent\", \"secret\": \"{{password}}\", \"subscribecontext\": \"default\", \"transport\": \"wss\", \"port\": \"\", \"outboundproxy\": \"\", \"type\": \"friend\", \"limite\": \"0\" }"
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

##### C#

```C#
var options = new RestClientOptions("https://{{dominio}}.ucontactcloud.com")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/Integra/resources/sip/addsip", Method.Post);
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.AddHeader("Authorization", "Basic {{Token}}");
request.AddParameter("phone", "{ \"LogLevel\": \"SEVERE\", \"fullname\": \"{{fullname}}\", \"accountcode\": \"{{userName}}\", \"allow\": \"alaw;ulaw\", \"callerid\": \"{{phoneNumber}}\", \"id\": 407, \"context\": \"agentes\", \"defaultuser\": \"{{phoneNumber}}\", \"did\": \"\", \"disallow\": \"all\", \"dtmfmode\": \"rfc2833\", \"email\": \"\", \"encryption\": \"yes\", \"canreinvite\": \"\", \"insecure\": \"\", \"host\": \"dynamic\", \"language\": \"es\", \"mailbox\": \"\", \"name\": \"{{phoneNumber}}\", \"nat\": \"yes\", \"phonetype\": \"SoftPhone\", \"pickupgroup\": \"\", \"callgroup\": \"\", \"qualify\": \"yes\", \"record\": \"agent\", \"secret\": \"{{password}}\", \"subscribecontext\": \"default\", \"transport\": \"wss\", \"port\": \"\", \"outboundproxy\": \"\", \"type\": \"friend\", \"limite\": \"0\" }");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);
```

##### Java

```Java
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "phone={ \"LogLevel\": \"SEVERE\", \"fullname\": \"{{fullname}}\", \"accountcode\": \"{{userName}}\", \"allow\": \"alaw;ulaw\", \"callerid\": \"{{phoneNumber}}\", \"id\": 407, \"context\": \"agentes\", \"defaultuser\": \"{{phoneNumber}}\", \"did\": \"\", \"disallow\": \"all\", \"dtmfmode\": \"rfc2833\", \"email\": \"\", \"encryption\": \"yes\", \"canreinvite\": \"\", \"insecure\": \"\", \"host\": \"dynamic\", \"language\": \"es\", \"mailbox\": \"\", \"name\": \"{{phoneNumber}}\", \"nat\": \"yes\", \"phonetype\": \"SoftPhone\", \"pickupgroup\": \"\", \"callgroup\": \"\", \"qualify\": \"yes\", \"record\": \"agent\", \"secret\": \"{{password}}\", \"subscribecontext\": \"default\", \"transport\": \"wss\", \"port\": \"\", \"outboundproxy\": \"\", \"type\": \"friend\", \"limite\": \"0\" }");
Request request = new Request.Builder()
  .url("https://{{dominio}}.ucontactcloud.com/Integra/resources/sip/addsip")
  .method("POST", body)
  .addHeader("Content-Type", "application/x-www-form-urlencoded")
  .addHeader("Authorization", "Basic {{Token}}")
  .build();
Response response = client.newCall(request).execute();
```

##### Python

```Python
import http.client

conn = http.client.HTTPSConnection("{{dominio}}.ucontactcloud.com")
payload = 'phone={ "LogLevel": "SEVERE", "fullname": "{{fullname}}", "accountcode": "{{userName}}", "allow": "alaw;ulaw", "callerid": "{{phoneNumber}}", "id": 407, "context": "agentes", "defaultuser": "{{phoneNumber}}", "did": "", "disallow": "all", "dtmfmode": "rfc2833", "email": "", "encryption": "yes", "canreinvite": "", "insecure": "", "host": "dynamic", "language": "es", "mailbox": "", "name": "{{phoneNumber}}", "nat": "yes", "phonetype": "SoftPhone", "pickupgroup": "", "callgroup": "", "qualify": "yes", "record": "agent", "secret": "{{password}}", "subscribecontext": "default", "transport": "wss", "port": "", "outboundproxy": "", "type": "friend", "limite": "0" }'
headers = {
  'Content-Type': 'application/x-www-form-urlencoded',
  'Authorization': 'Basic {{Token}}'
}
conn.request("POST", "/Integra/resources/sip/addsip", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```

---

### HTTP Response

<p class="callout warning">Responses indicating an error due to the sent data will generally be delivered with an HTTP 200 code and a "0" or "1" in the body of the response, so caution should be exercised when validating the HTTP Response Code.</p>

<p class="callout warning">The received response is in text format, so it will need to be converted to JSON to view the data correctly.</p>

#### Successful Response

```JSON
1
```

#### Error Response

```JavaScript
0
```

# Add Agent to Campaign

When integration requires it, agents can be added to a specific campaign through this API. Below, we outline how to perform this action.

<p class="callout info">You can check the [Postman Collection](https://www.postman.com/dev-clever-ideas/ucontact/request/wfrw3il/addagenttocampaign?tab=overview "Add Aget To Campaign") to test in your instance.</p>

<p class="callout info">All data enclosed in "{{ }}" are values that will be replaced with the client's own data and/or the corresponding instance.</p>

---

### HTTP Request

<table border="1" id="bkmrk-opci%C3%B3n-http-valor-re" style="border-collapse: collapse; width: 100%; height: 89.3907px;"><tbody><tr style="height: 29.7969px;"><td class="align-center" style="width: 22.284%; height: 29.7969px;">**Method**</td><td class="align-center" style="width: 77.8396%; height: 29.7969px;">**Resource**</td></tr><tr style="height: 29.7969px;"><td style="width: 22.284%; height: 29.7969px;">POST</td><td style="width: 77.8396%; height: 29.7969px;">/Integra/resources/queues/addqueuemember</td></tr></tbody></table>

#### Request Header

<table border="1" id="bkmrk-key-value-content-ty" style="border-collapse: collapse; width: 100%; height: 89.3907px;"><tbody><tr style="height: 29.7969px;"><td class="align-center" style="width: 22.284%; height: 29.7969px;">**Key**</td><td class="align-center" style="width: 77.8396%; height: 29.7969px;">**Value**</td></tr><tr style="height: 29.7969px;"><td style="width: 22.284%; height: 29.7969px;">Content-Type</td><td style="width: 77.8396%; height: 29.7969px;">application/x-www-form-urlencoded</td></tr><tr><td style="width: 22.284%;">Authorization</td><td style="width: 77.8396%;">Basic {{Token}}</td></tr></tbody></table>

#### Request Body

<table border="1" id="bkmrk-parametro-tipo-descr" style="border-collapse: collapse; width: 100%; height: 59.575px;"><tbody><tr style="height: 29.7875px;"><td class="align-center" style="width: 22.4913%; height: 29.7875px;">**Parameter**</td><td class="align-center" style="width: 17.9194%; height: 29.7875px;">**Type**  
</td><td class="align-center" style="width: 59.5645%; height: 29.7875px;">**Description**</td></tr><tr style="height: 29.7875px;"><td style="width: 22.4913%; height: 29.7875px;">queuemember</td><td style="width: 17.9194%; height: 29.7875px;">Text (String)</td><td style="width: 59.5645%; height: 29.7875px;">An array of objects, where multiple users can be added to multiple campaigns; each object represents a user added to a campaign.</td></tr></tbody></table>

#### JSON Example

```JSON
[
    {
        "membername": "{{UserName}}",
        "queueName": "{{CampaignName}}",
        "interface1": "SIP/{{AgentPhoneNumber}}",
        "penalty": 0,
        "paused": 0
    }
]
```

#### JSON Description

<table border="1" id="bkmrk-parametro-tipo-descr-0" style="border-collapse: collapse; width: 100%; height: 89.3907px;"><tbody><tr style="height: 29.7969px;"><td class="align-center" style="width: 22.6149%; height: 29.7969px;">**Parameter**</td><td class="align-center" style="width: 17.6718%; height: 29.7969px;">**Type**  
</td><td class="align-center" style="width: 59.6886%; height: 29.7969px;">**Description**</td></tr><tr style="height: 29.7969px;"><td style="width: 22.6149%; height: 29.7969px;">UserName</td><td style="width: 17.6718%; height: 29.7969px;">Text (String)</td><td style="width: 59.6886%; height: 29.7969px;">Agent's username</td></tr><tr style="height: 29.7969px;"><td style="width: 22.6149%; height: 29.7969px;">CampaignName</td><td style="width: 17.6718%; height: 29.7969px;">Text (String)</td><td style="width: 59.6886%; height: 29.7969px;">Name of the campaign to which the user wishes to be added</td></tr><tr><td style="width: 22.6149%;"><div><div>PhoneNumber</div></div></td><td style="width: 17.6718%;">Text (String)</td><td style="width: 59.6886%;">Agent's phone number</td></tr></tbody></table>

---

### Code Examples

<p class="callout info">You can copy the following code examples and replace the "{{variable}}" with the correct data.</p>

#### HTTP

```HTTP
POST /Integra/resources/queues/addqueuemember HTTP/1.1
Host: {{domain}}.ucontactcloud.com
Content-Type: application/x-www-form-urlencoded
Authorization: Basic {{Token}}
Content-Length: 221

queuemember=[{"membername":"{{UserName}}","queueName":"{{CampaignName}}","interface1":"SIP/{{AgentPhoneNumber}}","penalty":0,"paused":0}]
```

##### cURL

```cURL
curl --location --globoff 'https://{{domain}}.ucontactcloud.com/Integra/resources/queues/addqueuemember' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Basic {{Token}}' \
--data-urlencode 'queuemember=[{"membername":"{{UserName}}","queueName":"{{CampaignName}}","interface1":"SIP/{{AgentPhoneNumber}}","penalty":0,"paused":0}]'
```

##### JavaScript

```JavaScript
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");
myHeaders.append("Authorization", "Basic {{Token}}");

const urlencoded = new URLSearchParams();
urlencoded.append("queuemember", "[{\"membername\":\"{{UserName}}\",\"queueName\":\"{{CampaignName}}\",\"interface1\":\"SIP/{{AgentPhoneNumber}}\",\"penalty\":0,\"paused\":0}]");

const requestOptions = {
  method: "POST",
  headers: myHeaders,
  body: urlencoded,
  redirect: "follow"
};

fetch("https://{{domain}}.ucontactcloud.com/Integra/resources/queues/addqueuemember", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
```

##### JQuery

```JavaScript
var settings = {
  "url": "https://{{domain}}.ucontactcloud.com/Integra/resources/queues/addqueuemember",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Content-Type": "application/x-www-form-urlencoded",
    "Authorization": "Basic {{Token}}"
  },
  "data": {
    "queuemember": "[{\"membername\":\"{{UserName}}\",\"queueName\":\"{{CampaignName}}\",\"interface1\":\"SIP/{{AgentPhoneNumber}}\",\"penalty\":0,\"paused\":0}]"
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

##### C#

```C#
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://{{domain}}.ucontactcloud.com/Integra/resources/queues/addqueuemember");
request.Headers.Add("Authorization", "Basic {{Token}}");
var collection = new List<KeyValuePair<string, string>>();
collection.Add(new("queuemember", "[{\"membername\":\"{{UserName}}\",\"queueName\":\"{{CampaignName}}\",\"interface1\":\"SIP/{{AgentPhoneNumber}}\",\"penalty\":0,\"paused\":0}]"));
var content = new FormUrlEncodedContent(collection);
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());

```

##### Java

```Java
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "queuemember=[{\"membername\":\"{{UserName}}\",\"queueName\":\"{{CampaignName}}\",\"interface1\":\"SIP/{{AgentPhoneNumber}}\",\"penalty\":0,\"paused\":0}]");
Request request = new Request.Builder()
  .url("https://{{domain}}.ucontactcloud.com/Integra/resources/queues/addqueuemember")
  .method("POST", body)
  .addHeader("Content-Type", "application/x-www-form-urlencoded")
  .addHeader("Authorization", "Basic {{Token}}")
  .build();
Response response = client.newCall(request).execute();
```

##### Python

```Python
import http.client

conn = http.client.HTTPSConnection("{{domain}}.ucontactcloud.com")
payload = 'queuemember=[{"membername":"{{UserName}}","queueName":"{{CampaignName}}","interface1":"SIP/{{AgentPhoneNumber}}","penalty":0,"paused":0}]'
headers = {
  'Content-Type': 'application/x-www-form-urlencoded',
  'Authorization': 'Basic {{Token}}'
}
conn.request("POST", "/Integra/resources/queues/addqueuemember", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```

---

### HTTP Response

<p class="callout warning">Responses indicating an error due to the sent data will generally be delivered with an HTTP 200 code and a "0" or "1" in the body of the response, so caution should be exercised when validating the HTTP Response Code.</p>

<p class="callout warning">The received response is in text format, so it will need to be converted to JSON to view the data correctly.</p>

#### Successful Response

```JSON
1
```

#### Error Response

```JavaScript
0
```

# Make a Call

In some cases, it is necessary for an agent to initiate a call to a phone number from another application, such as a CRM. This API can be used, and the call will be directed to the agent.

<p class="callout info">You can check the [Colección de Postman](https://www.postman.com/dev-clever-ideas/ucontact/request/lly7qi2/agentcall?tab=overview "Agent Call") to see an example and test it with your instance.</p>

<p class="callout info">All data enclosed in {{ }} are values that will be replaced with the client's own data and/or the corresponding instance.</p>

---

### HTTP Request

<table border="1" id="bkmrk-opci%C3%B3n-http-valor-re" style="border-collapse: collapse; width: 100%; height: 89.3625px;"><tbody><tr style="height: 29.7875px;"><td class="align-center" style="width: 22.284%; height: 29.7875px;">**Method**</td><td class="align-center" style="width: 77.8396%; height: 29.7875px;">**Resource**</td></tr><tr style="height: 29.7875px;"><td style="width: 22.284%; height: 29.7875px;">POST</td><td style="width: 77.8396%; height: 29.7875px;">/Integra/resources/Agents/AgentCall</td></tr></tbody></table>

#### Request Header


<table border="1" id="bkmrk-opcion-valor-content" style="width: 116.914%; height: 107px;"><tbody><tr><td class="align-center" style="width: 22.3747%;">**Opcion**</td><td class="align-center" style="width: 77.7241%;">**Valor**</td></tr><tr><td style="width: 22.3747%;">Content-Type</td><td style="width: 77.7241%;">application/x-www-form-urlencoded</td></tr><tr><td style="width: 22.3747%;">Authorization</td><td style="width: 77.7241%;">Basic {{Token}}</td></tr></tbody></table>

#### Request Body

<table border="1" id="bkmrk-parametro-tipo-descr" style="border-collapse: collapse; width: 100%; height: 279.788px;"><tbody><tr style="height: 29.7875px;"><td class="align-center" style="width: 21.997%; height: 29.7875px;">**Parametro**</td><td class="align-center" style="width: 13.4701%; height: 29.7875px;">**Tipo**  
</td><td style="width: 14.5867%; height: 29.7875px;">**Requerido**</td><td class="align-center" style="width: 50.045%; height: 29.7875px;">**Descripción**</td></tr><tr style="height: 46.4px;"><td style="width: 21.997%; height: 46.4px;">callerid</td><td style="width: 13.4701%; height: 46.4px;">Número</td><td class="align-center" style="width: 14.5867%; height: 46.4px;">Si</td><td style="width: 50.045%; height: 46.4px;">DID assigned to the campaign from which the call will be made.</td></tr><tr style="height: 29.6px;"><td style="width: 21.997%; height: 29.6px;">agent</td><td style="width: 13.4701%; height: 29.6px;">Texto</td><td class="align-center" style="width: 14.5867%; height: 29.6px;">Si</td><td style="width: 50.045%; height: 29.6px;">Agent who will take the call.</td></tr><tr style="height: 34.4px;"><td style="width: 21.997%; height: 34.4px;"><div><span class="Text__TextContainer-sc-1kqigik-0 ggvUCn sc-fznXWL cEvDCP item-key" data-aether-id="aether-text" data-click="" data-testid="aether-text">phone</span></div></td><td style="width: 13.4701%; height: 34.4px;">Número</td><td class="align-center" style="width: 14.5867%; height: 34.4px;">Si</td><td style="width: 50.045%; height: 34.4px;">Agent's phone number.</td></tr><tr style="height: 29.6px;"><td style="width: 21.997%; height: 29.6px;">tech</td><td style="width: 13.4701%; height: 29.6px;">Texto</td><td class="align-center" style="width: 14.5867%; height: 29.6px;">Si</td><td style="width: 50.045%; height: 29.6px;">Communication protocol, add SIP.  
</td></tr><tr style="height: 46.4px;"><td style="width: 21.997%; height: 46.4px;">context</td><td style="width: 13.4701%; height: 46.4px;">Texto</td><td class="align-center" style="width: 14.5867%; height: 46.4px;">Si</td><td style="width: 50.045%; height: 46.4px;">Name of the context for flows from which the call will exit; it can be 'agentes' or 'agents.'  
</td></tr><tr style="height: 29.6px;"><td style="width: 21.997%; height: 29.6px;">outqueue</td><td style="width: 13.4701%; height: 29.6px;">Texto</td><td class="align-center" style="width: 14.5867%; height: 29.6px;">Si</td><td style="width: 50.045%; height: 29.6px;">Name of the manual campaign.  
</td></tr><tr style="height: 34px;"><td style="width: 21.997%; height: 34px;">destination</td><td style="width: 13.4701%; height: 34px;">Número</td><td class="align-center" style="width: 14.5867%; height: 34px;">Si</td><td style="width: 50.045%; height: 34px;">Name of the campaign for which the call will be generated.

</td></tr></tbody></table>

---

### Code Examples

<p class="callout info">You can copy the following code examples and replace the "{{variable}}" with the correct data.</p>

#### HTTP

```HTTP
POST /Integra/resources/Agents/AgentCall HTTP/1.1
Host: {{instance}}.ucontactcloud.com
Authorization: Basic {{Token}}
Content-Type: application/x-www-form-urlencoded
Content-Length: 116

callerid={{callerid}}agent={{agent}}&phone={{phone}}&tech=SIP&context={{context}}&outqueue={{outqueue}}&destination={{destination}}
```

##### cURL

```cURL
curl --location 'https://{{instance}}.ucontactcloud.com/Integra/resources/Agents/AgentCall' \
--header 'Authorization: Basic {{Token}}' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'callerid={{callerid}}' \
--data-urlencode 'agent={{agent}}' \
--data-urlencode 'phone={{phone}}' \
--data-urlencode 'tech=SIP' \
--data-urlencode 'context={{context}}' \
--data-urlencode 'outqueue={{outqueue}}' \
--data-urlencode 'destination={{destination}}'
```

##### JavaScript

```JavaScript
const myHeaders = new Headers();
myHeaders.append("Authorization", "Basic {{Token}}");
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");

const urlencoded = new URLSearchParams();
urlencoded.append("callerid", "{{callerid}}");
urlencoded.append("agent", "{{agent}}");
urlencoded.append("phone", "{{phone}}");
urlencoded.append("tech", "SIP");
urlencoded.append("context", "{{context}}");
urlencoded.append("outqueue", "{{outqueue}}");
urlencoded.append("destination", "{{destination}}");

const requestOptions = {
  method: "POST",
  headers: myHeaders,
  body: urlencoded,
  redirect: "follow"
};

fetch("https://{{instance}}.ucontactcloud.com/Integra/resources/Agents/AgentCall", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
```

##### JQuery

```JavaScript
var settings = {
  "url": "https://{{instance}}.ucontactcloud.com/Integra/resources/Agents/AgentCall",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Authorization": "Basic {{Token}}",
    "Content-Type": "application/x-www-form-urlencoded"
  },
  "data": {
    "callerid": "{{callerid}}",
    "agent": "{{agent}}",
    "phone": "{{phone}}",
    "tech": "SIP",
    "context": "{{context}}",
    "outqueue": "{{outqueue}}",
    "destination": "{{destination}}"
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

##### C#

```C#
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://{{instance}}.ucontactcloud.com/Integra/resources/Agents/AgentCall");
request.Headers.Add("Authorization", "Basic {{Token}}");
var collection = new List<KeyValuePair<string, string>>();
collection.Add(new("callerid", "{{callerid}}"));
collection.Add(new("agent", "{{agent}}"));
collection.Add(new("phone", "{{phone}}"));
collection.Add(new("tech", "SIP"));
collection.Add(new("context", "{{context}}"));
collection.Add(new("outqueue", "{{outqueue}}"));
collection.Add(new("destination", "{{destination}}"));
var content = new FormUrlEncodedContent(collection);
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());

```

##### Java

```Java
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "callerid={{callerid}}&agent={{agent}}&phone={{phone}}&tech=SIP&context={{context}}&outqueue={{outqueue}}&destination={{destination}}");
Request request = new Request.Builder()
  .url("https://{{instance}}.ucontactcloud.com/Integra/resources/Agents/AgentCall")
  .method("POST", body)
  .addHeader("Authorization", "Basic {{Token}}")
  .addHeader("Content-Type", "application/x-www-form-urlencoded")
  .build();
Response response = client.newCall(request).execute();
```

##### Python

```Python
import http.client

conn = http.client.HTTPSConnection("{{instance}}.ucontactcloud.com")
payload = 'callerid={{callerid}}&agent={{agent}}&phone={{phone}}&tech=SIP&context={{context}}&outqueue={{outqueue}}&destination={{destination}}'
headers = {
  'Authorization': 'Basic {{Token}}',
  'Content-Type': 'application/x-www-form-urlencoded'
}
conn.request("POST", "/Integra/resources/Agents/AgentCall", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```

---

### HTTP Response

<p class="callout warning">Responses in which an error occurred due to the data sent will generally be returned with an HTTP code 200 and a '0' in the response body; therefore, caution should be exercised when validating by the HTTP Code Response.</p>

<p class="callout info">The successful response will be a GUID as the call identifier; this data can be used for future actions through APIs.</p>

#### Successful response.

```XML
8cf8570e-60e7-44ed-b799-3baab211b04d
```

#### Error response.

```JavaScript
0
```

# Get Campaigns

To obtain all campaigns created within uContact, this API can be used, which returns the totality of Dialers and Queues.

<p class="callout info">You can check the [Colección de Postman](https://www.postman.com/dev-clever-ideas/ucontact/request/3q6h235/getqueues?tab=overview "Get Queues") to see an example and test it with your instance.</p>

<p class="callout info">All data enclosed in {{ }} are values that will be replaced with the client's own data and/or the corresponding instance.</p>

---

### HTTP Request

<table border="1" id="bkmrk-opci%C3%B3n-http-valor-re" style="border-collapse: collapse; width: 100%; height: 89.3625px;"><tbody><tr style="height: 29.7875px;"><td class="align-center" style="width: 22.284%; height: 29.7875px;">**Method**</td><td class="align-center" style="width: 77.8396%; height: 29.7875px;">**Resource**</td></tr><tr style="height: 29.7875px;"><td style="width: 22.284%; height: 29.7875px;">POST</td><td style="width: 77.8396%; height: 29.7875px;">/Integra/resources/queues/getqueues</td></tr></tbody></table>

#### Request Header


<table border="1" id="bkmrk-opcion-valor-content" style="width: 116.914%; height: 107px;"><tbody><tr><td class="align-center" style="width: 22.3747%;">**Key**</td><td class="align-center" style="width: 77.7241%;">**Value**</td></tr><tr><td style="width: 22.3747%;">Content-Type</td><td style="width: 77.7241%;">application/x-www-form-urlencoded</td></tr><tr><td style="width: 22.3747%;">Authorization</td><td style="width: 77.7241%;">Basic {{Token}}</td></tr></tbody></table>

#### Request Body

<table border="1" id="bkmrk-parametro-tipo-descr" style="border-collapse: collapse; width: 100%; height: 60.1875px;"><tbody><tr style="height: 29.7875px;"><td class="align-center" style="width: 21.997%; height: 29.7875px;">**Parameter**</td><td class="align-center" style="width: 13.4701%; height: 29.7875px;">**Type**  
</td><td class="align-center" style="width: 14.5867%; height: 29.7875px;">**Required**</td><td class="align-center" style="width: 50.045%; height: 29.7875px;">**Description**</td></tr><tr style="height: 30.4px;"><td style="width: 21.997%; height: 30.4px;">lastrow</td><td style="width: 13.4701%; height: 30.4px;">Text</td><td class="align-center" style="width: 14.5867%; height: 30.4px;">No</td><td style="width: 50.045%; height: 30.4px;">Send empty</td></tr></tbody></table>

---

### Code Examples

<p class="callout info">You can copy the following code examples and replace the "{{variable}}" with the correct data.</p>

#### HTTP

```HTTP
POST /Integra/resources/queues/getqueues HTTP/1.1
Host: {{instance}}.ucontactcloud.com
Content-Type: application/x-www-form-urlencoded
Authorization: Basic {{Token}}
Content-Length: 8

lastrow=
```

##### cURL

```cURL
curl --location --globoff 'https://{{instance}}.ucontactcloud.com/Integra/resources/queues/getqueues' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Basic {{Token}}' \
--data-urlencode 'lastrow='
```

##### JavaScript

```JavaScript
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");
myHeaders.append("Authorization", "Basic {{Token}}");

const urlencoded = new URLSearchParams();
urlencoded.append("lastrow", "");

const requestOptions = {
  method: "POST",
  headers: myHeaders,
  body: urlencoded,
  redirect: "follow"
};

fetch("https://{{instance}}.ucontactcloud.com/Integra/resources/queues/getqueues", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
```

##### JQuery

```JavaScript
var settings = {
  "url": "https://{{instance}}.ucontactcloud.com/Integra/resources/queues/getqueues",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Content-Type": "application/x-www-form-urlencoded",
    "Authorization": "Basic {{Token}}"
  },
  "data": {
    "lastrow": ""
  }
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

##### C#

```C#
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://{{instance}}.ucontactcloud.com/Integra/resources/queues/getqueues");
request.Headers.Add("Authorization", "Basic {{Token}}");
var collection = new List<KeyValuePair<string, string>>();
collection.Add(new("lastrow", ""));
var content = new FormUrlEncodedContent(collection);
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());

```

##### Java

```Java
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "lastrow=");
Request request = new Request.Builder()
  .url("https://{{instance}}.ucontactcloud.com/Integra/resources/queues/getqueues")
  .method("POST", body)
  .addHeader("Content-Type", "application/x-www-form-urlencoded")
  .addHeader("Authorization", "Basic {{Token}}")
  .build();
Response response = client.newCall(request).execute();
```

##### Python

```Python
import http.client

conn = http.client.HTTPSConnection("{{instance}}.ucontactcloud.com")
payload = 'lastrow='
headers = {
  'Content-Type': 'application/x-www-form-urlencoded',
  'Authorization': 'Basic {{Token}}'
}
conn.request("POST", "/Integra/resources/queues/getqueues", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```

---

### HTTP Response

<p class="callout warning">Responses in which an error occurred due to the sent data will generally be delivered with an HTTP code 200 and a '0' in the response body; therefore, caution should be taken when validating the HTTP Code Response.</p>

<p class="callout info">The successful response will be a JSON corresponding to an array of objects, where each object represents a campaign.</p>

#### Respuesta exitosa

```JSON
[
	{
        "name": "DEMO007->",
        "musiconhold": "default",
        "announce": "",
        "context": "",
        "timeout": 15,
        "monitorType": "MixMonitor",
        "monitorFormat": "gsm",
        "announceFrequency": 0,
        "announceRoundSeconds": 0,
        "announceHoldtime": "no",
        "announcePosition": "no",
        "retry": 3,
        "wrapuptime": 0,
        "maxlen": 100,
        "servicelevel": 15,
        "strategy": "linear",
        "joinempty": "yes",
        "leavewhenempty": "no",
        "eventmemberstatus": false,
        "eventwhencalled": true,
        "reportholdtime": false,
        "memberdelay": 0,
        "weight": 0,
        "timeoutrestart": true,
        "ringinuse": false,
        "setinterfacevar": true,
        "periodicAnnounce": "",
        "periodicAnnounceFrequency": "0",
        "did": "18885751288",
        "direction": "outbound",
        "interactions": "",
        "email": "",
        "thresholds": "40-80-20-50-60-180-300-6-3-",
        "welcome": "&  &    &  &;&  &    &  &",
        "schedule": "sun-sat;00:00-23:59",
        "form": "Totality|true",
        "quality": "",
        "dialstring": "SIP/CLEVERSIP/9898",
        "voicemail": "",
        "queue_survey": 1,
        "queue_timeout": 600,
        "auto_answer": "FALSE",
        "show_dispositions": 1,
        "queue_breaks": "",
        "screen_recording": 0,
        "language": "en",
        "transferCampaigns": ""
    }
]
```

#### Respuesta de error

```JavaScript
0
```

# Get Dialers

To obtain the list of uContact dialers, this API needs to be used. For example, if we want to create a dropdown menu from another application to display the dialers and perform a specific action.

<p class="callout info">You can check the [Colección de Postman](https://www.postman.com/dev-clever-ideas/ucontact/request/5gymbfm/getdialers?tab=overview "Get Dialers") to see an example and test it with your instance.</p>

<p class="callout info">All data enclosed in {{ }} are values that will be replaced with the client's own data and/or the corresponding instance.</p>

---

### HTTP Request

<table border="1" id="bkmrk-opci%C3%B3n-http-valor-re" style="border-collapse: collapse; width: 100%; height: 59.575px;"><tbody><tr style="height: 29.7875px;"><td class="align-center" style="width: 22.284%; height: 29.7875px;">**Method**</td><td class="align-center" style="width: 77.8396%; height: 29.7875px;">**Resource**</td></tr><tr style="height: 29.7875px;"><td style="width: 22.284%; height: 29.7875px;">POST</td><td style="width: 77.8396%; height: 29.7875px;">/Integra/resources/Dialers/get</td></tr></tbody></table>

#### Request Header


<table border="1" id="bkmrk-opcion-valor-content" style="width: 116.914%; height: 107px;"><tbody><tr><td class="align-center" style="width: 22.3747%;">**Key**</td><td class="align-center" style="width: 77.7241%;">**Value**</td></tr><tr><td style="width: 22.3747%;">Authorization</td><td style="width: 77.7241%;">Basic {{Token}}</td></tr></tbody></table>

---

### Code Examples

<p class="callout info">You can copy the following code examples and replace the "{{variable}}" with the correct data.</p>

#### HTTP

```HTTP
POST /Integra/resources/Dialers/get HTTP/1.1
Host: {{instance}}.ucontactcloud.com
Authorization: Basic {{Token}}
```

##### cURL

```cURL
curl --location --globoff --request POST 'https://{{instance}}.ucontactcloud.com/Integra/resources/Dialers/get' \
--header 'Authorization: Basic {{Token}}'
```

##### JavaScript

```JavaScript
const myHeaders = new Headers();
myHeaders.append("Authorization", "Basic {{Token}}");

const requestOptions = {
  method: "POST",
  headers: myHeaders,
  redirect: "follow"
};

fetch("https://{{instance}}.ucontactcloud.com/Integra/resources/Dialers/get", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
```

##### JQuery

```JavaScript
var settings = {
  "url": "https://{{instance}}.ucontactcloud.com/Integra/resources/Dialers/get",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Authorization": "Basic {{Token}}"
  },
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

##### C#

```C#
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://{{instance}}.ucontactcloud.com/Integra/resources/Dialers/get");
request.Headers.Add("Authorization", "Basic {{Token}}");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());

```

##### Java

```Java
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("https://{{instance}}.ucontactcloud.com/Integra/resources/Dialers/get")
  .method("POST", body)
  .addHeader("Authorization", "Basic {{Token}}")
  .build();
Response response = client.newCall(request).execute();
```

##### Python

```Python
import http.client

conn = http.client.HTTPSConnection("{{instance}}.ucontactcloud.com")
payload = ''
headers = {
  'Authorization': 'Basic {{Token}}'
}
conn.request("POST", "/Integra/resources/Dialers/get", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```

---

### HTTP Response

<p class="callout warning">Responses in which an error occurred due to the sent data will generally be delivered with an HTTP code 200 and a '0' in the response body; therefore, caution should be exercised when validating the HTTP Code Response.</p>

<p class="callout info">The successful response will be a JSON-formatted text corresponding to an array of objects, where each object represents a dialer.</p>

#### Successful response

```JSON
[
	{
        "campaign": "DEMO007<-",
        "schedule": "mon,tue,wed,thu,fri,sat;08:00-21:00",
        "dialertype": "PowerDialer",
        "status": 1,
        "dialstring": "SIP/CLEVERSIP/9898",
        "context": "PowerDialer",
        "exten": "${EXTEN}",
        "am": 0,
        "sound": "",
        "maxchannels": 2,
        "variables": "FORM=Totality:language=default:initialSilence=1500:greeting=2000:afterGreetingSilence=1000:totalAnalysisTime=2500:minWordLength=100:betweenWordSilence=50:maxNumberOfWords=2:silenceThreshold=256",
        "timeout": 30,
        "callerid": "18885751288",
        "retries": 0,
        "callerpres": 20,
        "tbc": -5,
        "dncr": 1,
        "schedulephones": "0=HMW:1=HMW:2=HMW:3=HMW:4=HMW:5=HMW:6=HMW:7=HMW:8=MWH:9=MWH:10=MWH:11=MWH:12=MWH:13=MWH:14=MWH:15=MWH:16=MWH:17=MWH:18=MWH:19=HMW:20=HMW:21=HMW:22=HMW:23=HMW",
        "autoanswer": 1,
        "tbc_nocontact": 0,
        "earlymedia": 0,
        "recyclecount": 0,
        "recycle": "[]",
        "country": "",
        "rule": "NONE",
        "autoconvertcallerid": 0
    }
]
```

#### Error response

```JavaScript
0
```