opsgenie/opsgenie-nodejs-sdk

can't get a list of users

Closed this issue · 4 comments

var opsgenie = require('opsgenie-sdk')

opsgenie.configure({
  api_key: ''
})

async function main() {
  const a = await opsgenie.user.list({})
  console.log(a)
}

main()

undefined
undefined:1
No handler found for url /v1/json/user/
^

SyntaxError: Unexpected token N in JSON at position 0
at JSON.parse ()

Looks like : https://github.com/opsgenie/opsgenie-nodejs-sdk/blob/master/lib/resources/User.js#L6

Will need

var baseURL = '/v1/json/user/';

Changing to

var baseURL = '/v2/users/';

Based on: https://docs.opsgenie.com/docs/user-api

👋 @rstormsf Just thought I would let you know, as it doens't look like this repo will be updated i've created one: https://www.npmjs.com/package/opsgenie-sdk-revived

I plan to continue working and expanding on it, it currently includes the V2 User API

@rstormsf let us plan this change for the near future.

@DanCarlyon Thanks for creating the PR. We will take it from here. @rstormsf we are working on it.