Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: accountv2Client.List() always throws Error: Request failed with status code: 500, internal_error #432

Open
ParthaI opened this issue Mar 8, 2024 · 1 comment

Comments

@ParthaI
Copy link
Contributor

ParthaI commented Mar 8, 2024

Hello Team,

I'm attempting to retrieve a list of all accounts on my IBM Cloud using the List() API call from the accountv2 package. Unfortunately, I keep encountering the following error: Error: Request failed with status code: 500, internal_error.

Below is the source code I've been working with:

package main

import (
	"fmt"

	"github.com/IBM-Cloud/bluemix-go"
	"github.com/IBM-Cloud/bluemix-go/api/account/accountv2"
	"github.com/IBM-Cloud/bluemix-go/session"
)

func main() {
	conf := &bluemix.Config{
		BluemixAPIKey: "YOUR_IBMCLOUD_API_KEY",
	}

	s, err := session.New(conf)
	if err != nil {
		panic("Error in session creation: " + err.Error())
	}

	svc, err := accountv2.New(s)
	if err != nil {
		panic("Error in Account client: " + err.Error())
	}
	client := svc.Accounts()
	res, err := client.List()

	if err != nil {
		panic("Error in Account List API call: " + err.Error())
	}

	for _, acc := range res {
		fmt.Printf("Account Name: %s", acc.Name)
	}

}

If there are any corrections needed or best practices I might have overlooked, I'd greatly appreciate your guidance. This issue is currently a significant obstacle in our project's progress, so any expedited advice or solutions would be immensely valuable.

Thank you for your support!

@hkantare
Copy link
Collaborator

hkantare commented Mar 8, 2024

The above is based on CF (MCCP) endpoint which is deprecated and stopped the service.

Added support to retrive accoutns without CF
#433

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants