intacct / intacct-sdk-js

Official repository of the Sage Intacct SDK for JavaScript in Node.js
https://developer.intacct.com/tools/sdk-node-js/
Apache License 2.0
23 stars 33 forks source link

Error in the response for pagination #55

Closed hendrixroa closed 3 years ago

hendrixroa commented 3 years ago

Hi everyone! I'm using the latest version (2.1.0) and I getting an error when I paginate results. More specifically in this line https://github.com/Intacct/intacct-sdk-node-js-examples/blob/master/list-vendors.js#L46 you are checking if .resultId is not null, but in my response appears this:

 {
 results: [
    Result {
      status: 'success',
      _functionName: 'query',
      _controlId: '2BLAHd-eBLAHa-41a2-822c-9BLAHc',
      _listType: 'GLACCOUNT',
      _totalCount: 93,
      _count: 20,
      _numRemaining: 73,
      _data: [Array]
    }
  ]
  }

Is the .resultId replaced by controlId for some reason?

karstenintacct commented 3 years ago

Hi,

controlId and resultId are not the same. controlId is mainly used for idempotency purposes, e.g. you can make a function control id unique across all API requests. resultId is only used for pagination in readByQuery and read. When there are more than 1 page, the resultId will contain a value, which will be passed into readMore as an input parameter to retrieve the next page and so on.

listVendors is implemented using readByQuery and should return a resultId, when more than 1 page remain.

Are you still running into this issue. We are unable to reproduce this in our environment.

  1. Do you see the same behavior when placing the API call through curl or Postman. If yes, please file a support case.
  2. If XML request behaves correctly, but SDK is not handling it correct, I recommend having a short call, to step through this together.

Thank you and have a good weekend. Karsten