Hi Ryan, thank you for your reply.
I am using the “old” API. I follow the process depicted here:
http://docs.smartthings.com/en/latest/smartapp-web-services-developers-guide/authorization.html
I receive the authorization code and the access token correctly. Then I use it to “Get Smartapp endpoints” and I receive an array with several items, similar to the following:
[
{
“oauthClient”: {
“clientId”: CLIENTIDX
},
“location”: {
“id”: LOCATION1_ID,
“name”: LOCATION1
},
“uri”: URI FOR INSTALLATIONW,
“base_url”: BASE URL,
“url”: “/api/smartapps/installations/INSTALLATIONW”
},
{
“oauthClient”: {
“clientId”: CLIENTIDX
},
“location”: {
“id”: LOCATION2_ID,
“name”: LOCATION2
},
“uri”: URI FOR INSTALLATIONZ,
“base_url”: BASE URL,
“url”: “/api/smartapps/installations/INSTALLATIONZ”
},
{
“oauthClient”: {
“clientId”: CLIENTIDX
},
“location”: {
“id”: LOCATION3_ID,
“name”: LOCATION3
},
“uri”: URI FOR INSTALLATIONY,
“base_url”: BASE URL,
“url”: “/api/smartapps/installations/INSTALLATIONY”
},
{
“oauthClient”: {
“clientId”: CLIENTIDX
},
“location”: {
“id”: LOCATION3_ID,
“name”: LOCATION3
},
“uri”: URI FOR INSTALLATIONX,
“base_url”: BASE URL,
“url”: “/api/smartapps/installations/INSTALLATIONX”
}
]
When I use the same token to reach the endpoints on my smartapp, the smartapp uses one of the locations on the array, but not necessarily the one that I selected when I issued the access token.
I want my smartapp to operate with the location that the access token was issued for. I think that I could solve this issue if I was able to identify the last smartapp installation on that array, which should be the one related to the last access token. I tested to see if new installations where added at the position 0 of the array, and it seems to be true when there is no other installation for the same location, but not in other case.