V1
The JourneyApps API (V1) → 10. Attribute Representation
Attribute Representation
The following guidelines apply for the values of object attributes in the API (see Attribute & Variable Types for the full list of attribute types supported by JourneyApps).
Type | Format returned in API response | Format accepted for create and update |
---|---|---|
string |
The string in standard JSON or XML format. Example: make: "Nokia"
|
Any string in standard JSON or XML format. Example: make: "Nokia"
|
int |
The number in standard JSON or XML format. Example: count: 42 .
|
Any integer in standard JSON or XML format. Example: count: 42 .
|
decimal |
The number in standard JSON or XML format. Example: pi: 3.1428 .
|
Any decimal number in standard JSON or XML format. Example: pi: 3.1428 .
|
date |
A date in the format YYYY-MM-DD , as defined by the
ISO 8601 specification. Example:
date: "2013-02-22" .
|
Any valid date according to the ISO 8601 specification.
Any time or timezone components will be stripped. The YYYY-MM-DD format is recommended.
Example: date: "2013-02-22"
|
datetime |
A date and time in the format YYYY-MM-DDTHH:MM:SSZ , as defined by the
ISO 8601 specification.
Note that the time is specified in the UTC/GMT timezone. Example:
time: "2013-02-22T14:00:53Z" .
|
Any valid date and time according to the ISO 8601
specification. The YYYY-MM-DDTHH:MM:SSZ format is recommended. Example:
time: "2013-02-22T14:00:53Z" .
|
enum |
The numeric index of the enum option. For example, if your enum has options Open and Closed,
Open will be represented as 0, and Closed will be represented as 1. Example:
status: 1 .
Note: If you need to retrieve the possible options that your enum attributes have, please see the section Getting an App's Data Model |
The value supplied must be either the exact text of the option, or the numeric index of the enum option.
For example, if your enum has options Open and Closed (in that order), use a value of
Open or 0 to set it to Open and a value of Closed or
1 to set it to Closed. It is recommended to use the numeric indices. Example:
status: 1 or status: "Closed" .
|
enum_set |
An array of enum values (numeric indices), as explained above. Example: categories: [0,2,3]
|
An array of enum values (text or numeric indices), as explained above. It is recommended to use the
numeric indices. Example: categories: [0,2,3] or ["Red", "Green", "Blue"] .
|
location | Hash with fields latitude, longitude, altitude, horizontal_accuracy, vertical_accuracy and timestamp. Note that altitude and vertical_accuracy are typically not reported by mobile devices, and only latitude and longitude can currently be edited on the JourneyApps Backend data browser. The timestamp is automatically populated when the location is captured. Example: |
A hash with fields latitude and longitude (both decimal numbers), and optionally altitude, horizontal_accuracy, vertical_accuracy (all decimal numbers) and timestamp (a date and time in the format YYYY-MM-DDTHH:MM:SSZ , as defined by ISO 8601). Leaving the timestamp blank will cause the current time to be used. If you update an existing GPS location and omit the altitude, horizontal_accuracy or vertical_accuracy fields, any existing values in those fields will be set to null .
Example:
|
Photos and signatures (attachments) | Photos and signatures can be retrieved using the display_attachments field that is included in API responses for each object. display_attachments contains fields for all the attachment attributes in the object, and each field in turn contains relative URLs for different sizes of the particular photo or signature image. See the section Retrieving Photos/Signatures for more details. | A hash with fields base64, containing the Base64 representation of the attachment file, and filename, containing the name of the file. Example: (Note that the line breaks in the example are for display purposes only; base64 must not contain additional newlines.) |
Relationships |
Relationships use the relationship name plus _id as the key, with the related object id
as the value. Only belongs to relationships are included in the object itself, has many
relationships should be queried and/or set from the other side of the relationship. Example:
building_id: "9913706a-179b-11e2-aaff-0026189d9dc0" .
|
The same format is used for setting relationships. Example:
building_id: "9913706a-179b-11e2-aaff-0026189d9dc0" .
|
Values Not Present
When retrieving objects, an attribute not present should be interpreted the same as a null
value for that attribute. This applies for all attribute types, as well as relationships.
When updating an object with Updating an Object, setting the
attribute to null
will clear that attribute. On the other hand, omitting the attribute will
leave its value unchanged. This applies for all attribute types, as well as relationships.
Next Section:
11. Retrieving Photos/Signatures
Previous Section
Next Section