Consuming smartapp from C# desktop application

This might not be the best way to implement it, but it should work.

If you enable OAuth and generate the Access Token through the SmartApp that SmartApp will have a public url you can access from anywhere without being authenticated.

You can use the mappings in the SmartApp to specify methods to execute based on the url. You can pass information into that method using parameters in the url of a get request or by extracting the json data from a post request.

From that method you can use render to return html and I believe you can also use it to return json, but I haven’t tested that.

If you can’t return json from that method you could use that method to post the information to a public url or use sendhubaction to post it back to the computer on your local network.

The “mappings” section and methods that start with “api_” in the 2 SmartApps below provide examples of everything mentioned above.

Simple Device Viewer accepts information passed through get requests and uses render to return html.

Simple Event Logger parses json from a post request and also posts json to an external url.

1 Like