Skip to content

Remote API Plugins Generator name

Matthew Martin edited this page Mar 9, 2022 · 1 revision

/x-pam/plugins/generator/[plugin_name]

GET

Returns an array containing the current and possible settings for the given plugin.

URI Parameters

  • key: optional (string) returns only keys that match the passed value

HTTP Status Code: 200

Body: application/json

{
    [key1_name] : keyObj,
    [key2_name] : keyObj,...
}

where keyObj is of the form of one of the following

{
   "current" : string - the current value of the setting,
   "enum" : [ array of strings listing the possible values that the setting can have ]
}
{
   "current" : integer or double - the current value of the setting,
   "enum" : [ array of objects listing the possible values the setting can have
       {
         "label" : string  - the name of the possible value for the setting,
         "value" : integer or double - the actual possible value
       },...
    ]
}
{
   "current" : integer or double - the current value of the setting,
   "range" : {
        "maximum" : integer or double - the maximum possible value the setting is allowed to have,
        "minimum" : integer or double - the minimum possible value the setting is allowed to have
    }
}

PATCH

Updates one or more settings of the given plugin to a new value. Note that all the settings that you wish to patch must be able to be patched (i.e. exist and the value passed by valid) or none will be patched.

Body: application/json

[
    {
        "key": string - required. The key whose value you wish to change,
        "value": string, integer or double - required. The value to change the setting to.
    },
    {...},...
]

HTTP Status Code: 400

Returned if

  • the data sent is not valid JSON
  • the data sent is not a JSON array
  • one or more of the passed {key, value} objects is not valid

Body: application/json

{
    "success": false,
    "reason": 
    [
        list of strings - the reason why the patch failed
    ],
    "code" : 400,
    "patch": [ array of patchObj ]
}

HTTP Status Code: 200

Returned when the patch of settings have completed successfully

Body: application/json

{
    "success": true,
    "code": 200,
    "patch": [ array of patchObj ]
}

Where each patchObj is of the form

{
    "success": boolean - true if the setting could be patched, otherwise false,
    "code": integer - 200 if the setting could be patched, 404 if the setting could not be found and 400 otherwise,
    "key": string - the key this patchObj refers to,
    "value": string, integer or double - the value this patchObj refers to,
    "reason" : [ if "success"=false then an array of strings listing the reason the patch failed, otherwise this value does not exist]
}