Versions
Versions this documentation is relevant for:
- 8.7.0+
Upsert
When document ID is provided, the Document – Upsert API call checks if a document with the given ID already exists. If it does, the appropriate fields are updated in the matching document in Eyelit MES-M.
When the document ID is omitted, a new document will be created.
Figure 1 - Logic within Document/Upsert API Call
Data Prerequisites
There is no data required in Eyelit MES-M to act as a pre-requisite to make the API call to upsert documents. If parameters are passed in through the body that return no valid results a new document will be created, otherwise the tool identified will be updated.
Request
Table 1 shows the method and endpoint required to make the API call to upsert documents.
Table 1 - Outbound Message Detail for Document - Upsert
Method | URL Structure | Endpoint |
PUT | https://[environment].mestec.net | /api/Document/Upsert |
The body of the payload should follow the format below.
JSON Structure for Document Upsert
See Table 2 for information on which fields are optional, the appropriate data types and the mappings to fields in Eyelit MES-M.
Table 2 – Parameter Information for Document – Upsert
Parameter Name | Data Mapping | Data Type | Mandatory |
| Case Sensitive | Match Type |
|
|
| Create | Update |
|
|
id | DOCUMENT.ID | Integer | No | Yes | N/A | Exact |
documentType | DOCUMENTTYPE.NAME | String | Yes | No | N/A | Exact |
name | DOCUMENT.NAME | String | Yes | No | N/A | N/A |
Note: For any fields where the match type is ‘Like’, a percent symbol should be used as a wildcard character to indicate a number of characters within the given string.
Sample Request
See below for sample use cases with examples of the JSON payload format required.
To create a document:
JSON Sample for Document Upsert to create a new document
To update a document’s type:
JSON Sample for Document Upsert to update a document
Response
When using the Document – Upsert API call, a JSON payload will be returned containing data in the following structure:
JSON Structure for Document Upsert
Sample Response
See below for sample use cases with examples of the JSON payload format returned.
JSON Sample for Document Upsert

List
The Document – List API call reads existing documents from Eyelit MES-M. The data can be filtered based on the parameters passed in the body/payload of the JSON packet giving the flexibility to search for one or multiple documents.
Using the Document – List API call has no impact on the data within the given Eyelit MES-M application, it is read-only.
Figure 2 shows the logic used within the Document – List API call.
Figure 2- Logic within Document/List API Call
Data Prerequisites
There is no data required in Eyelit MES-M to act as a pre-requisite to make the API call to list documents. If parameters are passed in through the body that return no valid results, an empty payload will be returned.
Request
Table 3 shows the method and endpoint required to make the API call to list documents.
Table 3 - Outbound Message Detail for Document- List
Method | URL Structure | Endpoint |
POST | https://[environment].mestec.net | /api/Document/List |
The body of the payload should follow the format below.
Figure 8 - JSON Structure for Document List
See Table 4 for information on which fields are optional, the appropriate data types and the mappings to fields in Eyelit MES-M.
Table 4 – Parameter Information for Document – List
Parameter Name | Data Mapping | Data Type | Mandatory | Case Sensitive | Match Type |
id | DOCUMENT.ID | Integer | No | N/A | Exact |
documentType | DOCUMENTTYPE.NAME | String | No | N/A | Exact |
name | DOCUMENT.NAME | String | No | N/A | Exact |
Note: For any fields where the match type is ‘Like’, a percent symbol should be used as a wildcard character to indicate a number of characters within the given string.
Sample Request
See below for sample use cases with examples of the JSON payload format required.
To list all documents:
JSON Structure for Document List – list all documents
To list documents of the document type “Work Instruction”:
JSON Structure for Document List – list all documents of a specific type
Response
When using the Document – List API call, a JSON payload will be returned containing data in the following structure:
JSON Sample for Document List
Sample Response
See below for sample use cases with examples of the JSON payload format returned.
No results were found that matched the given parameters:
Document found that matched the given parameters:
Download
The Document – Download API call attempts to download a document as binary content in the response.
Figure 3 shows the logic used within the Document – Download API call.
Figure 3 – Logic within Document/Download API call
Prerequisites
In order to download a document, the document must exist in Eyelit MES-M.
Request
Table 5 shows the method and endpoint required to make the API call to download documents.
Table 5 - Outbound Message Detail for Document - Download
Method | URL Structure | Endpoint |
POST | https://[environment].mestec.net | /api/Document/Download |
The body of the payload should follow the format below.
JSON Structure for Document Download
See Table 6 for information on which fields are optional, the appropriate data types and the mappings to fields in Eyelit MES-M.
Table 6 – Parameter Information for Document – Download
Parameter Name | Data Mapping | Data Type | Mandatory | Case Sensitive | Match Type |
fileid | DOCUMENT.ID | DOCUMENT.VERSION* | String | Yes | N/A | Exact |
type | FILEUSETYPE.NAME | String | Yes | N/A | Exact |
Note: For any fields where the match type is ‘Like’, a percent symbol should be used as a wildcard character to indicate a number of characters within the given string.
*The pipe ‘|’ is optional to separate the version. The version is not required, only the ID is.
Sample Request
See below for sample use cases with examples of the JSON payload format required.
NOTE: for downloading documents, the type must always be “Document”.
Response
When using the Document – Download API call, if a document has been found to be downloaded, the response will contain the binary content of the document.