Integrating Storeroom with a vending machine application

You can integrate Storeroom with a third-party vending machine application to automatically create issues or drafts in Storeroom. The integration uses API Gateway to consume REST Storeroom services. The vending machine application must be able to send JSON files to the web service.

A JSON file containing the data for one or more issues or drafts, based on the setting on the Customer Number Setup screen, is sent from the vending machine to the REST service target location:

  • /vendingMachine/file
  • /vendingMachine/savedraft
  • /vendingMachine/savedraft/Async
  • /vendingMachine/getJob/{id}

The data is validated against fields in the Storeroom database. If the data for an issue passes validation, the issue or draft is automatically created in Storeroom. If the data does not pass validation, you must manually correct and submit the issue or draft in the Storeroom Import function.

When you use the savedraft API, the Draft ID or Issue ID (Order Number) is generated only after all objects (lines) in the API request are processed. If the request contains many objects, processing may take longer and can result in timeout errors.

In this case, you can use the savedraft/Async API for an asynchronous operation. When this API is used, a Job ID is returned immediately. You can check the progress of the job using the getJob/{id} API, with the Job ID. After an issue or draft is created, the Issue ID (Order Number) or Draft ID is returned in the API response.

Perform these tasks to integrate the products:

  • Create a backend service account for the vending machine application in API Gateway.
  • Configure the vending machine application to invoke the web service.

    Use this target signature for an issue:

    @RequestMapping(value = "/file", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    public String importFile(HttpSession session, @RequestBody String jsonString) {
    

    Use this target signature for a draft:

    @RequestMapping(value = "/saveDraft", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    public String saveDraft(@RequestBody List<VendingMachineDto> vendingMachineDtoList) {
    

    Use this target signature for a draft (asynchronous):

    @RequestMapping(value = "/saveDraft/Async", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity<Map<String, Object>> saveDraftAsync(@RequestBody List<VendingMachineDto> vendingMachineDtoList) {
    

    Use this target signature to inquire about the progress of a job:

    @GetMapping("/getJob/{id}")
    public ResponseEntity<?> getJob(@PathVariable(name = "id") Long jobId) {
    
  • You can also review the warehouse records.

    Ensure that the records are set up to facilitate the integration. If you set up a warehouse record for each vending machine, you can use the warehouse value to search for sales orders in Sales Order Inquiry.