MiddlewareAccess_Get (Get)
- Last UpdatedNov 06, 2025
- 3 minute read
| Get | MiddlewareAccess_Get |
Resource Path:/api/MiddlewareAccess
Get data by submitting an XML request that specifies a stored procedure or by specifying a stored procedure directly.
- When submitting an XML request, the XML string is supplied in the request body.
- When specifying a stored procedure directly, you must include the object and cmd parameters in the URL and supply the JSON string in the request body. If the URL does not include the object and cmd parameter, then the method assumes that an XML string is being passed in the request body.
| Name | Description | Data Type |
|---|---|---|
| obj | Required and entered only when specifying a stored procedure directly. The name of the MES table from which data is being retrieved. | string |
| cmd | Required and entered only when specifying a stored procedure directly. The name of the command to be executed. The command name combined with the object name allow the MES middleware to identify the stored procedure to be called. This can be a direct mapping. For example, if the command is Update, the stored procedure called will be sp_U_obj. It can also be an indirect mapping, where the obj.cmd combination is looked up in the middleware mapping file to determine which stored procedure to call. | string |
The request body is of type string.
XML Request
For an XML request, the request body holds the XML string contents. See Specifying MES Stored Procedures in a MiddlewareAccess XML Endpoint for a description of the XML string contents.
The following Get methods (in the XML, message types) are supported:
- GetAll
- GetByKey
- GetSpecific
Specifying a Stored Procedure Directly
A JSON string in the request body is optional and entered only when specifying a stored procedure directly. If one or more parameters are required by the stored procedure, the request body should be a JSON string array that includes the parameters and their values.
The JSON string must be an array of name-value pairs:
- The name should match the name of a parameter in the stored procedure being called without the @ character.
- The value is the value being passed in for the parameter.
Each parameter name-value pair should be supplied only once.
The response body is of type object.
Response for XML Request
The endpoint returns a JSON array that represents the data in the dataset that is returned by the MES middleware.
Response for Specifying a Stored Procedure Directly
The stored procedure is expected to return a JSON array that represents the data in the dataset, as otherwise you will get no indication that it executed.
The call will fail if the stored procedure is not a valid MES database stored procedure. So the call will fail if the stored procedure being called is a SQL System stored procedure or a stored procedure that is not in the MES database.
Examples of Submitting an XML Request
General Format
The following examples show the general format for how to specify none, one, or more parameters.
A stored procedure that takes no parameters:
fullyqualifiedhostname/mesmw/api/MiddlewareAccess
xmlRequest=<request><object>table_name</object><cmd>commandname</cmd><msgtype>messagetype</msgtype></request>A stored procedure that takes one parameter:
fullyqualifiedhostname/mesmw/api/MiddlewareAccess
xmlRequest=<request><object>table_name</object><cmd>commandname</cmd><msgtype>messagetype</msgtype><param_1>value</param_1></request>A stored procedure that takes two parameters:
fullyqualifiedhostname/mesmw/api/v3/MiddlewareAccess
xmlRequest=<request><object>table_name</object><cmd>commandname</cmd><msgtype>messagetype</msgtype><param_1>value</param_1><param_2>value</param_2></request>
Specific Example
To get utilization reasons using reas_cd and reas_desc as filters:
fullyqualifiedhostname/mesmw/api/MiddlewareAccess
xmlRequest=<request><object>util_reas</object><cmd>getall</cmd><msgtype>getall</msgtype><reas_cd>1</reas_cd><reas_desc>Running</reas_desc></request>Response body:
[{"reas_cd":1,"reas_desc":"Running","reas_grp_id":0,"reas_grp_desc":"Example Util. Reason Group","state_cd":1,"state_desc":"RUNNING","color":65280,
"runtime":true,"downtime":false,"setuptime":false,"teardowntime":false,"fixedtime":false,"vartime":true,"failure":false,"def_lab_cd":null,"lab_desc":null,
"display_seq":2,"priority":1,"max_duration":null,"new_reas_cd":null,"standard_time":null,"min_time":null,"max_time":null,"ent_enabled":true,
"category1":null,"category2":null,"category3":null,"category4":null,"spare1":null,"spare2":null,"spare3":null,"spare4":null,
"last_edit_comment":null,"last_edit_by":"DomainAAA\\Userzzz","last_edit_at":"2020-04-23T14:25:11Z"}]
Examples of Submitting a Stored Procedure Directly
General Examples
The following examples show the general format for how to specify none, one, or more parameters.
A stored procedure that takes no parameters:
fullyqualifiedhostname/mesmw/api/MiddlewareAccess?obj=table_name&cmd=commandA stored procedure that takes one parameter (shown as the request body):
fullyqualifiedhostname/mesmw/api/MiddlewareAccess?obj=table_name&cmd=command
parms={"parm_1": "value"}A stored procedure that takes two parameters (shown as the request body):
fullyqualifiedhostname/mesmw/api/MiddlewareAccess?obj=TableName&cmd=CommandName
parms={"parm_1": "value", "parm_2": "value"}
Specific Example
To get the utilization reasons using reas_cd and reas_desc as filters (shown as the request body):
fullyqualifiedhostname/mesmw/api/MiddlewareAccess?obj=util_reas&cmd=getall
parms={reas_cd:"1",reas_desc:"Running"}Response body:
[{"reas_cd":1,"reas_desc":"Running","reas_grp_id":0,"reas_grp_desc":"Example Util. Reason Group","state_cd":1,"state_desc":"RUNNING","color":65280,
"runtime":true,"downtime":false,"setuptime":false,"teardowntime":false,"fixedtime":false,"vartime":true,"failure":false,"def_lab_cd":null,"lab_desc":null,
"display_seq":2,"priority":1,"max_duration":null,"new_reas_cd":null,"standard_time":null,"min_time":null,"max_time":null,"ent_enabled":true,
"category1":null,"category2":null,"category3":null,"category4":null,"spare1":null,"spare2":null,"spare3":null,"spare4":null,
"last_edit_comment":null,"last_edit_by":"DomainAAA\\Userzzz","last_edit_at":"2020-04-23T14:25:11Z"}]