Null Members; Enumerations - HP 3PAR StoreServ 7200 2-node Manual

Hp 3par web service api 1.2 developer's guide (qr482-96192, june 2013)
Hide thumbs Also See for 3PAR StoreServ 7200 2-node:
Table of Contents

Advertisement

For example, to create a volume, the only members required are the name of the volume, the name
of the CPG that provides disk space for the volume, and the size of the volume. Optional members
include the ID of the volume and a comment.
When constructing a JSON object, optional members may be omitted or set to values that indicate
the server should ignore them. The client sets only the fields of interest. The JSON object need not
include all members. A client can perform one of two possible operations when creating the JSON
object:
Include only the members required for the operation
or
Include a member that is not required, but with a value that means it should be ignored.
NOTE:
A JSON array with no elements is considered empty.
Objects and arrays composed of sub-objects or sub-arrays that are empty are themselves
considered empty.
Although objects and arrays can be present and named in input, if they are considered empty,
the server may respond as if the objects and arrays are not present, and may return an error
stating that required members are missing.
When writing a client in a language that provides services for serializing a class into a JSON
object, it is convenient to only have a single class that represents all required or optional members.
The following sections specify the special values to use to ignore a member.

Null Members

The WSAPI supports properties with a value of null. Clients written in languages that provide classes
(or objects) as alternatives to primitives may generate JSON objects such that the value of the
property will be null. Null properties are ignored by the WSAPI.
For example, a client written in Java that uses the Jackson JSON processor, with attributes cast as
Boolean or Integer that are not initialized, will result in JSON properties with a value of null
when using the Jackson JSON processor. Conversely, uninitialized attributes cast as boolean or
int will result in JSON properties with a value of 0 (zero)—which may or may not be meaningful
for the property.
When the API server returns information, it does not include explict null values in the JSON object
for properties that have no value or that are unset. For example, querying a volume that is not in
a domain will return a JSON object with the domain field omitted rather than containing
<domain>:null.

Enumerations

Some properties have values from a fixed set of limited values. For example, the state property of
a storage volume can be one of the following:
Normal
Degraded
Failed
When properties like these are present in a JSON object, they are represented numerically.
In addition to the values shown in the definition of an enumeration, each enumeration can also
have the value of - 1 , meaning that the API server has encountered a value that it does not recognize
and therefore cannot assign a value from the valid set. This usually means that the user has entered
an invalid enumeration value or that there is a defect in the API server.
26
Accessing the WSAPI
A JSON object that has only ignored fields or null fields will be considered empty.

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents