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