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.
Request Information
HTTP Option | Value |
Recurso | /Integra/resources/auth/getUserToken |
Content-Type | application/x-www-form-urlencoded |
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}}
HTTP Request
Request Parameters
Parameter | 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.
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"