valuemap.get

Descrizione

integer/array valuemap.get(object parameters)

Il metodo consente di recuperare le mappe dei valori in base ai parametri specificati.

Questo metodo è disponibile per utenti di qualsiasi tipo. I permessi per chiamare il metodo possono essere revocati nelle impostazioni del ruolo utente. Vedere User roles per ulteriori informazioni.

Parametri

(object) Parametri che definiscono l'output desiderato.

Il metodo supporta i seguenti parametri.

Parametro Tipo Descrizione
valuemapids ID/array Restituisce solo le mappe di valori con gli ID specificati.
selectMappings query Restituisce le mappature dei valori per la mappa di valori corrente nella proprietà mappings.

Supporta count.
sortfield string/array Ordina il risultato in base alle proprietà specificate.

Valori possibili: valuemapid, name.
countOutput boolean Questi parametri sono descritti nel commento di riferimento.
editable boolean
excludeSearch boolean
filter object
limit integer
output query
preservekeys boolean
search object
searchByAny boolean
searchWildcardsEnabled boolean
sortorder string/array
startSearch boolean

Valori restituiti

(integer/array) Restituisce o:

  • una matrice di oggetti;
  • il conteggio degli oggetti recuperati, se il parametro countOutput è stato usato.

Esempi

Recupero delle mappe dei valori

Recupera tutte le mappe dei valori configurate.

Richiesta:

{
    "jsonrpc": "2.0",
    "method": "valuemap.get",
    "params": {
        "output": "extend"
    },
    "id": 1
}

Risposta:

{
    "jsonrpc": "2.0",
    "result": [
        {
            "valuemapid": "4",
            "name": "APC Battery Replacement Status"
        },
        {
            "valuemapid": "5",
            "name": "APC Battery Status"
        },
        {
            "valuemapid": "7",
            "name": "Dell Open Manage System Status"
        }
    ],
    "id": 1
}

Recupera una mappa dei valori con le relative associazioni.

Richiesta:

{
    "jsonrpc": "2.0",
    "method": "valuemap.get",
    "params": {
        "output": "extend",
        "selectMappings": "extend",
        "valuemapids": ["4"]
    },
    "id": 1
}

Risposta:

{
    "jsonrpc": "2.0",
    "result": [
        {
            "valuemapid": "4",
            "name": "APC Battery Replacement Status",
            "mappings": [
                {
                    "type": "0",
                    "value": "1",
                    "newvalue": "unknown"
                },
                {
                    "type": "0",
                    "value": "2",
                    "newvalue": "notInstalled"
                },
                {
                    "type": "0",
                    "value": "3",
                    "newvalue": "ok"
                },
                {
                    "type": "0",
                    "value": "4",
                    "newvalue": "failed"
                },
                {
                    "type": "0",
                    "value": "5",
                    "newvalue": "highTemperature"
                },
                {
                    "type": "0",
                    "value": "6",
                    "newvalue": "replaceImmediately"
                },
                {
                    "type": "0",
                    "value": "7",
                    "newvalue": "lowCapacity"
                }
            ]
        }
    ],
    "id": 1
}

Fonte

CValueMap::get() in ui/include/classes/api/services/CValueMap.php.