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

Get more than 100 Releases #169

Open
2 of 7 tasks
vercellone opened this issue Jun 18, 2019 · 7 comments
Open
2 of 7 tasks

Get more than 100 Releases #169

vercellone opened this issue Jun 18, 2019 · 7 comments
Labels
Investigating when an issue needs further investigation by a maintainer. Used only by maintainer.

Comments

@vercellone
Copy link

_Originally posted by @stefanstranger in #35

The REST API includes an x-ms-continuationtoken response header that, unfortunately, is not readily accessible when using Invoke-RestMethod. In order to access the response header(s) it may be necessary to use Invoke-WebRequest (or similar).

Steps to reproduce

Get-VSTeamRelease -definitionId 12 -Top 200
Get-VSTeamRelease -definitionId 12 -ContinuationToken '???'

Expected behavior

  • -Top 200 should return 200
  • Results should always include a ContinuationToken (if the response headers include x-ms-continuationtoken) to use in subsequent calls in order to retrieve all releases.

Actual behavior

  • -Top 200 returns 100
  • No ContinuationToken is returned, therefore it is not possible to request another page.

Environment data

OS

  • macOS
  • Windows
  • Linux

Server

  • TFS 2017
  • TFS 2018
  • Azure DevOps Server
  • Azure DevOps Service
> Get-VSTeamAPIVersion
Name                           Value                                                                                                                                                                         
----                           -----                                                                                                                                                                         
ServiceFabricEndpoint          5.0-preview                                                                                                                                                                   
Build                          5.0                                                                                                                                                                           
ExtensionsManagement           5.1-preview                                                                                                                                                                   
Release                        5.1-preview                                                                                                                                                                   
Version                        VSTS                                                                                                                                                                          
MemberEntitlementManagement    5.1-preview                                                                                                                                                                   
Packaging                      5.1-preview                                                                                                                                                                   
Tfvc                           5.0                                                                                                                                                                           
Git                            5.1-preview                                                                                                                                                                   
Core                           5.0                                                                                                                                                                           
Graph                          5.1-preview                                                                                                                                                                   
DistributedTask                5.0-preview  
> $PSVersionTable
Name                           Value                                                                                                                                                                         
----                           -----                                                                                                                                                                         
PSVersion                      5.1.17134.765                                                                                                                                                                 
PSEdition                      Desktop                                                                                                                                                                       
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                                       
BuildVersion                   10.0.17134.765                                                                                                                                                                
CLRVersion                     4.0.30319.42000                                                                                                                                                               
WSManStackVersion              3.0                                                                                                                                                                           
PSRemotingProtocolVersion      2.3                                                                                                                                                                           
SerializationVersion           1.1.0.1                       
@DarqueWarrior
Copy link
Collaborator

Thanks for the detailed issue. I will ping the team and see what we can do about this.

@DarqueWarrior
Copy link
Collaborator

So I have good news and bad news. Good news is there is a thread going internally to get to the bottom of this. Bad news this API call for releases is not implemented correctly at the moment. Once it is corrected we can add support.

@DarqueWarrior
Copy link
Collaborator

This change is going to take a bit of work. The code currently uses Invoke-RestMethod and only in PowerShell Core does that call give you access to the returned headers. I just did some quick testing and I can change the code to still work in 5.x but you can't get to the headers there. This feature would only be supported in 6 or later.

Even with that it will take time to surface the continuation token up the stack so the caller will have access to it to pass to subsequent calls to get the rest of the items.

There is a second method of paging at APIs in AzD can support using $Top and $Skip. However, the Release API only supports $Top at the moment and not $Skip. I have an email into the team to see if they plan to add the $Skip parameter support as well. If so that will be a much faster fix.

@DarqueWarrior DarqueWarrior added the Investigating when an issue needs further investigation by a maintainer. Used only by maintainer. label Jul 10, 2019
@SebastianSchuetze
Copy link
Collaborator

any update on that? I can try to implement something if the team was already able to fix the issue.

@vercellone
Copy link
Author

I rolled my own Get-VSTSRelease that indirectly calls Invoke-WebRequest as a workaround, but the effort to integrate it with (or conditionally circumvent) vsteam's _callAPI is a bit daunting.

@DarqueWarrior
Copy link
Collaborator

Agreed. I am looking into other options as well. There have been internal threads on how the API has implemented this.

@MichelZ
Copy link
Contributor

MichelZ commented Feb 19, 2020

Are there any plans to move to PSCore? That would also solve the problem, wouldn't it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Investigating when an issue needs further investigation by a maintainer. Used only by maintainer.
Projects
None yet
Development

No branches or pull requests

4 participants