Skip to content

Instantly share code, notes, and snippets.

@jheising
Last active November 5, 2016 23:32
Show Gist options
  • Save jheising/5f092b0ce3560937f7c26c1d6e37a2fe to your computer and use it in GitHub Desktop.
Save jheising/5f092b0ce3560937f7c26c1d6e37a2fe to your computer and use it in GitHub Desktop.
Function GetData
Dim bunkerAuth As New HttpBasicAuthenticator
bunkerAuth.Setup Username:="admin", Password:="admin"
Dim bunkerClient As New WebClient
bunkerClient.BaseUrl = "https://6daf82faac72d8bdbe867abb93a78ae553db8caefb9603b2c19dae629d8c85.resindevice.io/"
bunkerClient.Authenticator = bunkerAuth
Dim getResponse As WebResponse
Set getResponse = bunkerClient.GetJSON("/api")
ProceessGetData getResponse
End Function
Public Sub ProcessGetData(response as WebResponse)
If response.StatusCode = WebStatusCode.Ok Then
' Put access code here. For example: response.Data("components")("pre_heater_temp")("value")
Else
Debug.Print "Error: " & response.Content
End If
End Sub
Dim bunkerAuth As New HttpBasicAuthenticator
bunkerAuth.Setup Username:="admin", Password:="admin"
Dim bunkerClient As New WebClient
bunkerClient.BaseUrl = "https://6daf82faac72d8bdbe867abb93a78ae553db8caefb9603b2c19dae629d8c85.resindevice.io/api"
bunkerClient.Authenticator = bunkerAuth
Dim setRequest As New WebRequest
setRequest.Resource = "components/{component_id}"
setRequest.Method = WebMethod.HttpPost
setRequest.AddUrlSegment "component_id", "put_component_name_here"
setRequest.AddQuerystringParam "value", value_here
Dim setResponse As WebResponse
Set setResponse = bunkerClient.Execute(setRequest)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment