cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
204
Views
10
Helpful
3
Replies

ClientLog API endpoint error issue

matthew.bavosa
Beginner
Beginner


when I submit a POST request like so:

var logData = '<ClientLog><logData>This is some logged data for the log file 20221011_1</logData></ClientLog>';
var xhr = new XMLHttpRequest();
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log("Gadget is now refreshing MB NEW" + this.responseText);
}
});
xhr.open("POST", https://finesse1.xyz.com/finesse/api/User/660008/ClientLog);
xhr.setRequestHeader("Content-Type", "application/xml");
xhr.send(logData);

I get a response

<ApiErrors>
<ApiError>
<ErrorType>Invalid Authorization User Specified</ErrorType>
<ErrorData>660008</ErrorData>
<ErrorMessage>The user specified in the authentication credentials and the uri don't match</ErrorMessage>
</ApiError>
</ApiErrors>

But if I switch out my ID 660008 for finadmin (https://finesse1.xyz.com/finesse/api/User/finadmin/ClientLog), the api works and I get a 200 and write a line to the logs
and this is for the ClientLog endpoint https://developer.cisco.com/docs/finesse/#!clientlog%e2%80%94post-to-finesse/clientlogpost-to-finesse

Why am I getting this error?

1 Accepted Solution

Accepted Solutions

matthew.bavosa
Beginner
Beginner

This answer in Webex chat  DevNet Dev Support Questions helped resolve this:

If that user is SSO enabled, you need to get the bearer token rather than basic auth with username/password.

Such as: 

xhr.setRequestHeader("Authorization", "Bearer eyJjdHk*****i");

View solution in original post

3 Replies 3

Alex Stevenson
Cisco Employee
Cisco Employee

Hello @matthew.bavosa ,

 

Restarting Finesse may help. Please read this discussion for more details:

https://community.cisco.com/t5/contact-center/pcce-12-6-login-by-name-via-finesse-api-does-not-work/td-p/4543237

 

I know you're logging in with User ID and not Name, but it might be worth a shot. I hope this helps!

realexan
Cisco Employee
Cisco Employee

@matthew.bavosa ,

It looks like you are trying to POST the client logs for the user with user ID 660008(https://finesse1.xyz.com/finesse/api/User/660008/ClientLog) using some other user's (possibly the administrator) credentials.

You should be using the credential of the same user that is in the URL as the error suggests.

Example:

var logData = '<ClientLog><logData>This is some logged data for the log file 20221011_1</logData></ClientLog>';
var agent = '660008';

// Fill the password
var pwd = 'password-for-agent-660008';


var xhr = new XMLHttpRequest();
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log("Gadget is now refreshing MB NEW" + this.responseText);
}
});
xhr.open("POST", 'https://finesse25.autobot.cvp:8445/finesse/api/User/' + agent + '/ClientLog');
xhr.setRequestHeader("Content-Type", "application/xml");
xhr.setRequestHeader("Authorization", "Basic " + btoa(agent + ":" + pwd)); 

xhr.send(logData);

Regards,

Renjith

matthew.bavosa
Beginner
Beginner

This answer in Webex chat  DevNet Dev Support Questions helped resolve this:

If that user is SSO enabled, you need to get the bearer token rather than basic auth with username/password.

Such as: 

xhr.setRequestHeader("Authorization", "Bearer eyJjdHk*****i");

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Recognize Your Peers