Document


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 

ActiveX control 

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 

A close-up of a computer code AI-generated content may be incorrect., Picture 

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 

A white background with black text AI-generated content may be incorrect., Picture

To update a document’s type: 

JSON Sample for Document Upsert to update a document 

A close up of a text AI-generated content may be incorrect., Picture 

Response 

When using the Document – Upsert API calla JSON payload will be returned containing data in the following structure: 

JSON Structure for Document Upsert 

A computer code with text AI-generated content may be incorrect., PictureSample Response 

See below for sample use cases with examples of the JSON payload format returned. 

JSON Sample for Document Upsert 

A computer code with text AI-generated content may be incorrect., Picture


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 

ActiveX control 

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 foDocument- 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 

A computer code with text AI-generated content may be incorrect., PictureSee 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 

A white background with black and white clouds AI-generated content may be incorrect., Picture 

To list documents of the document type “Work Instruction”: 

JSON Structure for Document List – list all documents of a specific type 

A close up of a text AI-generated content may be incorrect., Picture

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 

A computer code with text AI-generated content may be incorrect., Picture 

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: 

A white background with black and white clouds AI-generated content may be incorrect., Picture

Document found that matched the given parameters: 

A computer code with text AI-generated content may be incorrect., Picture

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 

ActiveX control 

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 

A close-up of a code AI-generated content may be incorrect., Picture 

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 

A close-up of a computer code AI-generated content may be incorrect., Picture 

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.