Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

MES Web API V3

Method Format and Syntax

The MES Web API includes standard Put, Post, Get, and Delete methods to interact with the MES database.

  • POST Generally used when the call inserts new records into the MES database.
  • PUT Generally used when the call updates existing records in the MES database.
  • GET Used to return information from the MES database.
  • DELETE Used to remove records from the MES database.

General Format

The general format of the Web API is:

API?Filter=FilterValue&Filter2=Filter2Value

This document lists all the names and the corresponding filter parameters. The endpoint name is followed by the ? symbol to indicate the start of the filters. If no filters are needed, then do not include the ? symbol.

To include multiple filters, separate each with the & symbol.

Endpoint entries are case insensitive.

Syntax

Since the Stateless API often has many additional methods beyond the four standard Web API calls, the V3 version of the Web API employs additional lower level endpoints to separate the different options.

For example, many Stateless API classes have a GetAll, GetByKey, and GetByFilter method and return the same or different datasets with each call. In the Web API, the GetAll is the GET at the base level while the others are noted with /key and /filter at the end of the URL path. Here are examples for the Entity endpoint GETs and the Stateless API methods to which they map:

mesmw/api/v3/entity = Core.Ent.GetAll

mesmw/api/v3/entity/key = Core.Ent.GetByKey

mesmw/api/v3/entity/filter = Core.Ent.GetByFilter

mesmw/api/v3/entity/name = Core.Ent.GetEntID

Nearly all the GET Web API endpoints require filter parameters to identify what records to return from the database. Some Get methods have no filter or optional filter parameters. GETs return a JSON object or JSON array based on the stored procedure return columns.

The DELETE Web API endpoints require the key field in the database so that only a single record will be deleted at a time.

POSTs and PUTs use models in the request body to provide input parameters. The new or updated database table record is returned in the response body as a model as well.

Note: There is no equivalent to the Stateless APIs for UpdateSpecific. When using a Web API PUT, all the fields in the model are required as there is no way currently for the MES Web API to distinguish between setting the value of a column to NULL or ignoring the value and keep what is already there. In this documentation, the fields used to identify the record to be updated are listed. Consequently, it is generally recommended to read the values from the database first and then update the desired values and pass back all the other values read from the database.

GetAll vs. GetByKey vs. GetByFilter

The differences between GetAll, GetByKey, and GetByFilter endpoints are:

  • A GetAll can join data from several tables in addition to the primary table to include related fields in the returned dataset. 
  • A GetByKey retrieves only the record fields from a single record in the underlying table, using the primary key to identify the record.
  • A GetByFilter generally has a more sophisticated set of filter parameters than a GetAll. For example, it might include date range parameters instead of only allowing a match to a specific date. These endpoints also might return a smaller dataset of fields than the corresponding GetAll to improve retrieval performance.

For a filtered Get call, such as GetAll and GetByFilter:

  • The input filter parameters are optional unless otherwise indicated to be required.
  • The call retrieves one or more records as specified by the filter parameters. Passing no filter parameters will retrieve all records of the object type being queried. If no matching records are found, an empty JSON object is returned.

Endpoint Format and Syntax in Work Tasks

When using the MES Web API endpoints as Web API lookups in Work Tasks forms, the parameter names must be enclosed in curly brackets ({ }).

For example, the following endpoint:

api/v3/AvailableLineEnts?name=Roaster12

would look like this when used as a forms lookup:

api/v3/AvailableLineEnts?name={name}

 

In This Topic
TitleResults for “How to create a CRG?”Also Available in