Skip to content

Return Continuation Token in response #152

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

Closed
eyalag opened this issue Dec 17, 2018 · 14 comments
Closed

Return Continuation Token in response #152

eyalag opened this issue Dec 17, 2018 · 14 comments
Assignees
Labels

Comments

@eyalag
Copy link

eyalag commented Dec 17, 2018

The continuation token cannot be retrieved from the response- which means that one cannot know if he got all the data.

@tedchamb
Copy link
Member

tedchamb commented Jan 2, 2019

Our http client code generator does not support this feature yet. We will get to it soon.

@tedchamb tedchamb added the bug label Jan 2, 2019
@tedchamb
Copy link
Member

tedchamb commented Jan 3, 2019

@eyalag ,
The general issue should have been addressed in 0.1.21. Which version are you using? Also what method is not working?

Thanks,
Ted

@tedchamb tedchamb added investigating and removed bug labels Jan 3, 2019
@tedchamb tedchamb self-assigned this Jan 9, 2019
@tedchamb
Copy link
Member

@eyalag , i am going to close this for now. If you are still having issues on version 0.1.21+, let me know and I will reopen this. Also let us know which method is not working for you.

@phclark
Copy link

phclark commented Mar 14, 2019

I'm having issues on version 1.22. Please reopen this ticket, as this bug makes retrieving large lists impossible.

@tedchamb
Copy link
Member

@phclark Can you provide more details? Which method are you having problems with?

@phclark
Copy link

phclark commented Mar 14, 2019

Sure, a basic example of what I'm trying to do:

build_client = azure_devops_connection.clients.get_build_client()
builds = build_client.get_builds(project='Apps', top=500)
print(type(builds)) # Returns list
for b in builds:
    print(b) # Prints raw builds

There seems to be no way of retrieving a continuation token, which is returned as expected from the equivalent REST API call.

@tedchamb
Copy link
Member

Thank you. The client code generator needs to be updated to fix this method.

@tedchamb tedchamb reopened this Mar 14, 2019
@RolfJordi
Copy link

RolfJordi commented Mar 18, 2019

i have the same issue with the method get_projects from core client. There is no way to retrieve the continuation token.

core_client = azure_devops_connection.clients.get_core_client()
projects = core_client.get_projects(top=10)
print(type(projects)) # Returns list
for p in projects:
    print(p) # Prints raw project

@phclark
Copy link

phclark commented Mar 18, 2019

Interestingly, I'm also having issues with getting continuationTokens to work when using the raw REST API. When I make a GET request like,

https://{workspace}.visualstudio.com/{project}/_apis/build/builds?%top=100&api-version=5.0

The token, returned in the header field x-ms-continuationtoken does not vary when the returned continuationToken is included in the next request.
Has anyone else experienced this?

@tedchamb
Copy link
Member

@phclark Can you try the $top instead of %top, and see if you get the behavior you are expecting.

https://{workspace}.visualstudio.com/{project}/_apis/build/builds?$top=100&api-version=5.0

@phclark
Copy link

phclark commented Mar 19, 2019

Sorry, that was a typo. I am using $top.
For example, the subsequent calls, with urlencode, resolve to
.../_apis/build/builds?%24top=1000&continuationtoken=2017-12-05T20%3A35%3A46.9163266Z&api-version=5.0

@tedchamb
Copy link
Member

tedchamb commented Aug 7, 2019

Duplicate to MicrosoftDocs/vsts-rest-api-specs#178, which sounds like it has been fixed in the service.

@tedchamb tedchamb closed this as completed Aug 7, 2019
@tedchamb tedchamb reopened this Aug 7, 2019
@tedchamb
Copy link
Member

tedchamb commented Aug 7, 2019

reopening for the broader ContinuatuonToken issue, which should be fixed soon.

@tedchamb
Copy link
Member

Fixed in #258
https://github.com/microsoft/azure-devops-python-api/releases/tag/5.1.0b3

Continuation Token example:

get_builds_response = build_client.get_builds(project=project_name)
index = 0
while get_builds_response is not None:
    for build in get_builds_response.value:
        pprint.pprint("[" + str(index) + "] " + build.build_number)
        index += 1
    if get_builds_response.continuation_token is not None and get_builds_response.continuation_token != "":
        get_builds_response = build_client.get_builds(project=project_name, continuation_token=get_builds_response.continuation_token)
    else:
        get_builds_response = None

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

No branches or pull requests

4 participants