Read
GET
GET Resource ById
To read a resource by key, perform a GET request specifying the id/key:
- Configure the HTTP request as GET.
- The complete URL is composed of:
server: variable based on server configuration.port: variable based on server configuration.rootPath:tse_webapi, NOT variable.version:v1, NOT variable.module: acronym, variable based on the resource's module.environment: variable based on the desired environment.resource: variable based on the resource name.id: variable based on the resource key.
- QueryString parameters:
user(optional): variable for the application user to impersonate; defaults to the authenticated user if not specified.company: variable for the company to use.
- HTTP headers configuration as described previously.
http://webapi_base_url/v1/environment/module/resource/id?company=XX&user=YYY
The response includes:
status:200 OK, variable based on the request type and execution result (see the list of available requests described earlier).headers: information about the response.body: the actual response content, in JSON (default) or XML format.
GET: webapi_base_url/v1/production/{module}/{resource}/0
Parameters
- id: identifier of the resource to read.
Response Codes
200: the requested{resource}DTOobject.404: if the object is not found.
SEARCH
Search Resource
To search for data related to a resource, perform a POST request specifying the search filter:
http://server:port/rootPath/v1/environment/module/resource/search?company=XX&user=YYY
Differences from the GET request:
- The HTTP request is now POST.
- The complete URL does NOT include the
idparameter, as it operates on all existing entities, not a specific record. - An additional parameter,
search, is NOT variable as it uniquely defines the search operation. - The request body specifies a single or multiple filters on the desired properties.
{
"filters": {
"items": [
{
"comparer": 30,
"operator": 0,
"propertyName": "numdocorig",
"value": "51"
}
]
}
}
The response includes:
-
status: request return status. -
headers: response information. -
body: the actual response content.tipThe response contains a list of objects matching the applied search filter. Each list element corresponds to the main resource structure defined for all operations, while related elements are NOT populated.
Advanced Search with Pagination and Sorting
Advanced search allows specifying pagination and sorting in the request body. For example, searching for documents from 6 to 10 (second page: the first page is PageNumber = 0), sorted by numreg in ascending order:
orderingProperties: list of<PropertyName, [ASC(0)|DESC(1)]>pairs for sorting.pageNumberandpageSize: specify pagination. Defaults to the first 50 elements if omitted.
Execute a Search
Perform a POST request on the resource “search":
{{webapi_base_url}}/rootPath/v1/{{scope}}/module/resource/Search?company={{defaultCompany}}&metadata=true&getTotalCount=true
HTTP Request Configuration as POST
The complete URL is composed of:
webapi_base_url: variable based on server configuration.rootPath: “api”, NOT variable.version: “v1”, NOT variable.scope: variable based on the desired environment.module: acronym, variable based on the resource's module.resource: acronym, variable based on the module.Search: “Search”, NOT variable.
Request Body
The request body is mandatory and must follow these rules:
- Contains a
filtersobject with a singleitemsproperty. - Each
Itemobject defines:Comparer: comparison operator.Operator: logical operator between array elements.PropertyName: property name to filter.Value: property value to filter.
Comparer Property
Comparer is an integer enum with possible values:
-
Equal: 0 -
NotEqual: 1 -
GreaterThan: 10 -
LessThan: 11 -
GreaterOrEqualThan: 12 -
LessOrEqualThan: 13 -
Contains: 20 -
NotContains: 21 -
StartsWith: 30 -
EndsWith: 40tipDefault value is
Equal(0) ifCompareris not specified.
Operator Property
Operator is an integer enum with possible values:
-
None: 0 -
And: 1 -
Or: 2 -
Not: 3tipDefault value is
None(0) ifOperatoris not specified. For arrays with two or more elements, specify a value other than 0 for subsequent elements.
QueryString Parameters
defaultCompany: variable for the company to use.metadata: “true”, optional; retrieves lookup metadata along with data.getTotalCount: “true”, optional; populates thetotalCountfield in the response.
Pagination and Sorting
PageSize: Specifies page size (default is 50). Set to -1 to retrieve all records.PageNumber: Specifies the page number to return (starting at 0).OrderingProperties: List of<key, value>pairs where the key is the DTO property name for sorting, and the value is the sorting type (ASC = 0,DESC = 1).
Response Codes
200: list of{resource}DTOobjects matching the search result.400: if the search filter is not specified.
VALIDATION
POST: webapi_base_url/v1/production/{module}/{resource}/validate
Parameters
- body: the
{resource}DTOobject to validate.
Response Codes
200: if the specified object is VALID.400: if the object to validate is not specified.409: if the specified object is INVALID; the response contains validation messages.
VALIDATION OF RESOURCE PROPERTIES
POST: webapi_base_url/v1/production/{module}/{resource}/validateproperties
Parameters
- id: identifier of a non-existent object to validate properties or for validating properties of a new object.
- body: one or more key-value pairs in x-www-form-urlencoded format, where the key is the DTO property name and the value is assigned before validation.
Response Codes
200: if the specified object properties are VALID.400: if the object properties to validate are not specified.409: if one or more specified properties are INVALID; the response contains validation messages.
LOOKUP
To perform a lookup, execute a GET request on the “lookup” resource:
{{webapi_base_url}}/rootPath/v1/{{scope}}/module/lookup/id?defaultcompany=000&metadata=true&_op=search
HTTP Request Configuration as GET
The complete URL is composed of:
webapi_base_url: variable based on server configuration.rootPath: “api”, NOT variable.version: “v1”, NOT variable.scope: variable based on the desired environment.module: acronym, variable based on the resource's module.resource: “lookup”, NOT variable.id: variable identifying the lookup to use (can correspond to an entity name or query descriptor).
QueryString Parameters
user: optional, variable for the application user to impersonate.defaultCompany: variable for the company to use.metadata: “true”, optional; retrieves lookup metadata along with data._op: must be set to 'search' to activate the search functionality.
Filters, Sorting, and Pagination
Filters, sorting, and pagination are passed in the request body in JSON format:
filters:Comparer: comparison operator.Operator: logical operator between array elements.PropertyName: alias name of the column to filter (e.g.,DocumentoTestataMG_Sezdoc).Value: property value to filter.
orderingProperties: optional; applies sorting (ascending or descending) on one or more fields in the lookup.pageNumber: optional; specifies a specific page of lookup results (0 is the first page, default value).pageSize: optional; defines page size (default is 50).
HTTP Headers
HTTP headers configuration as described previously.
Response
The response includes:
status: “200 OK”.headers: response information.body: lookup data and optionally its metadata.
Additionally, the filter parameter in QueryString allows a "quick" search on key fields and descriptive fields.
Available Lookups
GET: webapi_base_url/v1/production/FW/lookup/
Retrieve Lookup Data
GET: /api/v1/production/ModuleAcron/lookup/{lookupname}
POST: /api/v1/production/ModuleAcron/lookup/{lookupname}
Parameters
- moduleAcron: acronym of the lookup's module (e.g., CO, MG, ...).
- lookupName: name of the lookup for supported entities.
- metadata: if
true, retrieves lookup metadata (structure). - _op: must be set to 'search' to activate the search functionality.
- body: search filter in JSON format:
{
"filters": {
"items": [{
"comparer": 0,
"operator": 0,
"propertyName": "ItemWH_SubFamilyWH_CodFamMg53",
"value": "A"
}]
},
"pageNumber": 0,
"pageSize": 50,
"orderingProperties": {
"CustomerSupplierCO_Clifor": 0
}
}
Response Codes
200: an array of objects with the following structure:
{
"description": "string",
"lookupName": "string",
"href": "string"
}