Quality Management REST API

The NetSuite Quality SuiteApp exposes REST APIs you can use to trigger quality management inspections.

The Quality Management REST API uses HTTP requests to GET, PUT, POST, and DELETE data. Here’s how the NetSuite Quality SuiteApp uses REST APIs:

GET – qm_rest_queue

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

Use the GET request to pull information about a pending or finished quality inspection that’s 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 lets you create new queue records. When you create a new queue record, it triggers processing so the inspections can be done 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 lets you cancel queue records (using the Request-URL). You can only use this to cancel queue records that were created by the POST API.

Scriptable Inspection Triggers

The NetSuite Quality Management includes a SuiteScript 2.0 module that lets you start predefined inspection activities (specifications) right from your SuiteScript 2.0 customizations. This means you can extend inspection capabilities to fit your unique business needs. Exposing this API helps keep things streamlined and makes sure you 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 any inspection queues created with the API trigger, the trigger type will be API.

Note:

You can't create a Quality Specification Context for the API trigger through the user interface.

To create an inspection queue outside Quality Management, you’ll need to write custom scripts and call the API from your application.

When you call the API, it reads the parameters and creates the right inspection queue. Then, your partner writes the code and passes in the needed parameters.

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

Required Parameters

You’ll need to set these required parameters:

Non-required Parameters

You can also set these optional parameters:

Methods to Execute the REST API Trigger

You can run the REST API trigger using these HTTP methods:

To run the REST API trigger, use this 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

Here are some code samples for calling the REST API with HTTP methods:

Related Topics

General Notices