Update

Updating a content could be achieved by sending an http PATCH or PUT request. You can call it by identifying the content that should be updated (this will be the path where you'll send the request), and adding an object with the fields and values that you want to update (this object will be sent in the request body). Both PATCH and PUT requests will return the updated content object in JSON.

Modifying a field of an entity

First let's change the color of a car to "Rosso Corsa":

Copy
PATCH https://example.com/OData.svc/Root/Content/Cars/AAXX123

models=[{"Color":"Rosso Corsa"}]
🛈 Special characters should be URL encoded

Modifying multiple fields at once

The following example shows you how you can change a cars's model and color fields at once:

Copy
PATCH https://example.com/OData.svc/Root/Content/Cars/OT1234

models=[{
  "Model":"126p",
  "Color":"Dark red"
}]
🛈 Special characters should be URL encoded

Update the value of a date field

In the next example you can see how you can update the starting date of car:

Copy
PATCH https://example.com/OData.svc/Root/Content/Cars/OT1234

models=[{"StartingDate":"1986-11-21T00:00:00"}]
🛈 Special characters should be URL encoded

Update a choice field

Updating choice fields is a tricky one. Let's see how you can change a cars's Style field to choose an option:

Copy
PATCH https://example.com/OData.svc/Root/Content/Cars/OT1234

models=[{"Style":["Roadster"]}]
🛈 Special characters should be URL encoded

Update the value of a reference field

The following example demonstrates how can you modify a reference field of an entity. Let's change the Manager of a workspace:

Copy
PATCH https://example.com/OData.svc/Root/Content

models=[{"Manager":1}]
🛈 Special characters should be URL encoded

You may use either content id or path in case of reference fields. In case of a multiple reference field you should provide an array of ids or paths, as you can see below:

Copy

Under construction

PATCH https://example.com/OData.svc/Root/Content
models=[{"Customers":["/Root/Customer1","/Root/Customer2"]}]

Setting (resetting) all fields of an entity

Using the PUT http method enables you to set multiple fields of an entity and clear (reset to the default) the rest. Let's set the manager of a workspace to businesscat and clear all other fields.

Copy
PUT https://example.com/OData.svc/Root/Content/Cars('OT1234')
models=[{
    "DisplayName":"Fiat 126",
    "Color":"Yellow"
}]
🛈 Special characters should be URL encoded