V3_MiddlewareAccess_PostByXml (Post)
- Last UpdatedNov 06, 2025
- 2 minute read
| Post | V3_MiddlewareAccess_PostByXml |
Resource Path:/api/v3/MiddlewareAccess/xml
| Name | Description |
|---|---|
| trans_id | Used to supply the ID of the transaction if the call is taking part in a transaction. |
The request body is of type string.
The XML string contents. See Specifying MES Stored Procedures in a MiddlewareAccess XML Endpoint for a description of the XML string contents.
Note: The content type of the request body should be specified as application/json.
The response body is of type object.
The endpoint returns an XML string composed of key value pairs representing the object that was added.
The session is managed internally by the system. The stored procedure will be called in the context of the MES user that is making the Web API call. If a session ID is supplied, it will be ignored.
For information about datetime and decimal separator requirements when passed in strings, see the overview topic "Datetime and Decimal Format Requirements."
Posting a single command:
The following example shows a post for a single command and the response.
URL:
fullyqualifiedhostname/mesmw/api/v3/MiddlewareAccess/xmlRequest body for a single command:
"<request><object>util_state</object><cmd>add</cmd><msgtype>exec</msgtype><util_state><state_desc>Planned Downtime</state_desc><color>255</color></util_state></request>"Note: If you are invoking the post request from a Work Tasks Workflow, the beginning and end of the request must be escaped using a backslash (\) and must be supplied as follows:
Work Tasks Workflow request body for a single command
"\"<request><object>util_state</object><cmd>add</cmd><msgtype>exec</msgtype><util_state><state_desc>Planned Downtime</state_desc><color>255</color></util_state></request>\""Response body from a single command:
<?xml version="1.0" encoding="utf-16"?>
<root>
<result>0</result>
<state_cd>24</state_cd>
<identity>24</identity>
<last_edit_at>2024-05-28T08:31:18Z</last_edit_at>
</root>
Posting a batch of commands:
The following example shows a post for a batch of commands and the response.
URL:
fullyqualifiedhostname/mesmw/api/v3/MiddlewareAccess/xmlRequest body for a batch of commands:
"<requests><object>custom</object><cmd>ExecuteBatchXMLCmds</cmd><msgtype>execbatch</msgtype><request><object>util_state</object><cmd>add</cmd><msgtype>exec</msgtype><util_state><state_desc>Unplanned Downtime</state_desc><color>255</color></util_state></request><request><object>util_state</object><cmd>add</cmd><msgtype>exec</msgtype><util_state><state_desc>Running Slow</state_desc><color>255</color></util_state></request></requests>"Note: If you are invoking the post request from a Work Tasks Workflow, the beginning and end of the request body must be escaped using a backslash (\) and must be supplied as follows:
Work Tasks Workflow request body for a batch of commands:
"\"<requests><object>custom</object><cmd>ExecuteBatchXMLCmds</cmd><msgtype>execbatch</msgtype><request><object>util_state</object><cmd>add</cmd><msgtype>exec</msgtype><util_state><state_desc>Unplanned Downtime</state_desc><color>255</color></util_state></request><request><object>util_state</object><cmd>add</cmd><msgtype>exec</msgtype><util_state><state_desc>Running Slow</state_desc><color>255</color></util_state></request></requests>\""Response body from a batch of commands:
<?xml version="1.0" encoding="utf-16"?>
<root>
<result>0</result>
<add>
<result>0</result>
<state_cd>17</state_cd>
<identity>17</identity>
<last_edit_at>2024-05-28T07:03:35Z</last_edit_at>
</add>
<add>
<result>0</result>
<state_cd>18</state_cd>
<identity>18</identity>
<last_edit_at>2024-05-28T07:03:35Z</last_edit_at>
</add>
</root>