Specifying the Target Object
Most operations involving objects require specifying a target object. For example:
- Fetching an object requires identifying the object to be retrieved.
- Updating an object requires specifying the object to be modified.
- Deleting an object requires specifying the object to be removed.
- Creating a new document requires specifying the folder where the document will be stored.
We have two ways to specify the target object:
- Via
objectId
(using the unique identifier of the object) - Via
path
(using the human-readable location of the object in the repository)
Via Object ID
Every object has an automatically assigned ID in the form of the objectId
property. Setting this ID into the objectId
request parameter specifies the target object for the operation.
When using this approach, the request URL only needs to specify the repository host.
Using objectId
is useful when:
- You do not know or do not need to know the object's location in the folder structure.
- The object's path might change, but its ID remains constant.
- You retrieve an object through a search query and need to reference it directly.
- You work with an object programmatically, without concern for its position in the hierarchy.
GET Request Example - To fetch an object using its objectId
, include the parameter in the request:
curl -X 'GET' \
'{REPOSITORY_URL}?operation=object&objectId={target_objectId}'
POST Request Example - To create a new object within a specified folder, pass the folder's objectId
as a parameter:
curl -X 'POST' \
'{REPOSITORY_URL}' \
-H 'Content-Type: multipart/form-data' \
-F 'operation=createObject' \
-F 'objectId={target_folder_objectId}' \
-F 'properties={"name":"Rex","objectTypeId":"document"}'
Via Path
The path
is set by appending /root
followed by the object's location to the repository URL. The /root
prefix
indicates the root folder of the repository.
Using path
is useful when:
- You need to reference an object by its logical location in the hierarchy.
- The object’s structure is important, such as when working with folder-based organization.
- You are manually browsing the repository or working interactively (e.g., during testing or debugging).
- You want to reference objects in a human-readable way, avoiding the need to look up their
objectId
.
GET Request Example - To fetch an object using its path, include the full path in the URL:
curl -X 'GET' \
'{REPOSITORY_URL}/root/Animals/Dogs/Rex?operation=object'
POST Request Example - To create a new object within a specific folder, use the folder's path in the request URL:
curl -X 'POST' \
'{REPOSITORY_URL}/root/Animals/Dogs' \
-H 'Content-Type: multipart/form-data' \
-F 'operation=createObject' \
-F 'properties={"name":"Rex","objectTypeId":"document"}'