Open brianjwilson opened 5 years ago
Thanks for reporting. Doing more validation on the argument would help here, at least to provide a better error message.
The rationale for not passing the full URL is that the client can connect to different Snyk instances, and that's set at the client level which stores the authorisation details. For example:
client = snyk.SnykClient("<your-api-token>", "https://mysnyk.example.com/v1/")
Allowing for passing the full URL into the low level API risks trying to use the client from one Snyk instance with a different one. This is a case we could validate for as well in those methods (ie. if the two URLs don't match) which would allow for supporting this.
If the Snyk API supports more hypermedia functionality in the future it should definitely be a goal of this client to better support that.
These functions expect a relative path to the resource:
In my initial tests I was passing in a fully qualified URL and getting back 404, but it was unclear why. Reviewing the docs and then passing in only the path element got the right result, but it should be possible to pass either, especially if you improve the API to provide links to the resources (and not just the bare ID's) in the future. This would let a client just nab the links and come right back in through the library without having to assemble the paths, etc.