Glob APIs

Glob are fast key value stores which could be controlled to change the simulation behavior.

glob APIs could be used in the template to access global key value store. These values are useful to enable interaction between templates and control the behavior of simulation through user.

An example of how to use glob APIs in the template could be seen here.

get
Glob Get

https://api.iotify.io/v1/glob/:globKey
Retrieves the current value of glob variable
Request
Response
Request
Path Parameters
required
string
Glob key name
Headers
x-auth
required
string
Authorization Token obtained by Settings page
Response
200: OK
{ success: true, result: 'glob value'}

post
Glob Set

https://api.iotify.io/v1/glob/:globKey?
Use this API to set the current value of a glob. This API could be used in two way A) With Glob Key in the URL You could optionally pass the key name of the glob in the path parameter. In this case, the content of the payload would be used as a glob value. e.g. setting a GlobKey myKey to a JSON object curl -X POST -H "Content-type:application/json" -H "x-auth:myauthtokenhere" https://api.iotify.io/v1/glob/myKey -d '{"payloadKey":"payloadValue"}' Another example is to set a glob Key to a string value curl -X POST -H "Content-type:application/text" -H "x-auth:myauthtokenhere" https://api.iotify.io/v1/glob/myKey -d 'myvalue' B) Providing Glob key in the payload as a key If your API client doesn't provide the possibility of having a dynamic path, you could include the globKey in the JSON payload. In this case, the contents of the payload must be a valid JSON object, otherwise the request will be rejected. curl -X POST -H "Content-type:application/text" -H "x-auth:myauthtokenhere" https://api.iotify.io/v1/glob/ -d '{ "globKey": "globValue" }'
Request
Response
Request
Path Parameters
optional
string
A glob Key name could be provided here. If this parameter is present, the entire content of body would be used as Value for the glob.
Headers
x-auth
required
string
Authorization Token
Body Parameters
body
required
object
If the optional globKey is provided in the URL, the complete contents of the the body is used as the value of the glob. If the globKey is not present in the URL, then body must be a valid JSON object in the format { "globKey": globValue } Here only the first key is used as a globKey and the value of the first key is used as glob value
Response
200: OK
{ success: true, result: 'glob value'}

delete
Glob Delete

https://api.iotify.io/v1/glob/:glob
Deletes the key value pair of the glob
Request
Response
Request
Path Parameters
globKey
required
string
The globKey to be deleted
Headers
x-auth
required
string
Authorization token
Response
200: OK
{ success: true, result: 'Deleted'}