I’ve added the ability to execute a WebCore Piston from my Beta SmartApp SHM Delay V2.0 and it works as expected when the URL is correct. However, when the URL’s piston id portion of the URL is wrong, it returns a Http response of 200, when it should be a 404.
Sample Piston URL (adjusted for security also limited to new user 2 links so https became xhttps)
xhttps://graph-na04-useast2.api.smartthings.com/api/token/…/smartapps/installations/…/execute/:8c657e1f71672e292261a1f39d8363ca:
Returns:200
Change installations to installationss
xhttps://graph-na04-useast2.api.smartthings.com/api/token/…/smartapps/installationss/…/execute/:8c657e1f71672e292261a1f39d8363ca:
Returns 403 Forbidden, was expecting a 404, but 403 is OK
change 63ca: to 63cb:
https://graph-na04-useast2.api.smartthings.com/api/token/…/smartapps/installations/…/execute/:8c657e1f71672e292261a1f39d8363cb:
Returns 200 unexpected, should be 404 Not Found or perhaps the 403 Forbidden
Smartapp Code executing the Piston
case ‘Piston’:
try {
include 'asynchttp_v1’
def params = [uri: it.thepinpiston]
asynchttp_v1.get(‘getResponseHandler’, params)
message = keypad.displayName + " Piston executed with pin for " + it.theusername
}
catch (e)
{
message = keypad.displayName + " Piston Failed with pin for " + it.theusername + " " + e
}
break
// Process response from async execution of WebCore Piston
def getResponseHandler(response, data)
{
if(response.getStatus() != 200)
sendNotificationEvent(“SHM Delay Piston HTTP Error = ${response.getStatus()}”)
}