Fields parameter
The field parameter can be used to specify the fields of the returned object by adding
the query parameter "?fields" to a GET URL. For example,
?fields=field1,field2,parentField1.field1
.
You can use certain keywords to get the expected results in the response. The following list
provides the basic keywords that can be used with the fields parameter:
- ':none:'
- Returns only the fields that are mandatory to uniquely identify an object. For example, filesystemName and filesetName for a fileset. Use this keyword for queries that return more than one object. It indicates that only the keys that are needed to retrieve the full object are returned.
- ':all:'
- Returns all fields. Use this keyword in queries to a single object.
- Use the field name "." to query fields that are wrapped in a parent object. For example, use
?fields=config.iamMode
to query for "iamMode" in the following object."config" : { "iamMode" : "off" }
- Use parent name to query for all fields of a parent. For example,
?fields=config,afm
includes all fields of the parent objects "config" and "afm" - Multiple fields can be separated by using ",". For example,
?fields=config.iamMode,status.id
Examples
The following examples display the use of various keywords in the fields parameter.
curl -k -u admin:admin001 -X GET --header 'accept:application/json' 'https://198.51.100.1:443/scalemgmt/v2/filesystems/gpfs0/filesets?fields=:all:'
. This GET call returns the following response:{ "status": { "code": "200", "message": "..." }, "paging": { "next": "https://localhost:443/scalemgmt/v2/filesystems/gpfs0/filesets?lastId=1001" }, "filesets": [ { "config": { "filesetName": "myFset1", "filesystemName": "gpfs0", "path": "/mnt/gpfs0/myFset1", "inodeSpace": "0", "maxNumInodes": "4096", "permissionChangeMode": "chmodAndSetAcl", "comment": "Comment1", "iamMode": "off", "oid": "158", "id": "5", "status": "Linked", "parentId": "1", "created": "2016-12-13 13.59.15", "isInodeSpaceOwner": "1", "inodeSpaceMask": "0", "snapId": "0", "rootInode": "131075" }, "afm": { "afmTarget": "nfs://10.0.100.11/gpfs/afmHomeFs/afmHomeFileset2", "afmAsyncDelay": "0", "afmDirLookupRefreshInterval": "60", "afmDirOpenRefreshInterval": "60", "afmEnableAutoEviction": "false", "afmExpirationTimeout": "100", "afmFileLookupRefreshInterval": "30", "afmMode": "read-only", "afmNumFlushThreads": "4", "afmParallelReadChunkSize": "134217728", "afmParallelReadThreshold": "1024", "afmParallelWriteChunkSize": "0", "afmParallelWriteThreshold": "0", "afmPrefetchThreshold": "0", "afmPrimaryID": "string", "afmRPO": "0", "afmShowHomeSnapshots": "false" } } ] }
- GET /filesystems/gpfs0/filesets - The default keyword
:none:
is used in the GET request and this call returns only the key fields as shown in the following example.{ "filesets": [ { "config": { "filesetName": "(fs1)", "filesystemName": "gpfs0" }, "links": { "self": "https://198.51.100.1:8191/scalemgmt/v2/filesystems/gpfs0/filesets/fs1" } }, { "config": { "filesetName": "afmFset1", "filesystemName": "gpfs0" }, "links": { "self": "https://198.51.100.1:8191/scalemgmt/v2/filesystems/gpfs0/filesets/afmFset1" } } ] "status": { "code": 0, "message": "" } }
- GET /filesystems/gpfs0/filesets?fields=state.rootInode,state.id - Uses the field name "." for
querying fields that are wrapped in a parent object. This GET call return the following response.
{ "filesets": [ { "config": { "filesetName": "(fs1)", "filesystemName": "gpfs0" }, "links": { "self": "https://198.51.100.1:8191/scalemgmt/v2/filesystems/gpfs0/filesets/fs1" }, "state": { "id": 1, "rootInode": "latest", } }, { "config": { "filesetName": "afmFset1", "filesystemName": "gpfs0" }, "links": { "self": "https://198.51.100.1:8191/scalemgmt/v2/filesystems/gpfs0/filesets/afmFset1" }, "state": { "id": 2, "rootInode": 50692 } } ] "status": { "code": 0, "message": "" } }