Send HTTP API from smart device

Hello,

I would like to create a device that can send our this http api:

http://{username}:{password}@{ipaddress}:{port}/api/callAction?deviceID=4&name=turnOff

I have tried this on browser and it works but I need a smart device that can pre-input device preferences including username, password, ip, port, and the api command. I think it would be something like the code for Generic Camera Device but used to send out command:

Preferences (edit)
Camera IP Address: 192.168.2.7
Camera Port: 80
Camera Path to Image: /api/callAction?deviceID=33&name=turnOn
Does Camera require User Auth?: false
Does Camera use a Post or Get, normally Get?: Get
Camera User: admin
Camera Password: admin

Can someone provide help on this code or advice which sample code I should look into?

Thank you so much.

Billy

just to get you some light reading for the day

1
https://support.smartthings.com/hc/en-us/articles/200901260-HTTP-Methods
2
http://docs.smartthings.com/en/latest/smartapp-developers-guide/calling-web-services-in-smartapps.html?highlight=httpget

3

4

5

1 Like