ehmad11 / netsuite-rest

Make requests to Oracle NetSuite REST Web Services.
MIT License
50 stars 18 forks source link

suggestion: should further sanitize url #15

Closed dylbarne closed 2 years ago

dylbarne commented 2 years ago

along the same lines as https://github.com/ehmad11/netsuite-rest/issues/1 for instance, Release Preview accounts will have suffix "_RP" and demo accounts will have prefix "TSTDRV"

when initially setting up test request spent quite a while troubleshooting the origin of an "invalid login attempt" error, and was ultimately due to NetSuite accountId portion in Url needing to be lowercase. I was originally comparing against Postman to confirm I had valid credentials, and was working as expected there so was puzzled, but appears Postman automatically does this lowercasing to some degree (if you test with uppercase accountId Url host and inspect outgoing request via tool like Fiddler)

suggestion for ease of use would be to further sanitize default Url used (like are doing already for Sandbox accounts)

could update code to use https://${this.realm.toLowerCase().replace("_",'-')}.suitetalk.api.netsuite.com/services/rest/${path}

I realize this can be overcome with base_url param, but I believe this change will enhance overall usability and hopefully prevent someone running into troubleshooting the issue I saw in the future 😄

ehmad11 commented 2 years ago

good suggestion, and I think it will also work for other cases like #13 and #12