Skip to content

Remote API Settings

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

/x-pam/settings

GET

Returns an array containing the current and possible settings. The settings mimic an ini file. i.e. they are of the form

[section1]
key1=value1
key2=value2
...
[section2]
key1=value1
key2=value2
...

URI Parameters

  • section: optional (string) limits the returned array to contain only settings belonging to the passed value
  • key: optional (string) returns only keys that match the passed value

HTTP Status Code: 200

Body: application/json

{
    [section1_name] : sectionObj,
    [section2_name] : sectionObj,...
}

where sectionObj is of the form

{
    [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 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

[
    {
        "section": string - required. The section the setting belongs to,
        "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 {section, 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,
    "section": string - the section this patchObj refers to,
    "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]
}