azure-devops-python-api icon indicating copy to clipboard operation
azure-devops-python-api copied to clipboard

ValueError: API resource location is not registered

Open rilooth opened this issue 7 years ago • 4 comments

I want to extract users list from azure devOps using but an error appears:

ValueError: API resource location 229a6a53-b428-4ffb-a835-e8f36b5b4b1e is not registered on https://vssps.dev.azure.com/(my Organization).

I have already tried to extract the projects list and extracting descriptors for the specific user so connection is ok.

here is my code:

from azure.devops.connection import Connection
from msrest.authentication import BasicAuthentication


personal_access_token = 'my personal access token'
organization_url = 'https://dev.azure.com/(my Organization)'

credentials = BasicAuthentication('', personal_access_token)
connection = Connection(base_url=organization_url, creds=credentials)

accounts_client = connection.clients_v5_1.get_accounts_client()
get_acc = accounts_client.get_accounts()

for acc in get_acc:
    print(acc)

I need to get information about the last access and date created account so maybe another way?

rilooth avatar Oct 31 '19 12:10 rilooth

Fixed in #292

Test code:

credentials = BasicAuthentication('', personal_access_token)
connection = Connection(base_url=organization_url, creds=credentials)

location_client = connection.clients_v5_1.get_location_client()
connection_data = location_client.get_connection_data()

accounts_client = connection.clients_v5_1.get_accounts_client()
get_acc = accounts_client.get_accounts(member_id=connection_data.authenticated_user.id)

for acc in get_acc:
    print(acc)

tedchamb avatar Nov 01 '19 17:11 tedchamb

@rilooth thanks for reporting this issue. On a side note, you mention trying to get a list of users. The accounts clients deals with organizations rather than individual users. You may want to look into the Graph APIs.

tedchamb avatar Nov 01 '19 17:11 tedchamb

This release has the fix: https://github.com/microsoft/azure-devops-python-api/releases/tag/5.1.0b6

tedchamb avatar Nov 01 '19 17:11 tedchamb

Hi @tedchamb, I've tested your code snippet, doesn't seem work in my case. still getting error ValueError: API resource location 229a6a53-b428-4ffb-a835-e8f36b5b4b1e is not registered on

EdmondAndy avatar Nov 05 '24 22:11 EdmondAndy