skyscrapr / cloudability-sdk-go

Cloudability SDK for golang
MIT License
7 stars 3 forks source link

AccountGroups() using broken v1 API endpoint #17

Open nullify005 opened 1 year ago

nullify005 commented 1 year ago

Hi There,

When attempting to use the API in order to interact with AccountGroups the action fails with

2023/09/08 15:21:14 invalid character '<' looking for beginning of value

What I expect is to get a list returned of the account groups according to the spec https://help.apptio.com/en-us/cloudability/api/v3/account_group_entries.htm

Looking deeper at the client.go it appears to be dying on https://github.com/skyscrapr/cloudability-sdk-go/blob/v0.0.12/cloudability/client.go#L151 attempting to decode JSON which isn't.

Cause:

AccountGroups appears to be using a hardcoded? V1 API endpoint which is returning a bunch of HTML ultimately containing

      <div class="msg">
        <p>
          This login page is no longer supported. Please use ...

Sure enough if you hit up curl -v https://app.cloudability.com/api/1/account_groups -u <key> then you'll see the resulting page, whereas the V3 endpoint is just fine

Do you happen to have a branch where the V3 endpoints are setup for AccountGroups at all? I can see the rest are pointing there?

If not then I can make a PR for it if you are willing

Regards, Lee

skyscrapr commented 11 months ago

hi @nullify005 happy you to raise a PR and I'll merge it. thanks for the effort