Regular Expressions


Data Structures

RegExpModel
Attribute Type Required Description
id string   Read-only, unique regular expression identifier.
name string yes Unique, case-insensitive regular expression name.
type string {ml, regexp} yes Immutable. Policy type.
regexp string yes Regular expression content.
created_at datetime   Read-only. Timestamp of creation.
modified_at datetime   Read-only. Timestamp of modification.
removed boolean   Read-only.

Request for Retrieving Available Attributes of the RegExpModel

Method
GET
Path
/api/v2/objspec/regexp

Note

To check allowed methods, available URL parameters and possible responses please refer to the API Overview section.

The next chapter describes procedures for creating separate requests.


Retrieving Regular Expressions List

Request

Method
GET
Path
/api/v2/regexp

Example Request

Sending GET https://10.0.0.0/api/v2/regexp

curl -s -k -X GET -H 'Authorization: sgfeea6jsaz4mum9su8w61877n1g06sk' 'https://10.0.214.98/api/v2/regexp'

Response

{
    "result": "success",
    "regexp": [
        {
            "id": "9124292845052624897",
            "name": "Reg_ex_1",
            "regexp": "(^|[^a-zA-Z])rm[[:space:]]",
            "created_at": "2024-06-14 05:46:25.34634-07",
            "modified_at": "2024-06-14 05:46:25.34634-07"
        }
    ]
}

Retrieving Regular Expression by ID

Request

Method
GET
Path
/api/v2/regexp/<id>

Example Request

Sending GET https://10.0.0.0/api/v2/regexp/9124292845052624897

curl -s -k -X GET -H 'Authorization: sgfeea6jsaz4mum9su8w61877n1g06sk' 'https://10.0.214.98/api/v2/regexp/9124292845052624897'

Response

{
    "result": "success",
    "regexp": {
        "id": "9124292845052624897",
        "name": "Reg_ex_1",
        "regexp": "(^|[^a-zA-Z])rm[[:space:]]",
        "created_at": "2024-06-14 05:46:25.34634-07",
        "modified_at": "2024-06-14 05:46:25.34634-07"
    }
}

Defining Regular Expression

Request

Method
POST
Path
/api/v2/regexp
Headers
Content-Type: Application/HTML
Body
RegExpModel

Example Request

Sending POST https://10.0.0.0/api/v2/regexp

curl -s -k -X POST -H 'Authorization: sgfeea6jsaz4mum9su8w61877n1g06sk' https://10.0.214.98/api/v2/regexp -H 'Content-Type: application/json' -d'{"name":"Reg_ex_2","regexp":"(^|[^a-zA-Z])rm[[:space:]]"}'

Response

{
    "result": "success",
    "regexp": {
        "id": "9124292845052624900"
    }
}

Modifying Regular Expression

Request

Method
PATCH
Path
/api/v2/regexp/<id>
Headers
Content-Type: Application/HTML
Body
RegExpModel

Example Request

Sending PATCH https://10.0.0.0/api/v2/regexp/9124292845052624897

curl -s -k -X PATCH -H 'Authorization: sgfeea6jsaz4mum9su8w61877n1g06sk' https://10.0.214.98/api/v2/regexp/9124292845052624897 -H 'Content-Type: application/json' -d'{"regexp":"(^|[^a-zA-Z])rm[[:space:]]"}'

Response

{
    "result": "success"
}

Deleting Regular Expression

Request

Method
DELETE
Path
/api/v2/regexp/<id>

Example Request

Sending DELETE https://10.0.0.0/api/v2/regexp/9124292845052624897

curl -s -k -X DELETE -H 'Authorization: sgfeea6jsaz4mum9su8w61877n1g06sk' https://10.0.214.98/api/v2/regexp/9124292845052624897

Response

{
    "result": "success"
}