Thanks - didn’t know a URL in the piston body would anonymize. I did spend some time this morning and added $endpoint and $randomUUID. Actually pretty simple to add system variables the way things are designed.
Both updates are in the “webCoRE Piston” SmartApp.
Add the following at line 7980 in the getSystemVariables() function below temperatureScale:
private static Map getSystemVariables() {
return [
'$args': [t: "dynamic", d: true],
...
"\$temperatureScale": [t: "string", d: true],
"\$endpoint": [t: "string", d: true],
"\$randomUUID": [t: "string", d: true]
].sort{it.key}
}
And then add the following at line 8034 in the getSystemVariableValue() function below temperatureScale:
private getSystemVariableValue(rtData, name) {
switch (name) {
case '$args': return "${rtData.args}".toString()
...
case "\$temperatureScale": return location.getTemperatureScale()
case "\$endpoint": return "${parent.state.endpoint}execute/${hashId(app.id)}".toString()
case "\$randomUUID": def result = getRandomValue("\$randomUUID") ?: UUID.randomUUID().toString(); setRandomValue("\$randomUUID", result); return result
}
}
Save and then publish to self.
@ipaterson I will submit a pull request to the master. If these changes are too controversial I can just hack on any future releases. They both come in handy when building functions to interface with AWS Lambda functions to self register callbacks.
Here is a test piston.