Posted by eshangin
Henagon

reports/connections API return deviceid wihout "d" in the start

According to documentation 

IDs are prefixed with a type in order to make them more distinguishable. The following types are used: 

• "u" - user ID

• "g" – group ID

• "m" – meeting ID

• "s" – session code

• „c“ – contact ID

• „d“ – device ID

• „r“ – remote control ID, also referred to as TeamViewer ID in other documentations

In fact when I call https://webapi.teamviewer.com/api/v1/reports/connections?from_date=[date] the result contain records and deviceid field does not start with "d". The values looks like as integers, for example "475705308". I assume it is a bug?

BTW, at the same time userid and contact_id of the same record looks as it should: user Id starts with "u" and contact Id starts with "c"

1 Reply
1 Reply
Posted by TeamViewer Staff
TeamViewer Staff

Re: reports/connections API return deviceid wihout "d" in the start

seems like an inconsitency , yes.

I don't think i can easily change this because it would be a breaking change for a production API.

Everybody who consumes it already would need to update their code /json serializer to reflect the type change. Which is something we don't want.

There is however always the possiblity of versioning the request aka : api/v2/reports/connections could return device id with prefixed 'd' while via v1 you get the old inconsistent behaviour. (this is of course not implemented currently - just providing some insights)

I will see if we can do anything here - at least i will create a bug report.

I must say however the prefixing of IDs is only for readability.  The device id is correct as an integer - the only difference is the 'd' - so you technically should be able to just use it as is. (you might want to add a 'd' in front for comparing with other values from the API as a workaround)

Anyway thanks for pointing this out.