SOP-42Q-MES0098 MES API-42Q Account Services
42Q Home > Tools > 42Q MES API
This edition applies to MES15 Portal 1.0 and all subsequent releases and modifications until otherwise indicated in new revisions.
Contents
- 1 Purpose
- 2 Usage
- 3 Security
- 4 API Resources
- 5 Document Revision History
Purpose
Document externally accessible endpoints into the 42Q MES system.
Usage
Unless otherwise specified all resource URI’s are designed to work with standard HTTP/HTTPS GET requests. The immediate focus of this set of API endpoints is retrieval of production data versus manipulation of said data.
Security
Typically each of these endpoints is secured via our api security package. This package requires each request to be signed by a registered client. Client registrations are provided to all approved API consumers. When authorization is enabled API calls require a properly formatted Authorization header in the HTTP/HTTPS request. The signature algorithms and format are described here though we recommend using pre-packaged libraries maintained and provided by 42q engineering teams.
API Resources
Currently, all of these resources return a standardized JSON result with three top-level attributes:
success: true or false
message: contains an error message if success is false
data: JSON subelement corresponding to the results of the call being made
The base URI for each MES API resource takes the following form:
https://HOSTNAME:PORT/mes-api/target_context
Sub Resources are identified from the base: path/to/resource[?arg1=value1&arg2=value2…] Note: Parameters can be sent in any order as part of the URL as only the name matters--not the location in the URL text.
The following top level resources are currently exposed:
Units Resource
Encapsulates endpoints associated with unit specific data, generally a specific unit serial number. The units resource exposes the following sub-resources assuming the {serialNumber} resource property identifies an existing serial number.
Basic Unit Data
Sample URI:
https://42qmes1.42-q.com:8081/mes-api/api_test_target/units/SAMPLE_UNIT001
Sample Response:
Summary
Sample URI:
https://42qmes1.42-q.com:8081/mes-api/api_test_target/units/SAMPLE_UNIT001/summary
Sample Response:
History
Sample URI:
https://42qmes1.42-q.com:8081/mes-api/api_test_target/units/SAMPLE_UNIT001/history
Sample Response:
Parent Hierarchy
Sample URI:
https://42qmes1.42-q.com:8081/mes-api/api_test_target/units/SAMPLE_UNIT001/parentage
Sample Response:
Child Components
Sample URI:
https://42qmes1.42-q.com:8081/mes-api/api_test_target/units/SAMPLE_UNIT001/children
Sample Response:
Comments
Sample URI:
https://42qmes1.42-q.com:8081/mes-api/api_test_target/units/SAMPLE_UNIT001/comments
Sample Response:
Defects
Sample URI:
https://42qmes1.42-q.com:8081/mes-api/api_test_target/units/SAMPLE_UNIT001/defects
Sample Response:
Route
Sample URI:
https://42qmes1.42-q.com:8081/mes-api/api_test_target/units/SAMPLE_UNIT001/route
Sample Response:
Export Activity/DHR
Sample URI:
https://42qmes1.42-q.com:8081/mes-api/api_test_target/units/export/activity?interval=60
Sample Response:
Shop Orders Resource
Resource exposing endpoints associated with shop orders data.
General Shop Order Data
Sample URI:
https://42qmes1.42-q.com:8081/mes-api/api_test_target/shop-orders/A_SAMPLE_SHOP_ORDER001
Sample Response:
Bill Of Material
Sample URI:
https://42qmes1.42-q.com:8081/mes-api/api_test_target/shop-orders/A_SAMPLE_SHOP_ORDER001/bom
Sample Response:
Attributes Resource
Resource exposing endpoints associated with attributes and the serial numbers related to them.
Attribute Name
Sample URI:
https://42qmes1.42-q.com:8081/mes-api/api_test_target/attributes/A_SAMPLE_ATTR
Sample Response:
{"success": true,"message": "","data": [{"serial_number": "SBSTACK0032.A.017-IC-001","part_number": "PN-ICP0001","shop_order_number": null},{"serial_number": "SBSTACK0032.A.007-IC-021","part_number": "PN-ICP0001","shop_order_number": null},{"serial_number": "SBSTACK0032.A.007-IC-019","part_number": "PN-ICP0001","shop_order_number": null},{"serial_number": "SBSTACK0032.A.007-FEP","part_number": "PN-FEP0001","shop_order_number": null}]}
Attribute Name and Value
Sample URI:
https://42qmes1.42-q.com:8081/mes-api/api_test_target/attributes/A_SAMPLE_ATTR/WITH_ATTR_VALUE
Sample Response:
{"success": true,"message": "","data": [{"serial_number": "SBSTACK0032.A.007-FEP","part_number": "PN-FEP0001"}]}
Parts Resource
Part Info
Sample URI:
https://42qmes1.42-q.com:8081/mes-api/api_test_target/parts/SAMPLE_PART_NUMBER001
Sample Response:
{"success": true,"message": "","data": [{"part_number": "VALBB_BASE1","part_number_exists": true,"part_key": 209,"extended_part_number": "","rev_num": 0,"customer_code": "","family_id": "","country": "USA","label_data": "","prod_line_id": "","product_option": "","model_description": "","product_internal": "","graphic": "","description": "Test Part Number 01","upc": "","weight": 0,"model_number": "","site_id": "","cust_proj_key": 1,"ean": "","height": 0,"length": 0,"pallet_weight": 0,"rohs": "","volume": 0,"width": 0,"obsolete": false}]}
Test Resource
Sample URI:
https://42qmes1.42-q.com:8081/mes-api/api_test_target/test
Sample Response:
{"success": true,"message": "","data": ["Light speed is too slow!"]}
Simple Test
Sample URI:
https://42qmes1.42-q.com:8081/mes-api/api_test_target/test/simple
Sample Response:
{"success": true,"message": "","data": ["This request hasn't been authenticated. However, we are still confident that light speed is too slow!"]}
Containers Resource
A resource dedicated to exposing endpoints associated with containers
Units
Sample URI:
https://42qmes1.42-q.com:8081/mes-api/api_test_target/containers/SAMPLE_CONTAINER_UNIT001/units
Sample Response:
Workstations Resource
Encapsulates endpoints associated with unit specific data, generally a specific unit serial number. The units resource exposes the following sub-resources assuming the {serialNumber} resource property.
All Workstations
Sample URI:
https://42qmes1.42-q.com:8081/mes-api/api_test_target/workstations
Sample Response:
Devices
Sample URI:
https://42qmes1.42-q.com:8081/mes-api/api_test_target/workstations/devices
Sample Response:
Device
Sample URI:
https://42qmes1.42-q.com:8081/mes-api/api_test_target/workstations/devices/A_SAMPLE_DEVICE
Sample Response:
Locations
Sample URI:
https://42qmes1.42-q.com:8081/mes-api/api_test_target/workstations/locations
Sample Response:
Location
Sample URI:
https://42qmes1.42-q.com:8081/mes-api/api_test_target/workstations/locations/A_SAMPLE_LOCATION001 Sample Response:
Processes
Sample URI:
https://42qmes1.42-q.com:8081/mes-api/api_test_target/workstations/processes/SAMPLE_PROCESS
Sample Response:
Process
Sample URI:
https://42qmes1.42-q.com:8081/mes-api/api_test_target/workstations/processes/A_SAMPLE_PROCESS001
Sample Response:
Manufacturing Holds Resource
Resource exposing endpoints associated with manufacturing hold information.
Active
Sample URI:
https://42qmes1.42-q.com:8081/mes-api/api_test_target/mfg-holds/active
Sample Response:
Routes Resource
Resource exposing endpoints associated with routes and sub-routes.
Basic Route
Sample URI:
https://42qmes1.42-q.com:8081/mes-api/api_test_target/routes/SAMPLE_ROUTE001
Sample Response:
Expanded Route Steps
Sample URI:
https://42qmes1.42-q.com:8081/mes-api/api_test_target/routes/SAMPLE_ROUTE001/steps
Sample Response:
Defects Resource
Resource exposing endpoints associated with unit defects
Defect Codes
Sample URI:
https://42qmes1.42-q.com:8081/mes-api/api_test_target/defects/codes
Sample Response:
Defect Code
Sample URI:
https://42qmes1.42-q.com:8081/mes-api/api_test_target/defects/codes/0101
Sample Response:
Documents Resource
Resource exposing endpoints associated with manufacturing documents, including work instructions
Work Instructions
Sample URI:
Response for actual document data {"data" : { "mime_type" : "application/pdf", "document" : "<imagine this is base 64 binary encoded data>", "document_type" : "base64" }, "success" : true, "message" : "This result demonstrates returning an actual document encoded in base64 text"}
Response for a url/link to a document {"data" : { "document" : "http://p88conduit1.sanmina.com:18005/ccr", "document_type" : "url" }, "message" : "This result demonstrates a response to a url instead of an actual document. Generally speaking this message is blank on success. Mime type not provided as it will be returned when accessing the url", "success" : true}
For both of these examples the message is populated even with success == true. Generally speaking this wouldn’t be the case but for the purposes of providing a concise explanation it seemed reasonable here.
Document Revision History
Date | Author | Title | Version | Change Reference |
07/13/15 | Ashley Martin | Technical Writer | v 1.0 | Document Creation. |
12/05/16 | Benjamin Cavanaugh | Technical Writer | v 1.0 | Document Update. |