Javascript API implementation for company access token

Hi,

I'm trying to use the Teamviewer API.


What's I'm planning to do:
Create de web page (in Wordpress administration) where all computers belong to a Teamviewer groups / user must display. I have to know if they are online or not.

Secondly, some actions are available on this page like update description device.

So I'm tring to implement it with javascript (jQuery actually but it's not a requirement).

Here is my code:

 

$.ajax({
// url /api/v1/users/<uID>/groups where I'm not sure about <uID> where can I found it ?
url: "https://webapi.teamviewer.com/api/v1/users/XXXXXXX/groups",
type: "GET",
beforeSend: function(xhr) {
// appToken generated in my profil > application
var appToken = 'XXXXXXX-..........';
xhr.setRequestHeader("Authorization", 'Bearer ' + appToken)
},
error: function(xhr, status, error) {
console.log(xhr);
console.log(status);
console.log(error);
},
success: function(data, textStatus, jqXHR) {
console.log(data);
console.log(textStatus);
}
});

 

I got a 404 error with this piece of code.
Can you help me, please ?
Thank

 

Best Answer

Answers