Skip to content

API Action

Action

Récupérer la liste des actions

GET /api/v2/actions

Renvoie la liste des actions.

[
    {
        "_id": "action_id",
        "type": "pbehavior",
        "fields": ["Resource", "Component"],
        "regex": ".*",
        "parameters": {
            "name": "pbehavior_name",
            "author": "System",
            "type": "Pause",
            "rrule": "",
            "reason": "",
            "tstart": 0,
            "tstop": 253402297199
        }
    },
    {
    "_id": "action_2_id",
    "type": "snooze",
    "hook": {
        "event_patterns": [
            {
                "resource": "CPU"
            },
            {
                "resource": "HDD"
            }
        ],
        "triggers": [
            "create"
        ]
    },
    "parameters": {
            "duration": 10,
            "message": "Temporisation de l'alarme pendant 10 secondes",
            "author": "action"
        }
    }
]

Récupérer une action

GET /api/v2/actions/<action_id>

Renvoie l'action demandée.

{
    "_id": "action_id",
    "type": "pbehavior",
    "fields": ["Resource", "Component"],
    "regex": ".*",
    "parameters": {
        "name": "pbehavior_name",
        "author": "System",
        "type": "Pause",
        "rrule": "",
        "reason": "",
        "tstart": 0,
        "tstop": 253402297199
    }
}

Créer une action

POST /api/v2/actions
{
    "_id": "action_id",
    "type": "pbehavior",
    "fields": ["Resource", "Component"],
    "regex": ".*",
    "parameters": {
        "name": "pbehavior_name",
        "author": "System",
        "type": "Pause",
        "rrule": "",
        "reason": "",
        "tstart": 0,
        "tstop": 253402297199
    }
}

Renvoie un dictionnaire vide en cas de réussite.

Modifier une action

PUT /api/v2/actions/<action_id>
{
    "_id": "action_id",
    "type": "pbehavior",
    "fields": ["Resource", "Component"],
    "regex": ".*",
    "parameters": {
        "name": "pbehavior_name",
        "author": "Myself",
        "type": "Pause",
        "rrule": "",
        "reason": "",
        "tstart": 0,
        "tstop": 253402297199
    }
}

Renvoie un dictionnaire vide en cas de réussite.

Supprimer une action

DELETE /api/v2/actions/<action_id>

Renvoie un booléen.