Concepts
Data Structures
Data Structures in Stubber are based on JSON. Referencing data is done by specifying the path to the data in the JSON structure.
Basic Principle
Stubber uses JSON structures as the underlying data structure.
JSON consists of key-value pairs, where the value can be a string, number, boolean, array, or another JSON object.
All parts of Stubber, such as templates
, actions
, tasks
, notifications
, and fields
, are based on JSON structures.
Referencing data is done by specifying the path to the data in the JSON structure.
To reference data in a JSON structure, you use a path that consists of the keys to the data.
For example in the following JSON structure:
To reference the name
field, you would use the path stub.data.name
.
To reference the type
field of the second pet, you would use the path stub.data.pets[1].type
.
You use substitution to reference data in the JSON structure and replace it with the actual value.
To quickly get the path to a data point in a stub, you can click on the key in the data tab of the stub details or when viewing the data in a stub post.
This will copy the path to the clipboard.
Referencing Data Considerations
There different substitution mechanisms as well as expression processors in the Stubber Platform.
These mechanisms and processors have slightly differing ways of referencing data.
The differences come with lookups and with referencing array items.
When using conditions in Stubber the referencing of data follows the standard used my JSONata.
Top Level Data Keys
When an action is run there are many top level data structures you can use to substitute data from.
The key data keys available are listed below :
- stubpost contains all data points specific to the running action, like the data submitted to the action, the tasks list and message
- stub contains all the longer term data from the stub
- program contains the key template information like branch, context etc as well as the full template specifications, you can use this to access any structure defined on the template
- template contains template wide data structures defined on template
- actioningContact contains data about the contact running the action
- org contains data about the org on Stubber
- actionDef the current running action definition structure i.e. The fields, tasks, metrics
- userlists an array of contactuuids belonging to every contact list on the stub
- contacts_populated each contactuuid with add the contact details of that contact
- contact_lists_merged all the contact lists with details
- actioningContact the contact running the action