Rulesets

Rulesets the combination of rules and tags. A ruleset will be polled hourly and keep active track of a list of users based on the provided segmentation.

The ruleset model

The rule model contains the info about a specific tag.

Properties

  • Name
    title
    Type
    string
    Description

    The title of specific ruleset.

  • Name
    uuid
    Type
    string
    Description

    The WalletApp identifier for a tag.

  • Name
    type
    Type
    string
    Description

    The type of ruleset. Can be ['all', 'active', 'inactive', 'savers']

  • Name
    created_at
    Type
    timestamp
    Description

    The timestamp of when the ruleset was created.

  • Name
    updated_at
    Type
    timestamp
    Description

    The timestamp of when the ruleset was last updated.

  • Name
    organization
    Type
    object
    Description

    The organization the ruleset belongs to. contains ['name', 'identifier']

  • Name
    brand
    Type
    object
    Description

    The brand the ruleset belongs to. contains ['name', 'identifier']

  • Name
    tags
    Type
    array
    Description

    The tags the ruleset contains. contains objects consisting of: ['tag', 'identifier']

  • Name
    rules
    Type
    array
    Description

    The rules the ruleset contains. contains objects consisting of: ['title', 'identifier']

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.


GET/rulesets

List all rulesets

This endpoint returns a list of all the rulesets the currently authenticated user has access to.

Required headers

  • Name
    Authorization
    Type
    string
    Description

    The token itself as a bearer token.

Abilities

  • Name
    rulesets.get
    Type
    string
    Description

    The scope required to access this endpoint.

Request

GET
/rulesets
curl -X GET https://api.walletapp.co/rulesets 
-H "Content-Type: application/json"
-H "Accept: application/json"
-H "Authorization: Bearer <your_token>"

Response

{
    "success": true,
    "data": [
        {
            "title": "<title>",
            "uuid": "<UUID>",
            "type": "all",
            "created_at": "2022-12-23T13:44:24.000000Z",
            "updated_at": "2022-12-23T13:44:24.000000Z",
            "members": 0,
            "deleted_at": null,
            "organization": {
                "name": "<organization_name>",
                "identifier": "<UUID>"
            },
            "brand": {
                "name": "<name>",
                "identifier": "<UUID>"
            },
            "tags": [
                {
                    "tag": "<tag>",
                    "identifier": "<UUID>"
                }
            ],
            "rules": [
                {
                    "title": "<title>",
                    "identifier": "<UUID>"
                }
            ]
        }
    ]
}

POST/rulesets

Create a ruleset

This endpoint allows you to create a rulesets.

Required headers

  • Name
    Authorization
    Type
    string
    Description

    The token itself as a bearer token.

Abilities

  • Name
    rulesets.store
    Type
    string
    Description

    The scope required to access this endpoint.

Body parameters

  • Name
    title
    Type
    string|Required
    Description

    The title of the ruleset.

  • Name
    type
    Type
    string|Required
    Description

    The type of ruleset. Can be ['all', 'active', 'inactive', 'savers']

  • Name
    organization_id
    Type
    string|Required
    Description

    The organization the ruleset belongs to.

  • Name
    brand_id
    Type
    string|Required
    Description

    The brand the ruleset belongs to.

  • Name
    tags
    Type
    array[string]|Required
    Description

    The tags the ruleset contains. This field is optional when the rules are provided.

  • Name
    rules
    Type
    array[string]|Required
    Description

    The rules the ruleset contains. This field is optional when the tags are provided.

Request

POST
/rulesets
curl -X POST https://api.walletapp.co/rulesets 
-H "Content-Type: application/json"
-H "Accept: application/json"
-H "Authorization: Bearer <your_token>"
-d '{
        "title": "<title>",
        "type": "all",
        "organization_id": "<organization_id>",
        "brand_id": "<brand_id>",
        "rules": [
            "<UUID>"
        ],
        "tags": [
            "<UUID>"
        ]
    }'

Response

{
   "success": true,
   "data": {
       "title": "<title>",
       "uuid": "<UUID>",
       "type": "all",
       "created_at": "2022-12-23T13:44:24.000000Z",
       "updated_at": "2022-12-23T13:44:24.000000Z",
       "members": 0,
       "deleted_at": null,
       "organization": {
           "name": "<organization_name>",
           "identifier": "<UUID>"
       },
       "brand": {
           "name": "<name>",
           "identifier": "<UUID>"
       },
       "tags": [
           {
               "tag": "<tag>",
               "identifier": "<UUID>"
           }
       ],
       "rules": [
           {
               "title": "<title>",
               "identifier": "<UUID>"
           }
       ]
   }
}

GET/rulesets/:identifier

Inspect a ruleset

This endpoint allows you to inspect a ruleset.

Required headers

  • Name
    Authorization
    Type
    string
    Description

    The token itself as a bearer token.

Abilities

  • Name
    rulesets.get
    Type
    string
    Description

    The scope required to access this endpoint.

Route parameters

  • Name
    identifier
    Type
    string
    Description

    The identifier of the rule.

Request

GET
/rulesets/:identifier
curl -X GET https://api.walletapp.co/rulesets/:identifier 
-H "Content-Type: application/json"
-H "Accept: application/json"
-H "Authorization: Bearer <your_token>"

Response

{
    "success": true,
    "data": {
        "title": "<title>",
        "uuid": "<UUID>",
        "type": "all",
        "created_at": "2022-12-23T13:44:24.000000Z",
        "updated_at": "2022-12-23T13:44:24.000000Z",
        "members": 0,
        "deleted_at": null,
        "organization": {
            "name": "<organization_name>",
            "identifier": "<UUID>"
        },
        "brand": {
            "name": "<name>",
            "identifier": "<UUID>"
        },
        "tags": [
            {
                "tag": "<tag>",
                "identifier": "<UUID>"
            }
        ],
        "rules": [
            {
                "title": "<title>",
                "identifier": "<UUID>"
            }
        ]
    }
}

DELETE/rulesets/:identifier

Archive a ruleset

This endpoint allows you to archive a ruleset.

Required headers

  • Name
    Authorization
    Type
    string
    Description

    The token itself as a bearer token.

Abilities

  • Name
    rulesets.delete
    Type
    string
    Description

    The scope required to access this endpoint.

Route parameters

  • Name
    identifier
    Type
    string
    Description

    The identifier of the ruleset.

Request

DELETE
/rulesets/:identifier
curl -X GET https://api.walletapp.co/rulesets/:identifier 
-H "Content-Type: application/json"
-H "Accept: application/json"
-H "Authorization: Bearer <your_token>"

Response

{
    "success": true,
    "message": "Ruleset deleted"
}

PATCH/rulesets/:identifier

Restore a ruleset

This endpoint allows you to restore a rule.

Required headers

  • Name
    Authorization
    Type
    string
    Description

    The token itself as a bearer token.

Abilities

  • Name
    rulesets.delete
    Type
    string
    Description

    The scope required to access this endpoint.

Route parameters

  • Name
    identifier
    Type
    string
    Description

    The identifier of the rule.

Request

PATCH
/rulesets/:identifier
curl -X GET https://api.walletapp.co/rulesets/:identifier 
-H "Content-Type: application/json"
-H "Accept: application/json"
-H "Authorization: Bearer <your_token>"

Response

{
    "success": true,
    "message": "Ruleset restored"
}