Announcements

Did you already try the new Windows 10 October 2020 Update?


Share your feedback and experience with TeamViewer on the new Windows build with our developers here.

Highlighted
Posted by
Digon

list device reports with API

I try to list all devices via the API and get an unauthorized message in C#. I have already a corporate license for v12.

string accessToken = "xxxxxxxx";
string tvApiBaseUrl = "https://webapi.teamviewer.com";
string address = tvApiBaseUrl + "/api/v1/reports/devices/";

// Create the web request  
HttpWebRequest request = WebRequest.Create(address) as HttpWebRequest;
request.Headers.Add("Authorization", "Bearer " + accessToken);
request.Method = "GET";
WebResponse webResp = request.GetResponse();
5 Replies
Highlighted
Posted by TeamViewer Star
TeamViewer Star

Re: list device reports with API

Hi @fla 

try GET method under specific endpoint:

string address = tvApiBaseUrl + "/api/v1/devices/";

 Regards

Domenico Langone
MCSD: App Builder
Did my reply answer your question? Accept it as a solution to help others.
Find this helpful? Say thanks by clicking on the Thumbs Up button.
Highlighted
Posted by
Digon

Re: list device reports with API

I get the same reuslt:

The remote server returned an error: (401) Unauthorized.

Highlighted
Posted by TeamViewer Star
TeamViewer Star

Re: list device reports with API

Hi @fla 

in this case it is likely that you really are not authorized. Is the token you are using derived from your specific user (via OAuth) or is it a valid token for your entire structure?

The method expressly requires that:
- the token is user type (so acquired via OAuht);
- the user has privileges to read his device list via API (check via management console)

Regards

Domenico Langone
MCSD: App Builder
Did my reply answer your question? Accept it as a solution to help others.
Find this helpful? Say thanks by clicking on the Thumbs Up button.
Highlighted
Posted by
Digon

Re: list device reports with API

haa... I resolved it. I took the wrong script token (company token instead of the user token).

Thank you... writing to you helped...

1 Reply
Highlighted
Posted by
Digon

Re: list device reports with API