Custom Properties In The API

Custom properties are extremely useful, when you want to record data in OfficeRnD that can't be entered in the fields available by default.

You can learn more on how they work and how you can set them up here.

This article is going to explore how custom properties are displayed in our publically available API.

You can add as many custom properties as you've created in the "Settings" section.
The properties section for each endpoint is basically an object with separate values for each property.

Depending on the type of custom property the notation of those values might change.
For example, if the custom property is of type "Number" then they'll look as follows (no quotes):

"CustomProperty1": 123

Note: The notation above is the same for properties of type "Boolean".

While for string the notation is as follows:

"CustomProperty2": "123"

Please note that for the request body we're using the unique identifier of the property and not its name:

Once created the property's identifier cannot be changed, only its name.

How To Set Or Update a Custom Property 

In order to update a custom property to a member you can execute a PUT request to the respective endpoint.

Note: It doesn't matter whether you're going to be setting a fresh value of the property for a member or updating an existing value, you can use this method for both cases.

The endpoint  in the request URL depends on what the custom property applies to.
The example below is for a custom property that applies to members.

Example
Request method: PUT
Request URLhttps://app.officernd.com/i/organizations/org-slug/members/member-id
Request body:

{
 "properties": {
  "CustomProperty1": "test1",
  "CustomProperty2": "test2",
  "CustomProperty3": "test3",
  "CustomProperty4": "test4"
 }
}

Note: When you're making a PUT request for the properties object you're updating each property separately.

For example if a member has 2 properties recorded and you try to put a third one, then the total number of properties recorded for that member will be 3, so the new one won't replace the previous ones, the object will just be expanded.

Removing Custom Property Values

If you'd like to remove the value of a custom property for a specific object you should set it to null (no quotes, regardless of the property type).
For example:

"RemoveProperty": null
Was this article helpful?
0 out of 1 found this helpful
Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.