Bet Angel
×
Full Guide

Automation component

 

Purpose

 
To provide information about Automation Instances that have been active in this Bet Angel session, and to get/modify Stored Values throughout Bet Angel.
 
Currently via the API you can:
 

Endpoint

 
http://localhost:<port>/api/automation/v1.0/<operationName>
 
e.g. http://localhost:9000/api/automation/v1.0/setStoredValues
 

Operations

 
 clearStoredValues
 
 
Clears Stored Values from any level of containment in Bet Angel (e.g. Bet Angel / Event / Market / Selection levels) based on the search criteria provided in the instruction.
 
The search criteria fields of the instruction are the same as used with the getStoredValues operation, see that operation for a full description of each field. Any Stored Values that are found during the search will be cleared.
 
Additionally the writeToMarketLog field indicates to the API whether you want the clearing of each Stored Value found to be logged into the Bet Angel market logs.
 
 
 getInstances
 
 
Gets details of Automation Instances that have been created in this Bet Angel session. They could be Servants or Rules that are being managed by Guardian. Each instance has a unique numeric Id which can be used with other operations in this component to interact with Stored Values that are local to the instance.
 
By default the operation will only search for Pending or Active instances, but the includeStoppedInstances field can be set to search for Stopped instances too.
If you wish to limit to search to a range of instance ids, you can set the fromId and toId fields.
By default the search will look for instances in all markets loaded into Bet Angel, but this can be restricted to a specific set of market Ids by using the marketsFilter field.
 
The instances list in the result data will contain one InstanceContainer object per Automation Instance satisfying the search criteria. Each contains details of the instance Id, the status, the rules file name, the associated market, the type of instance, the column in guardian it is associated with (if applicable) and the times of when it was created and when it first triggered.
 
 
 
 getStoredValues
 
 
Gets Stored Values from any level of containment in Bet Angel (e.g. Bet Angel / Event / Market / Selection levels) based on the search criteria provided in the instruction.
 
Instruction fields:
 
1) the marketsFilter field allows the search for Stored Values to be limited to specific market Ids. If the field is null then all markets loaded into Bet Angel will be searched. Any Stored Values at the Bet Angel level will not be affected by this field. Event level Stored Values will be removed from the search if none of the event's markets satisfy the marketsFilter.
 
2) the selectionFilter field allows the search for Stored Values to be limited to specific selection Ids. If the field is null then all selections in the markets being searched will be included in the search. Only Stored Values stored at the Selection containment level will be affected by this field.
 
3) the instanceFilter field can be used to supplement the marketsFilter so that only the markets associated with the specified Automation Instances will be searched. Additionally when retrieving Stored Values that were created local (i.e. not Shared) to the Automation Instance, the search will be limited to the Automation Instances specified in this filter. If the field is null then all instances will be included in the search.
 
4) the storedValueFilterBetAngelLevel field defines if you wish to retrieve Stored Values at the Bet Angel level of containment. If the field is null then Stored Values at this level will NOT be returned. If required, you can filter the search to specific Stored Value Names and can also choose to exclude Shared or Instance Local Stored Values from the search.
 
5) the storedValueFilterEventLevel field defines if you wish to retrieve Stored Values at the Event level of containment. If the field is null then Stored Values at this level will NOT be returned. If required, you can filter the search to specific Stored Value Names and can also choose to exclude Shared or Instance Local Stored Values from the search.
 
6) the storedValueFilterMarketLevel field defines if you wish to retrieve Stored Values at the Market level of containment. If the field is null then Stored Values at this level will NOT be returned. If required, you can filter the search to specific Stored Value Names and can also choose to exclude Shared or Instance Local Stored Values from the search.
 
7) the storedValueFilterSelectionLevel field defines if you wish to retrieve Stored Values at the Selection level of containment. If the field is null then Stored Values at this level will NOT be returned. If required, you can filter the search to specific Stored Value Names and can also choose to exclude Shared or Instance Local Stored Values from the search.
 
Depending on the search criteria, the result data can have up to three fields: a StoredValuesContainer for the Bet Angel level, a list of StoredValuesContainers for the events with Stored Values, and a list of StoredValuesMarketContainers for the markets/selections with Stored Values that were found during the search.
 
 
 setStoredValues
 
 
Sets any number of Stored Values at any level of containment in Bet Angel (e.g. Bet Angel / Event / Market / Selection).
You can assign Stored Values in multiple events/markets/selections in one operation call, just build the containment hierarchy as required.
 
Instruction fields:
 
1) the betAngel field is a container at the Bet Angel (global) level. If you want to assign a Stored Value at this level, populate the betAngel field, set the id to 'BetAngel' and add StoredValue objects to the sharedValues list.
 
The StoredValue object has three fields:
  • n for the name of the Stored Value
  • v which you would populate if you were assigning a numeric value
  • t which you would populate if you were assigning a text value
 
2) The events field is a list of containers. You would create one StoredValuesContainer for each of the events that you wish to assign with Stored Values.
In this case you need to set the id of the container to be the Event Id (as returned by the getMarkets operation) and add StoredValue objects to the sharedValues list for each of the Stored Values that you wish to assign to that event.
 
3) The markets field is a list of market containers. You would create one StoredValuesMarketContainer for each of the markets that you wish to assign with Stored Values.
You need to set the id of the container to be the Market Id (as defined by betfair and returned by the getMarkets operation).
If you are setting a Shared Stored Value then add StoredValue objects to the sharedValues list for each of the Stored Values that you wish to assign to that market.
If you wish to set a Stored Value so that it isn't shared and is instead local to a specific Automation Instance that is running, then the market container has an instances list which you would populate with StoredValueInstanceContainer objects. Each StoredValueInstanceContainer object has an instanceId field and a list of values which you populate with the StoredValue objects that you wish to assign.
 
3b) Each market container also has a selections field which is a list of selection containers. You would create one StoredValuesSelectionContainer for each of the selections in that market that you wish to assign with Stored Values. It works in a similar way to the StoredValuesMarketContainer in that you assign an id (in this case the selection id) and populate sharedValues list and/or the instances list as required.
 
4) The writeToMarketLog field indicates to the API whether you want these Stored Value assignments to be logged into the Bet Angel market logs.
 
If any errors occur during the operation, the errors list of the SetStoredValuesResponse will be populated. Possible errors include an unknown event, unknown market, unknown selection, unknown automation instance, invalid stored value name or value, or a bad request due to missing ids.