Skip to main content

Properties (Elements)

Overview​

Properties (also known as _elements) are like the rows of a database table, but much more. Properties are contained within property types (collections).

They are used to establish a relationship or define something. That's why you can use properties sometimes as a resource and others as an asset. For example, you can send a specific text to all the users that have the "Special Message" property. Since each user is simply a collection or property type, you can add properties to them.

Additionally, workflows use properties to define their states.

As you can see, the versatility of properties is quite significant.

additional resources

These are just some of the most basic API requests. For a complete list of endpoints, consult our API documentation on Swagger.

Get Properties​

Returns all properties within the company.

GET /properties

Endpoint URL​

https://www.cotalker.com/api/v2/properties

Headers​

HeaderDescriptionRequiredValues
AuthorizationSends your access token to make an API request.
Click here to see how to obtain an access token.
RequiredBearer $ACCESS_TOKEN

Query Parameters​

ParameterDescriptionTypeRequiredNotes
searchReturns properties with field values that match the query.stringOptional
limitLimits the amount of properties returned in the response.numberOptionalBy default, the limit is set to 10.
pageMakes the response display data from the indicated page number.numberOptionalBest used in combination with the "limit" parameter.
countAdds the counter field with the total amount of properties within the company.booleanOptional
orderByOrders the properties by ascendeing or descending order according to their modifiedAt field.stringOptionalOptions: asc, desc
sortBySorts properties in the response according to the last time they were modified.stringOptionalOption: modifiedAt.
idsReturns properties with the IDs indicated in the array.ObjectId<COTProperty>[ ]Optional
parentReturns properties that have the properties indicated in the array as their parents.ObjectId<COTProperties>[ ]Optional
propertyTypesReturns all the properties that belong to the indicated property type. The property type is identified by its code.string[ ]Optionalcode is found in the COTProperyType data model.
codesReturns properties that have the name.code fields indicated in the array.string[ ]Optionalname.code is found in the COTPropery data model.
isActiveReturns properties according to their isActive status.stringOptionalOptions are: all, true, false
ownerGets properties that are associated to a user or task as an additional field. The query is done through the owner field in the COTProperty data model.objectOptionalSample:
'GET /properties?owner[$ref]=users
&owner[$id]=61a77fc936d18897da3e8fa5'
modifiedReturns properties with the indicated modification date in the modifiedAt field.ISODateOptionalYYYY-MM-DDTHH:mm:ss.SSSZ
modified_gtReturns properties modified after the indicated date and time.ISODateOptionalYYYY-MM-DDTHH:mm:ss.SSSZ
modified_gteReturns properties with a value in the modifiedAt field equal to or greater than the indicated date and time.ISODateOptionalYYYY-MM-DDTHH:mm:ss.SSSZ
modified_ltReturns properties modified before the indicated date and time.ISODateOptionalYYYY-MM-DDTHH:mm:ss.SSSZ
modified_lteReturns properties with a value in the modifiedAt field equal to or less than the indicated date and time.ISODateOptionalYYYY-MM-DDTHH:mm:ss.SSSZ
createdReturns properties with the indicated creation date in the createdAt field.ISODateOptionalYYYY-MM-DDTHH:mm:ss.SSSZ
created_gtReturns properties created after the indicated date and time.ISODateOptionalYYYY-MM-DDTHH:mm:ss.SSSZ
created_gteReturns properties with a value in the createdAt field equal to or greater than the indicated date and time.ISODateOptionalYYYY-MM-DDTHH:mm:ss.SSSZ
created_ltReturns properties created before the indicated date and time.ISODateOptionalYYYY-MM-DDTHH:mm:ss.SSSZ
created_lteReturns properties with a value in the createdAt field equal to or less than the indicated date and time.ISODateOptionalYYYY-MM-DDTHH:mm:ss.SSSZ
debugAdds the debug field with error notifications.stringOptionalOption: true

Request Samples​

This default request gets all the properties in the company.

curl --location --request GET 'https://www.cotalker.com/api/v2/properties' \
--header 'Authorization: Bearer $ACCESS_TOKEN

Response Sample​

Responses follow the COTProperty data model.


Get a Property by Id​

Returns the property indicated by the Id.

GET /properties/{id}

Endpoint URL​

https://www.cotalker.com/api/v2/properties/{id}

Path Parameters​

ParameterDescriptionTypeRequiredNotes
idThe ObjectId of the property that is to be returned.ObjectId<COTProperty>Required

Headers​

HeaderDescriptionRequiredValues
AdminGrants access to request the endpoint.Requiredtrue
AuthorizationSends your access token to make an API request.
Click here to see how to obtain an access token.
RequiredBearer $ACCESS_TOKEN

Query Parameters​

ParameterDescriptionTypeRequiredNotes
debugAdds the debug field with error notifications.stringOptionalOption: true

Request Sample​

curl --location --request GET 'https://www.cotalker.com/api/v2/properties/61a4b60ce8bbb302b9579440' \
--header 'Admin: true' \
--header 'Authorization: Bearer $ACCESS_TOKEN'

Response Sample​

The response follows the COTProperty data model.


Create a New Property​

Creates a new property within a collection.

POST /properties

Endpoint URL​

https://www.cotalker.com/api/v2/properties

Headers​

HeaderDescriptionRequiredValues
AdminGrants administrative access to create a new property.Requiredtrue
AuthorizationSends your access token to make an API request.
Click here to see how to obtain an access token.
RequiredBearer $ACCESS_TOKEN
Content-TypeIndicates the body's format.Requiredapplication/json

Query Parameters​

ParameterDescriptionTypeRequiredNotes
debugAdds the debug field with error notifications.stringOptionalOption: true

Request Body​

Only required fields are listed below. For a complete schema description, please go to the COTProperty data model. Unrequired fields that are not submitted are either filled in automatically or left blank.

ElementDescriptionTypeRequiredNotes
nameName settings.objectRequired
name.codeThe property's identification code.stringRequiredMaximum 60 characters; only lowercase letters, numbers, and underscores allowed; must be unique.
name.displayThe property's displayed name.stringRequired
propertyTypeThe code of the COTPropertyType associated with the property.stringRequired

Request Sample​

Property created with the minimum required fields:

curl --location --request POST 'https://www.cotalker.com/api/v2/properties' \
--header 'Admin: true' \
--header 'Authorization: $ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
"propertyType": "warehouse_supplies_00",
"name": {
"code": "paper_letter",
"display": "letter paper 8.5x11"
}
}'

Response Sample​

Go to COTProperty for a complete description of the response.

{
"_id": "61a4bbf40035762d5549c781",
"subproperty": [],
"isActive": true,
"propertyType": "warehouse_supplies_00",
"name": {
"code": "paper_letter",
"display": "letter paper 8.5x11"
},
"company": "6136968b580aaf2b0e49d844",
"createdAt": "2021-11-29T11:34:12.992Z",
"modifiedAt": "2021-11-29T11:34:13.010Z"
}

Update a Property​

Updates or edits an existing property's data.

PATCH /properties/{id}

Endpoint URL​

https://www.cotalker.com/api/v2/properties/{id}

Path Parameters​

ParameterDescriptionTypeRequiredNotes
idThe ObjectId of the property that is to be modified.ObjectId<COTProperty>Required

Headers​

HeaderDescriptionRequiredValues
AdminGrants administrative access to modify a property.Requiredtrue
AuthorizationSends your access token to make an API request.
Click here to see how to obtain an access token.
RequiredBearer $ACCESS_TOKEN
Content-TypeSets the body's format.Requiredapplication/json

Query Parameters​

ParameterDescriptionTypeRequiredNotes
debugAdds the debug field with error notifications.stringOptionalOption: true

Request Body​

Only the fields that are being updated or added are required to be put into the body. For a complete schema description, please go to the COTProperty data model.

Request Sample​

This sample adds a values to additional fields:

curl --location --request PATCH 'https://www.cotalker.com/api/v2/properties/61a4bbf40035762d5549c781?debug=true' \
--header 'Admin: true' \
--header 'Authorization: Bearer $ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
"schemaInstance": {
"description_1": "white",
"description_2": "plain",
"quantity": "100 reams"
}
}'

Response Sample​

Go to COTProperty for a complete description of the response.

{
"_id": "61a4bbf40035762d5549c781",
"subproperty": [],
"isActive": true,
"propertyType": "warehouse_supplies_00",
"name": {
"code": "paper_letter",
"display": "letter paper 8.5x11"
},
"company": "6136968b580aaf2b0e49d844",
"createdAt": "2021-11-29T11:34:12.992Z",
"modifiedAt": "2021-11-29T12:45:48.923Z",
"schemaInstance": {
"description_1": "white",
"description_2": "plain",
"quantity": "100 reams"
}
}