Posted by mLipok
Heptagon

API: Adding Devices: "Device already exists" - but which one ?

I was playing with adding Devices And I get this result:

{"error":"invalid_request","error_description":"Device already exists","error_code":1}


I know I can check it by sending new API Call but why ? I think my proposal would be very handy if this kind of result will also contain already existed DeviceID.
btw. This should reduce the number of operations on site server and user side.

Regards,
mLipok

Regards,
mLipok , AutoIt MVP

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.

6 Replies
1 Accepted Solution

Accepted Solutions
Posted by DomLan
Heptagon
Solution

Re: API: Adding Devices: "Device already exists" - but which one ?

Hi,

It 'a matter of permissions.
The device can be present in a private group account, for which the relative read permissions may be absent.

In any case, as already indicated, no additional information is provided and personally I think it's so right. At most you can get a response like this:
POST https://webapi.teamviewer.com/api/v1/devices {"error": "internal_error", "error_description": "This is Already buddy in the buddy list of the group owner.", "Error_code": 3 }

But no details giving the device code.

Certainly you can wait for the official response from the TeamViewer technical: I'll wait with you.

 

Regards

Domenico Langone
MCSD: App Builder

View solution in original post

6 Replies
Posted by Former Staff Katharina
Former Staff

Re: API: Adding Devices: "Device already exists" - but which one ?

Hi mLipok, 

Thank you for this suggestion!

We have added it as a feature request and will let you know as soon as there are any news on the subject.

All the best, 

Katharina

Did my reply answer your question? Accept it as a solution to help others, Thanks!
Posted by DomLan
Heptagon

Re: API: Adding Devices: "Device already exists" - but which one ?

Hi,

It 'an interesting request, but realize it would mean compromising the principles of the REST service itself.
The operations allowed on entities are 4: POST (add entity), PUT (modify entity), GET (read entity) and DEL (delete entity). We have already discussed the fact that a call must provide the minimum elements required by functionality and no data in more. Perform a POST means communicating the addition of an entity and the answer can only be ADDED or NOT ADDED. Very similar to an INSERT on a relational database: if I add an element with the key already exists, I get an error.

There isn't an HTTP verb that allows an operation similar to GetOrSetEntity; this must be properly managed via code on the caller.

Regards

Domenico Langone
MCSD: App Builder
Posted by mLipok
Heptagon

Re: API: Adding Devices: "Device already exists" - but which one ?

Server developer for TeamViewer API service must to check if remoteID exist.
So he have DeviceID already taken.
So what is the problem to return this DeviceID by

{"error":"invalid_request","error_description":"Device already exists","error_code":1,"additional_info":"d012345678"}

??

 

ps.
I'm not REST Service developer (only REST user) so I will be really happy to hear the answer.

Regards,
mLipok , AutoIt MVP

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.

Posted by DomLan
Heptagon

Re: API: Adding Devices: "Device already exists" - but which one ?

Hi,

you POST a request to /api/v1/devices? If yes, the device is already in your contact list? Check the group.

Is this your case study?

Regards

Domenico Langone
MCSD: App Builder
Posted by mLipok
Heptagon

Re: API: Adding Devices: "Device already exists" - but which one ?


@DomLan wrote:

Hi,

you POST a request to /api/v1/devices? If yes, the device is already in your contact list? Check the group.

Is this your case study?


Yes this is my case.
But as I said:

"Server developer for TeamViewer API service must to check if remoteID exist. So he have DeviceID already taken. So what is the problem to return this DeviceID by."

and:

"This should reduce the number of operations on site server and user side."

Regards,
mLipok

Regards,
mLipok , AutoIt MVP

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.

Posted by DomLan
Heptagon
Solution

Re: API: Adding Devices: "Device already exists" - but which one ?

Hi,

It 'a matter of permissions.
The device can be present in a private group account, for which the relative read permissions may be absent.

In any case, as already indicated, no additional information is provided and personally I think it's so right. At most you can get a response like this:
POST https://webapi.teamviewer.com/api/v1/devices {"error": "internal_error", "error_description": "This is Already buddy in the buddy list of the group owner.", "Error_code": 3 }

But no details giving the device code.

Certainly you can wait for the official response from the TeamViewer technical: I'll wait with you.

 

Regards

Domenico Langone
MCSD: App Builder

View solution in original post