You are viewing the Resources for the older version of JourneyApps (V3). JourneyApps V4 is the new default for all new apps since July 1, 2016.

Creating a Single New Object

This function creates a single new object of the given type.

Relative URL HTTP Request Method
/api/v1/object-type.format POST
Note: Replace object-type with the type of object that you wish to create (as defined in your app's Data Model), for example 'person', 'job' or 'asset'. Replace format with the response data format (json or xml), or leave it out.

Parameters

A hash needs to supplied containing the following:

  • Attributes: Attributes as defined in your app's Data Model
  • Relationships: IDs of related objects that the object belongs to specified by using the relationship name and appending it with _id
For the format of all the different attribute types, see the Attribute Representation section.

The key of this hash has to be the name of the object type (see example below). In the following example of parameters in JSON format, the object type name is car and it has three attributes: make, model and number_plate and one relationship: it belongs to a warehouse.

Please Note: Setting photo and signature attributes is not yet supported by the JourneyApps API. If a parameter for a photo or signature attribute is supplied to the JourneyApps API, it will be ignored. Take a look at Attribute Representation for more details.

Response

The response includes the single newly created object. The format of the object is the same as for Retrieving All Objects.

Example

Parameters as URL-encoded key-value pairs: (refer to Request Parameter Formats)

Parameters as JSON:

Tip: The -H parameter to curl allows you to specify a custom HTTP header.

Bulk/Batch Creating Objects

You can create multiple objects of the same type in one operation by changing the hash in your parameters to an array of hashes.

For example, by using these parameters, we would be able to create two objects at once:

An example of an API call with curl with the above parameters:

An array of all the objects that were created will be returned in the response:

Previous Section Next Section