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.
You can check the Postman Collection to test in your instance.
All data enclosed in "{{ }}" are values that will be replaced with the client's own data and/or the corresponding instance.
HTTP Request
Method | Resource |
POST | /Integra/resources/auth/getUserToken |
Request Header
Key | Value |
Content-Type | application/x-www-form-urlencoded |
Request Body
Key | Type | Description |
user | Text (String) | User Name |
password | Text (String) | User Password |
Code Examples
You can copy the following code examples and replace the "{{variable}}" with the correct data.
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
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
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#
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
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"