Update a Single Object

Partial Update on an Object

This function updates a single object of the given type and with the given ID. If no object with the specified object exists yet, an error is returned.
The ID must be a valid UUID **** , and must be lowercase. For example, 550e8400-e29b-41d4-a716-446655440000 is a valid UUID.
When updating objects using the JourneyApps API, use the UUIDs returned by JourneyApps (in the id field of each object) when you retrieve objects.
Relative URL
HTTP Request Method
/api/v4/app-instance-id/objects/model/object-id.json
PATCH
  • Replace model with the type of object that you wish to update (as defined in your app's Data Model).
  • Replace object-id with the ID of the specific object.

Parameters

The parameters must be specified in the same way as for creating new objects. Please refer to the same section at Creating a New Object and to the Field Representation section.
For updating more than one object in a request, refer to the Batch Operations section.

Response

The response includes the single updated object. The format of the object is the same as for Retrieving all Objects.

Example

In this example, we update only the status field of a task object.
The -X parameter to curl allows you to use a specific HTTP request method.
http
PATCH https://run-testing-us.journeyapps.com/api/v4/533bda53027894f69b001055/objects/tasks/198c990e-f1bf-11e1-8d7d-001cc01904e3.json
task[status]=1
curl
curl "https://run-testing-us.journeyapps.com/api/v4/533bda53027894f69b001055/objects/tasks/198c990e-f1bf-11e1-8d7d-001cc01904e3.json" \
-u "533bda53027894f69b001055:7Ajj5htRY1uzw7b4w23V" \
-X PATCH \
-d "task[status]=1"
ruby
require 'rest-client'
journey = RestClient::Resource.new "https://run-testing-us.journeyapps.com/api/v4", "533bda53027894f69b001055", "7Ajj5htRY1uzw7b4w23V"
journey["533bda53027894f69b001055/objects/tasks/198c990e-f1bf-11e1-8d7d-001cc01904e3.json"].patch :task=>{:status=>1}
Response:
json
{
"id": "198c990e-f1bf-11e1-8d7d-001cc01904e3",
"type": "task",
"updated_at": "2015-02-10T12:03:28Z",
"display": "Task 1",
"name": "Task 1",
"instructions": null,
"status": {
"key": 1,
"display": "Closed"
},
"category_id": null
}

Replacing an Object in its Entirety

This function replaces a single object of the given type and with the given ID. If no object with the specified object exists yet, a new object is created with the given ID.
The ID must be a valid UUID **** , and must be lowercase. For example, 550e8400-e29b-41d4-a716-446655440000 is a valid UUID.
When updating objects using the JourneyApps API, use the UUIDs returned by JourneyApps (in the id field of each object) when you retrieve objects.
Relative URL
HTTP Request Method
/api/v4/app-instance-id/objects/model/object-id.json
PUT
  • Replace model with the type of object that you wish to update (as defined in your app's Data Model).
  • Replace object-id with the ID of the specific object.

Parameters

The parameters must be specified in the same way as for creating new objects. Please refer to the same section at Creating a New Object and to the Field Representation section.
For updating more than one object in a request, refer to the Batch Operations section.

Response

The response includes the single updated object. The format of the object is the same as for Retrieving all Objects.

Example

In this example, we set only the name field of a task object. The other fields are cleared.
The -X parameter to curl allows you to use a specific HTTP request method.js
http
PUT https://run-testing-us.journeyapps.com/api/v4/533bda53027894f69b001055/objects/tasks/198c990e-f1bf-11e1-8d7d-001cc01904e3.json
task[name]=Task%201
curl
curl "https://run-testing-us.journeyapps.com/api/v4/533bda53027894f69b001055/objects/tasks/198c990e-f1bf-11e1-8d7d-001cc01904e3.json" \
-u "533bda53027894f69b001055:7Ajj5htRY1uzw7b4w23V" \
-X PUT \
-d "task[name]=Task%201"
ruby
require 'rest-client'
journey = RestClient::Resource.new "https://run-testing-us.journeyapps.com/api/v4", "533bda53027894f69b001055", "7Ajj5htRY1uzw7b4w23V"
journey["533bda53027894f69b001055/objects/tasks/198c990e-f1bf-11e1-8d7d-001cc01904e3.json"].put :task=>{:name=>"Task 1"}
Response:
json
{
"id": "198c990e-f1bf-11e1-8d7d-001cc01904e3",
"type": "task",
"updated_at": "2015-02-10T12:01:25Z",
"display": "Task 1",
"name": "Task 1",
"instructions": null,
"status": null,
"category_id": null
}
Copy link
On this page
Partial Update on an Object
Parameters
Response
Example
Replacing an Object in its Entirety
Parameters
Response
Example