Quality Management REST API

The NetSuite Quality SuiteApp exposes REST APIs that enable you to trigger quality management inspections.

Quality Management REST API uses HTTP requests to GET, PUT, POST, and DELETE data. To learn how the NetSuite Quality SuiteApp leverages REST APIs, see the following:

GET – qm_rest_queue

The Quality GET API returns a queue entry, or queue object dump.

Use the GET request to retrieve relevant information about a pending or complete quality inspection that has been queued for tablet data collection.

                      {
               "message": "Loaded queue record id: 5043",
               "data": {
                     "status": "Pending", 
                     "location": "India",
                     "quantity": 1,
                     "triggerType": "API",
                     "specification": "Color and Quantity check",
                     "priority": "0-Urgent",
                     "assignedTo": "Amruta Kumbhar",
                     "action": "Return To Vendor",
                     "inventoryTransaction": "Item Receipt #42",
                     "transactionLine": 1,
                     "parentTransaction": "Purchase Order #43",
                     "recordStaged": true,
                     "statusId": 1,
                     "locationId": 1,
                     "triggerTypeId": 4,
                     "specificationId": 3,
                     "priorityId": 1,
                     "assignedToId": 3,
                     "actionId": 2,
                     "inventoryTransactionId": 85,
                     "parentTransactionId": 84
               },
                  "requestParams": {
                     "id": "5043"
            }
} 

        
                      {
             "error": {
                  "code": "JS_EXCEPTION",
                  "message": "Error: {\"message\":\"Queue record 50431 does not
            exist.\"}" }
               }
         } 

        

POST – qm_rest_queue

The Quality Management POST API enables you to create new queue records. Creating a new queue record triggers processing to allow the associated inspections to be performed on the tablet interface.

                      {
               "specificationId":"integer(m)",
               "itemId":"integer(m)",
               "locationId":"integer(m)",
               "quantity":"integer(m)",
               "assignedToId":"integer",
               "priorityId":"integer",
               "inventoryTransactionId":"integer",
               "transactionLine":"integer",
               "parentTransactionId":"integer"
               "actionId":"integer"}
            } 

        
                      {
               "message": "Created queue record id: 662",
               "data": {
                     "id": 662
               },
               "requestBody": {
                     "actionId": 2,
               "assignedToId": 3,
               "inventoryTransactionId": 85,
               "specificationId": 3,
               "locationId": 1,
               "quantity": 1,
               "itemId": 8,
               "priorityId": 1,
               "parentTransactionId": 84,
               "transactionLine": 1
               }
            } 

        

DELETE – qm_rest_queue

The Quality Management DELETE API is used to cancel queue records (identified by the Request-URL). You can only use this API to cancel queue records that have been created by the POST API.

Scriptable Inspection Triggers

The NetSuite Quality Management includes a SuiteScript 2.0 module that enables you to initiate predefined inspection activities (specifications) from within SuiteScript 2.0 customizations to NetSuite. This enhancement enables you to extend inspection capabilities to address your unique market and organizational inspection needs. Exposing this API ensures that implementations are streamlined and have the necessary safeguards to avoid inconsistent inspection data.

Inspection Queue Trigger through Custom API

To trigger the Quality Inspection Queue without a transaction context, select API as the Transaction Type in the Quality Specification Context. For more information, see Specification Contexts.

For all inspection queues created with the API trigger, the trigger type will be API.

Note:

You cannot create a Quality Specification Context for the API trigger through the user interface.

To create an inspection queue outside of Quality Management, you must create custom scripts and call the API from your application.

When you call the API, the parameters are read by the API, and an appropriate inspection queue is created. Then, the partner writes the code and passes the parameters as required.

You can use the code samples as reference. For more information, see Code Samples.

Mandatory Parameters

You must set the following mandatory parameters:

Non-mandatory Parameters

Optionally, you can set the following non-mandatory parameters:

Methods to Execute the REST API Trigger

You can execute the REST API trigger using the following HTTP methods:

To execute the REST API trigger, enter the following statement:

          function getRestletResponse(scriptId, deploymentId, restletMethod, requestBody, urlParams) { try { var urlParameters = {}, headerObj = {}; if (urlParams) urlParameters = urlParams; var requestHeader = { 'Content-Type': 'application/json' }; if (Object.keys(headerObj).length !== 0) { requestHeader = Object.assign(requestHeader, headerObj) } var requestResponse = https.requestRestlet({ body: JSON.stringify(requestBody), deploymentId: deploymentId, headers: requestHeader, method: restletMethod, scriptId: scriptId, urlParams: urlParameters }); log.debug("Web service response from restlet", requestResponse); log.debug(scriptId + ' Response code ', requestResponse.code) var responseCode = requestResponse.code; log.debug(scriptId + ' Response body', requestResponse.body); return true; } catch (e) { log.error('Exception occurred ', e) return false; }
} 

        

Code Samples

The following code samples show how to call the REST API using HTTP methods:

Related Topics

Quality Management Overview
Quality Management User Guide

General Notices