How to use API Token in URL


#1

Hi,

I’m trying to change the state of a switch via external URL API calls following this instruction https://docs.smartthings.com/en/latest/smartapp-web-services-developers-guide/tutorial-part1.html

The SmartApp as such works fine, I tested via calling the set API endpoint / URL in the same browser.

( https://<BASE-URL>/api/smartapps/installations/<API Endpoint>/<command> )

Now using the URL in the designated device resulted in "returned HTTP code 401 " (–> Unauthorized)

Reading threw the instruction I’m supposed to use the “API Token” - I hope that this will solve the authorization issue.

curl -H "Authorization: Bearer <api token>" "<api endpoint>/switches"

Unfortunately the instruction refers to how to send via CURL yet my designated device can only handle plain URL calls, so I’m stuck / don’t know how to get the Authorization part into the plain URL.

Anyone any idea?

Thanks
Hendrik


#2

Figured out the solution:
add a “?access_token=” at the end and add the OAuth token of the SmartApp