Data Types in Parameters and Models
- Last UpdatedNov 06, 2025
- 2 minute read
Data Types in Input Parameters
When creating the content to pass to the Web API, the parameters are added directly to the URL by appending first the ? symbol and then a & for additional parameters. For example:
https://hostname/mesmw/api/v3/entity?entName=Roaster&description=Coffee Bean Roaster
The parameters will always be provided as a string even in cases where the parameter is looking for a specific ID that is an integer in the database.
Data Types in Models
When creating the content to pass as a JavaScript JArray model in the endpoint's request body to the Web API, each element in the model is listed followed by a colon (:) and then the value. Additional elements are separated by a comma (,).
For example, a lot attribute model looks like:
{item_id: “ABC”, lot_no: “Lot123”, attr_id: 4, attr_value: “MyData”}
Data Types Used
The following data types are used within the Web API. Note that omitting an element from the model will set that element value to the data type's default value (integers default to 0, datetimes default to DateTime.MinValue, and strings and nullables default to null).
- String data types must be enclosed in double quotes.
- Integer data types pass the numeric value.
- Number data types pass the numeric value with the decimal separator.
- Datetime data types are passed as strings using the ISO 8601datetime format. See MES and datetimes.
- Boolean data types are passed using false/true (or 0/1).
Some models include properties that are also either models or arrays of models. For example, the SampleCharsResults model contains a property that is an array of SampleCharResults. The SampleCharResults has one property that is SampleChar model and a second property that is an array of Result models. Arrays are indicated by the square bracket ([ ]) characters, with each array element within the array enclosed with the curly bracket ({ }) characters.
The following example demonstrates the SampleCharsResults model for recording three results for two characteristics within a sample. It is not updating the sample characteristic values and is therefore doesn't include the SampleChar model property in the SampleCharResults model.
{sample_id: 225, created_by: "MyDomain\\MyUser", created_at_utc: "2020-08-22 12:34:56", char_results: [{char_name: "VarChar1", results: [{value_no: 1, result_value: 5.6, act_sample_size: 1}, {value_no: 2, result_value: 5.9, act_sample_size: 1}, {value_no: 3, result_value: 5.3, act_sample_size: 1}]}, {char_name: "VarChar2", results: [{value_no: 1, result_value: 8.6, act_sample_size: 1}, {value_no: 2, result_value: 8.9, act_sample_size: 1}, {value_no: 3, result_value: 8.3, act_sample_size: 1}]}]}