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