Skip to main content

Read

Basic​

This method interacts with the Basic Read endpoint to retrieve a single resource by its identifier.

Usage​

const response = await userService.read('656cd57be338c0057899a597');

Parameters​

ParameterTypeDescription
identifierstringUnique identifier of the resource to be retrieved.
optionsReadOptions (optional)Additional options for customizing the read operation.
axiosRequestConfigAxiosRequestConfig (optional)Axios request configuration for fine-tuning the HTTP request.
interface ReadOptions {
includePermissions?: boolean; // Include permissions in the response.
tryList?: boolean; // Attempt to retrieve the resource using the list operation.
ignoreCache?: boolean; // Ignore cache and fetch fresh data.
sq?: sqOptions; // Options related to Sub-Query.
}

Response​

PropTypeDescription
successbooleanIndicates whether the request was successful.
statusnumberHTTP status code of the response.
messagestringA message providing additional information about the response, especially in case of errors.
rawobjectRaw data received from the server.
dataModelParsed data represented as an array of Model instances.
headersobject[AxiosHeaders]Axios headers associated with the response.
{
success: true,
status: 200,
raw: {
_id: '656cd57be338c0057899a597',
name: 'John',
role: 'user',
public: true,
_permissions: {}
},
data: Model {
_id: [Getter/Setter],
name: [Getter/Setter],
role: [Getter/Setter],
public: [Getter/Setter],
_permissions: [Getter/Setter]
},
headers: Object [AxiosHeaders] {}
}

Advanced​

This method interacts with the Advanced Read endpoint to retrieve a single resource by its identifier with advanced options.

Usage​

const response = await userService.readAdvanced('656cd57be338c0057899a597', { select: ['name'] });

Parameters​

ParameterTypeDescription
identifierstringUnique identifier of the resource to be retrieved.
argsReadAdvancedArgs (optional)Advanced arguments for controlling the read operation.
optionsReadAdvancedOptions (optional)Additional options for customizing the advanced read operation.
axiosRequestConfigAxiosRequestConfig (optional)Axios request configuration for fine-tuning the HTTP request.
interface ReadAdvancedArgs {
select?: Projection; // Projection for selecting specific fields.
populate?: Populate[] | Populate | string; // Data to populate in the response.
include?: Include | Include[]; // Additional resources to include in the response.
}

interface ReadAdvancedOptions {
includePermissions?: boolean; // Include permissions in the response.
tryList?: boolean; // Attempt to retrieve the resource using the list operation.
populateAccess?: PopulateAccess; // Options for populating access-related data.
ignoreCache?: boolean; // Ignore cache and fetch fresh data.
sq?: sqOptions; // Options related to Sub-Query.
}

Response​

PropTypeDescription
successbooleanIndicates whether the request was successful.
statusnumberHTTP status code of the response.
messagestringA message providing additional information about the response, especially in case of errors.
rawobjectRaw data received from the server.
dataModelParsed data represented as an array of Model instances.
headersobject[AxiosHeaders]Axios headers associated with the response.
{
success: true,
status: 200,
raw: {
_id: '656cd57be338c0057899a597',
name: 'John',
_permissions: {}
},
data: Model {
_id: [Getter/Setter],
name: [Getter/Setter],
_permissions: [Getter/Setter]
},
headers: Object [AxiosHeaders] {}
}

Advanced Filter​

This method interacts with the Advanced Read Filter endpoint to retrieve a single resource by filter.

Usage​

const response = await userService.readAdvancedFilter({ name: 'John' }, { select: ['name'] });

Parameters​

ParameterTypeDescription
filterFilterQueryQuery to filter the resources.
argsReadAdvancedArgs (optional)Advanced arguments for controlling the read operation.
optionsReadAdvancedOptions (optional)Additional options for customizing the advanced read operation.
axiosRequestConfigAxiosRequestConfig (optional)Axios request configuration for fine-tuning the HTTP request.
interface ReadAdvancedArgs {
select?: Projection; // Projection for selecting specific fields.
populate?: Populate[] | Populate | string; // Data to populate in the response.
include?: Include | Include[]; // Additional resources to include in the response.
}

interface ReadAdvancedOptions {
includePermissions?: boolean; // Include permissions in the response.
tryList?: boolean; // Attempt to retrieve the resource using the list operation.
populateAccess?: PopulateAccess; // Options for populating access-related data.
ignoreCache?: boolean; // Ignore cache and fetch fresh data.
sq?: sqOptions; // Options related to Sub-Query.
}

Response​

PropTypeDescription
successbooleanIndicates whether the request was successful.
statusnumberHTTP status code of the response.
messagestringA message providing additional information about the response, especially in case of errors.
rawobjectRaw data received from the server.
dataModelParsed data represented as an array of Model instances.
headersobject[AxiosHeaders]Axios headers associated with the response.
{
success: true,
status: 200,
raw: {
_id: '656cd57be338c0057899a597',
name: 'John',
_permissions: {}
},
data: Model {
_id: [Getter/Setter],
name: [Getter/Setter],
_permissions: [Getter/Setter]
},
headers: Object [AxiosHeaders] {}
}