Skip to main content

Types

Whether you are defining the type of request parameters for an endpoint, types of endpoint responses or type of fields of a complex type model you need to know about the available types. The type can be primitive or complex.

Native/Scalar Types

TypeDescriptionExample
StringString type e.g. string, NSString*hello world
BooleanBoolean type e.g. bool, BOOLtrue
NumberInteger type e.g. int, Integer1
PrecisionNumerical precision e.g. double1.5
DateTimeDate and Time type, e.g. Datetime2016-03-13T12:52:32.123Z
DateDate type, e.g. Datetime with time nullified2016-03-13

Additional Types

TypeApplicable ToDescription
VoidResponse TypeResponse is empty and has no type
DynamicAllIf the type schema is not known or cannot be easily defined, you may use the Dynamic option
ObjectEndpoint Parameter Type, Model Field TypeObject data e.g. object
BinaryEndpoint Response Type, Model Field TypeBinary data, e.g. stream, NSData*
LongEndpoint Parameter Type, Model Field TypeLong type e.g. long, Long
FileEndpoint Parameter TypeA file to be uploaded
UUIDEndpoint Parameter Type, Model Field TypeThis type will store a Universally Unique Identifier (UUID)

Complex Types

All custom types described in the Types section of the API are considered complex types.

Attributes

In addition to specifying the type of a field, other type-specific attributes can also be added using the Attributes option.

Attributes

note

This option is available for only String, Number, Precision, Long, DateTime and Object types.

String Attributes

These attributes help define String type fields in more detail.

String Attributes

Available attributes are:

Attribute NameDescriptionExample
Minimum LengthSpecify the minimum length of the string value. The string value must have a length that is greater or equal to the one specified here.Valid strings for 3 can be abc, hello but not ab.
Maximum LengthSpecify the maximum length of the string value. The string value must have a length that is less or equal to the one specified here.Valid strings for 5 can be ab, abc but not abcdef
PatternSpecify the regular expression using ECMAScript that the input string value must match.Valid string values for [A-Z]+ will contain at least one alphabet in upper case e.g. Hello

Number Attributes

These attributes help define Number, Precision and Long type fields in more detail.

Number Attributes

Available attributes are:

Attribute NameDescriptionExample
Multiple ofA numeric instance is only valid if division by this attribute's value results in an integer. The value of this attribute MUST be a number, strictly greater than 0.Valid numeric instances for 2 in this case are 4, 6, etc.
MinimumA numeric instance is only valid if the attribute Exclusive Minimum is true and instance is greater than the provided value, or else if the instance is greater than or exactly equal to the provided value. The value of this attribute MUST be a number, representing a lower limit for a numeric instance.Valid numeric instances for 5 can be 7, 10 but not 4
MaximumA numeric instance is only valid if the attribute Exclusive Maximum is true and instance is less than the provided value, or else if the instance is less than or exactly equal to the provided value. The value of this attribute MUST be a number, representing an upper limit for a numeric instance.Valid numeric instances for 10 can be 8, 4 but not 12
Total DigitsThe maximum number of digits allowed in a number including fractional digits that exist in the value (after ignoring the decimal point and negative sign if any).Valid numeric instances for 4 can be 12.34, 1234 but not 12345
Fraction DigitsThe maximum number of digits allowed after the decimal point.Valid numeric instances for 2 can be 12.34, 2.45 but not 12.345
PatternSpecify the regular expression using ECMAScript that the input numeric value must matchValid numeric instances for \d{4} can be 1234, 4567 but not 12345
Exclusive MinimumThis attribute is used along with Minimum. If set to true, the number value should not be equal to the minimum value set in Minimum.If true and Minimum is set to 2 then valid numeric instances can be 3, 4 but not 2.
Exclusive MaximumThis attribute is used along with Maximum. If set to true, the number value should not be equal to the maximum value set in Maximum.If true and Maximum is set to 4 then valid numeric instances can be 1, 2 but not 4.

DateTime Format

The attribute, DateTime Format, can be specified with the DateTime types. It is the format string for the particular parameter, response or property.

DateTime Format

The supported formats are:

FormatDescriptionExample
Rfc3339ISO8601 full date time string2016-03-13T12:52:32.123Z
Rfc1123HTTP formatted date stringMon, 15 Jun 2009 20:45:30 GMT
UnixTimestampUnix or Epoch time. Seconds since Jan 01 1970 UTC1480809600
note

The specified datetimes will be serialized and deserialized according to the date format chosen.

Object Attributes

These attributes help define Object type fields in more detail.

Object Attributes

Available attributes are:

Attribute NameDescriptionExample
Minimum PropertiesSpecify the minimum number of properties that must be present in the object value instance.5
Maximum PropertiesSpecify the maximum number of properties that must be present in the object value instance.10