Skip to main content

Endpoints and Data Access

This section outlines the operations available for interacting with dataClass entities through REST API requests. It includes direct interactions with entities, manipulation through class functions, and detailed querying capabilities.

Available Endpoints

Overview

EndpointExampleDescription
/rest/dataClass/EmployeeRetrieves all entities within the dataClass, defaulting to the first 100 entities.
/rest/dataClass[key]/Employee[22]Fetches details for a specific entity identified by the primary key within the dataClass.
/rest/dataClass:attribute(value)/Employee:firstName(John)Retrieves entities where a specific attribute matches the given value.
/rest/dataClass/dataClassClassFunction/City/getCityExecutes a class function that affects the entire data class.
/rest/dataClass/entitySelectionClassFunction/City/getPopulation/?$filter="ID<3"Executes a function on a selection of entities, with optional filter parameters.
/rest/dataClass[key]/entityClassFunctionCity[2]/getPopulationPerforms a function on a specific entity identified by the key within the dataClass.
info

For detailed descriptions and usage of class functions, refer to the Class Functions documentation.

rest/dataClass

Purpose

The endpoint rest/{{dataClass}} returns all entities within a dataClass, such as Company. By default, the system fetches the first 100 entities unless specified otherwise through query parameters like $top or $limit.

Properties Returned

The rest/{{dataClass}} endpoint returns structured information as outlined in the following table:

PropertyTypeDescription
__DATACLASSStringSpecifies the data class targeted by the query.
__entityModelStringSpecifies the entity model used in the query.
__GlobalStampIntegerServer-wide modification timestamp.
__COUNTIntegerNumber of entities affected by the query.
__FIRSTIntegerIndex of the first entity in the query results.
__ENTITIESArrayArray of objects, each representing an entity within the dataClass with all its attributes and relational links.

Each entity includes:

KeyTypeDescription
__KEYStringUnique key for the entity.
__TIMESTAMPStringTimestamp of the last update to the entity.
__STAMPIntegerVersion stamp for the entity.
IDIntegerIdentifier of the entity.
NameIntegerExample attribute, e.g., name of user.
OrdersObjectExample attribute, e.g., details about the orders, using deferred loading.

Sample Usage Example in Postman

How to Use:

  • Method: GET
  • URL: {{ApiEndpoint}}/rest/Users

The response structure for the /rest/Users endpoint looks something like this in practice:

{
"__DATACLASS": "Users",
"__entityModel": "Users",
"__GlobalStamp": 0,
"__COUNT": 2,
"__FIRST": 0,
"__ENTITIES": [
{
"__KEY": "2",
"__TIMESTAMP": "2024-05-09T16:50:24.070Z",
"__STAMP": 3,
"ID": 2,
"Name": "user2",
"Email": "user2@example.com",
"Orders": {
"__deferred": {
"uri": "/rest/Users[2]/Orders?$expand=Orders"
}
}
},
{
"__KEY": "1",
"__TIMESTAMP": "2024-05-09T16:50:24.070Z",
"__STAMP": 3,
"ID": 1,
"Name": "user1",
"Email": "user1@example.com",
"Orders": {
"__deferred": {
"uri": "/rest/Users[1]/Orders?$expand=Orders"
}
}
}
],
"__SENT": 2
}

rest/dataClass[key]

Purpose

The rest/{{dataClass}}[{{key}}] endpoint fetches detailed information for a single entity within a dataClass using its primary key.

info

The properties returned mirror those in /rest/{{dataClass}}, focused on a single specified entity.

Sample Usage Example in Postman

How to Use:

  • Method: GET
  • URL: {{ApiEndpoint}}/rest/Users[2]

The response structure for the /rest/{{dataClass}}[2] endpoint looks something like this in practice:

{
"__entityModel": "Users",
"__DATACLASS": "Users",
"__KEY": "2",
"__TIMESTAMP": "2024-05-09T16:50:24.070Z",
"__STAMP": 3,
"ID": 2,
"Name": "user2",
"Email": "user2@example.com",
"Orders": {
"__deferred": {
"uri": "/rest/Users[2]/Orders?$expand=Orders"
}
}
}

rest/dataClass:attribute(value)

Purpose

The rest/{{dataClass}}:{{attribute}}({{value}}) endpoint retrieves entities within a dataClass where a specific attribute matches a given value.

info

The properties returned mirror those in /rest/{{dataClass}}, focused on a single specified entity.

Sample Usage Example in Postman

How to Use:

  • Method: GET
  • URL: {{ApiEndpoint}}/rest/Users:Name(user1)

The response structure for the /rest/Users:Name(user1) endpoint looks something like this in practice:

{
"__entityModel": "Users",
"__DATACLASS": "Users",
"__KEY": "1",
"__TIMESTAMP": "2024-05-09T16:50:24.070Z",
"__STAMP": 3,
"ID": 1,
"Name": "user1",
"Email": "user1@example.com",
"Orders": {
"__deferred": {
"uri": "/rest/Users[1]/Orders?$expand=Orders"
}
}
}

Attribute Retrieval

Selecting Specific Attributes

You can specify which attributes to include in the response directly in the API request URL. This capability allows users to retrieve only necessary data, reducing bandwidth and improving response times.

Syntax and Examples

Use CaseSyntaxExample
DataclassSpecify attributes directly after the data class in the URL.GET {{ApiEndpoint}}/rest/Employee/Name,Department
Collection of EntitiesSpecify attributes for a collection of entities, using filters.GET {{ApiEndpoint}}/rest/Employee/Name,Department/?$filter="Department='HR'"
Specific EntityRetrieve attributes for a specific entity by ID.GET {{ApiEndpoint}}/rest/Employee[123]/Name,Department
Attribute MatchingFetch entities where a specific attribute matches a given value.GET {{ApiEndpoint}}/rest/Employee:Department(HR)/Name,Title
Entity SelectionSpecify attributes when accessing an entity set.GET {{ApiEndpoint}}/rest/Employee/Name,Department/$entityset/528BF90F10894915A4290158B4281E61
tip

Attributes must be delimited by commas, e.g., /Employee/Name,Department,Salary.

Beyond direct attributes, the REST API supports fetching related entity attributes using the $attributes parameter, which can streamline obtaining comprehensive entity details in a single request.

Example

To include the employer's name and address along with employee details:

GET {{ApiEndpoint}}/rest/Employee?$attributes=name,employer.name,employer.address