1

I downloaded the GIT code for Maximo with node.js from the link: https://github.com/ibm-maximo-dev/maximo-nodejs-sample

I am able to connect to the Maximo server and authenticate fine. But when I perform a read operation, I get the below error.

I am accessing the below Maximo REST API, which works OK in the browser. https://domain/maximo/oslc/os/CDUISRMINCIDENT?lean=1&oslc.select=*&oslc.pageSize=1

The same thing, I try in node.js:

router.get("/incidents", function (req, res) {
    
  var maximo = new Maximo(options);  
  maximo.resourceobject("CDUISRMINCIDENT")
      .select(["*"])
      .pagesize(2)
      .fetch()
      .then(function(resourceset)
          {
             jsondata = resourceset.thisResourceSet();        
           res.json(jsondata);
          })
      .fail(function (error)
      {
            console.log('****** Error Code = '+error);
      });
});

when I access the above route in browser: localhost:3000/api/v1/incidents I get the below error:

Maximo Node API server is running on port 3000
API version is v1
Request received by node middleware ...
### islean 1
Auth header type = maxauth
Request received by node middleware ...
### islean 1
this.islean ****** 1
***** RESPONSE 302
undefined:1


SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)

Any inputs would be greatly helpful.

Thanks R

  • 1
    At first blush, that 302 response code seems to be the trouble. It seems like when node is hitting Maximo it is getting a redirect response and instead of following the redirect it is trying to parse that (empty) response body of the redirect. – Dex Aug 22 '20 at 14:29

0 Answers0