Change state of endpoint contact doesnt work (via ThingLayer)?

hello all, i have gone through the exercise of getting the endpoint of contacts and switches with success.
I can send a command from my browser like this to change a switch:

http://graph.api.smartthings.com/api/smartapps/installations/IC/switches/DID/on/?access_token=AT

where IC is installation code, DID is device ID and AT is my AccessToken
All that is working fine i can change the switch state to on or off changing the value on the link
So i wanted to do the same with a contact. So i setup a virtual contact switch and tried the following
So following the same example that worked above i do:

http://graph.api.smartthings.com/api/smartapps/installations/IC/contacts/DID/on/?access_token=AT

where IC is installation code, DID is device ID and AT is my AccessToken
I have double verified that the IC,DID and AT are correct.
I get

{“error”:true,“type”:“AccessDenied”,“message”:“This request is not authorized by the specified access token”}

What am i doing wrong? How should the link be?? I tried contact and contacts and also open, opened, close and closed

Thanks in advance for the help

Sorry forgot to mention i was using the ThingLayer SmartApp from:

https://github.com/jodyalbritton/smartthings/blob/master/thingLayer.groovy

May I suggest editing the Topic “Title” in this regard? Thanks!

i am not sure if it is because of the Smart App or i do something else
Pretty much i have 3 questions that i am wondering:

  1. is the format of my http link correct
  2. can i change the state of a contact like this?
  3. is there some sample code of a smartapp that I could see changing a contact state? (maybe the specific smartapp i am using doesnt support this…)

ok you were right it was an app issue, there was no handling of contacts , i added code to handle it and seems to be working. Your comment made me thing in a different direction, thanks!

1 Like