Rules
Rules are a part of the segmentation engine. Rules are a fundamental building block of a ruleset.
The rule model
The rule model contains the info about a specific tag.
Properties
- Name
tag
- Type
- string
- Description
The human readable variant of the tag label.
- Name
external_reference
- Type
- string
- Description
A identifier provided by the implementing party.
- Name
uuid
- Type
- string
- Description
The WalletApp identifier for a tag.
- Name
created_at
- Type
- timestamp
- Description
The timestamp of creation.
- Name
updated_at
- Type
- timestamp
- Description
The timestamp of the last update.
- Name
brand_id
- Type
- string
- Description
The id of the brand the tag is attached to.
Note
Because a user can have access to multiple organizations we require a organization_id to be passed by most requests. We will also return an organization reference in each response.
List all rules
This endpoint returns a list of all the rules the currently authenticated user has access to.
Required headers
- Name
Authorization
- Type
- string
- Description
The token itself as a bearer token.
Abilities
- Name
rules.get
- Type
- string
- Description
The scope required to access this endpoint.
Request
curl -X GET https://api.walletapp.co/rules
-H "Content-Type: application/json"
-H "Accept: application/json"
-H "Authorization: Bearer <your_token>"
Response
{
"success": true,
"data": [
{
"identifier": "<UUID>",
"deleted_at": null,
"title": "<title>",
"organization": {
"name": "<organization_name>",
"identifier": "<organization_id>"
}
},
...
]
}
List data types
This endpoint lists a dictionary of all the data types that can be used in a rule. Use this API as a mapping tool.
Required headers
- Name
Authorization
- Type
- string
- Description
The token itself as a bearer token.
Abilities
- Name
rules.get
- Type
- string
- Description
The scope required to access this endpoint.
Request
curl -X GET https://api.walletapp.co/rules/datatypes/list
-H "Content-Type: application/json"
-H "Accept: application/json"
-H "Authorization: Bearer <your_token>"
Response
{
"success": true,
"data": {
"birthday": {
"description": "Make a rule based on the birthday of the user",
"operators": [
"==",
"!=",
">",
"<",
">=",
"<="
]
},
...
}
}
Create a rule
This endpoint allows you to create a rule.
Required headers
- Name
Authorization
- Type
- string
- Description
The token itself as a bearer token.
Abilities
- Name
rules.store
- Type
- string
- Description
The scope required to access this endpoint.
Request
curl -X POST https://api.walletapp.co/rules
-H "Content-Type: application/json"
-H "Accept: application/json"
-H "Authorization: Bearer <your_token>"
-d '{
"organization_id": "<organization_id>",
"selector": "<selector>",
"operator": "<operator>",
"title": "<rule>",
"input": "<value>"
}'
Response
{
"success": true,
"data": {
"identifier": "<UUID>",
"deleted_at": null,
"title": "<title>",
"organization": {
"name": "<organization_name>",
"identifier": "<UUID>"
}
}
}
Inspect a rule
This endpoint allows you to inspect a rule.
Required headers
- Name
Authorization
- Type
- string
- Description
The token itself as a bearer token.
Abilities
- Name
rules.get
- Type
- string
- Description
The scope required to access this endpoint.
Route parameters
- Name
identifier
- Type
- string
- Description
The identifier of the rule.
Request
curl -X GET https://api.walletapp.co/rules/:identifier
-H "Content-Type: application/json"
-H "Accept: application/json"
-H "Authorization: Bearer <your_token>"
Response
{
"success": true,
"data": {
"identifier": "<UUID>",
"selector": "<selector>",
"input": "<input>",
"operator": "<operator>",
"deleted_at": null,
"title": "<title>",
"organization": {
"name": "<organization_name>",
"identifier": "<UUID>"
}
}
}
Archive a rule
This endpoint allows you to archive a rule.
Required headers
- Name
Authorization
- Type
- string
- Description
The token itself as a bearer token.
Abilities
- Name
rules.delete
- Type
- string
- Description
The scope required to access this endpoint.
Route parameters
- Name
identifier
- Type
- string
- Description
The identifier of the rule.
Request
curl -X GET https://api.walletapp.co/rules/:identifier
-H "Content-Type: application/json"
-H "Accept: application/json"
-H "Authorization: Bearer <your_token>"
Response
{
"success": true,
"message": "Rule deleted"
}
Restore a rule
This endpoint allows you to restore a rule.
Required headers
- Name
Authorization
- Type
- string
- Description
The token itself as a bearer token.
Abilities
- Name
rules.delete
- Type
- string
- Description
The scope required to access this endpoint.
Route parameters
- Name
identifier
- Type
- string
- Description
The identifier of the rule.
Request
curl -X GET https://api.walletapp.co/rules/:identifier
-H "Content-Type: application/json"
-H "Accept: application/json"
-H "Authorization: Bearer <your_token>"
Response
{
"success": true,
"data": "Rule restored"
}