VSTS Pull request API - how to get the IdentityRef
![Multi tool use Multi tool use](http://sgv.ssvwv.com/sg/ssvwvcomimagb.png)
Multi tool use
I am using VSTS Pullrequest create API method to automate the PR creation, in the request i need to provide various IdentityRef id values for createdby/autocompleteby/reviewers properties. In my case all i have is user details (like full name, email address - user1@domain.com ), in this case how do i retrieve the IdentityRef Guid so that i can pass it to PR Create API.
https://docs.microsoft.com/en-us/rest/api/azure/devops/git/pull%20requests/create?view=azure-devops-rest-5.0
Any help is appreciated.
azure-devops pull-request azure-devops-rest-api
add a comment |
I am using VSTS Pullrequest create API method to automate the PR creation, in the request i need to provide various IdentityRef id values for createdby/autocompleteby/reviewers properties. In my case all i have is user details (like full name, email address - user1@domain.com ), in this case how do i retrieve the IdentityRef Guid so that i can pass it to PR Create API.
https://docs.microsoft.com/en-us/rest/api/azure/devops/git/pull%20requests/create?view=azure-devops-rest-5.0
Any help is appreciated.
azure-devops pull-request azure-devops-rest-api
Use the graph API: docs.microsoft.com/en-us/rest/api/azure/devops/graph/…
– Daniel Mann
Dec 30 '18 at 0:53
Thanks Daniel for the reply. I tried above "Users - Get" graph API but it needs the userDescriptor which i think it the GUID or some sort which isn't clear in the docs. I tried the user List graph api to list all users in the org but it only lists 500 users.
– Mahender
Dec 30 '18 at 5:45
add a comment |
I am using VSTS Pullrequest create API method to automate the PR creation, in the request i need to provide various IdentityRef id values for createdby/autocompleteby/reviewers properties. In my case all i have is user details (like full name, email address - user1@domain.com ), in this case how do i retrieve the IdentityRef Guid so that i can pass it to PR Create API.
https://docs.microsoft.com/en-us/rest/api/azure/devops/git/pull%20requests/create?view=azure-devops-rest-5.0
Any help is appreciated.
azure-devops pull-request azure-devops-rest-api
I am using VSTS Pullrequest create API method to automate the PR creation, in the request i need to provide various IdentityRef id values for createdby/autocompleteby/reviewers properties. In my case all i have is user details (like full name, email address - user1@domain.com ), in this case how do i retrieve the IdentityRef Guid so that i can pass it to PR Create API.
https://docs.microsoft.com/en-us/rest/api/azure/devops/git/pull%20requests/create?view=azure-devops-rest-5.0
Any help is appreciated.
azure-devops pull-request azure-devops-rest-api
azure-devops pull-request azure-devops-rest-api
asked Dec 30 '18 at 0:42
MahenderMahender
2,98463152
2,98463152
Use the graph API: docs.microsoft.com/en-us/rest/api/azure/devops/graph/…
– Daniel Mann
Dec 30 '18 at 0:53
Thanks Daniel for the reply. I tried above "Users - Get" graph API but it needs the userDescriptor which i think it the GUID or some sort which isn't clear in the docs. I tried the user List graph api to list all users in the org but it only lists 500 users.
– Mahender
Dec 30 '18 at 5:45
add a comment |
Use the graph API: docs.microsoft.com/en-us/rest/api/azure/devops/graph/…
– Daniel Mann
Dec 30 '18 at 0:53
Thanks Daniel for the reply. I tried above "Users - Get" graph API but it needs the userDescriptor which i think it the GUID or some sort which isn't clear in the docs. I tried the user List graph api to list all users in the org but it only lists 500 users.
– Mahender
Dec 30 '18 at 5:45
Use the graph API: docs.microsoft.com/en-us/rest/api/azure/devops/graph/…
– Daniel Mann
Dec 30 '18 at 0:53
Use the graph API: docs.microsoft.com/en-us/rest/api/azure/devops/graph/…
– Daniel Mann
Dec 30 '18 at 0:53
Thanks Daniel for the reply. I tried above "Users - Get" graph API but it needs the userDescriptor which i think it the GUID or some sort which isn't clear in the docs. I tried the user List graph api to list all users in the org but it only lists 500 users.
– Mahender
Dec 30 '18 at 5:45
Thanks Daniel for the reply. I tried above "Users - Get" graph API but it needs the userDescriptor which i think it the GUID or some sort which isn't clear in the docs. I tried the user List graph api to list all users in the org but it only lists 500 users.
– Mahender
Dec 30 '18 at 5:45
add a comment |
1 Answer
1
active
oldest
votes
1) Use Graph - List Users, but also check for a X-MS-ContinuationToken response header to determine if there is still additional paged data to be retrieved. If so, resend the request with the continuation token value until all values are returned:
GET https://vssps.dev.azure.com/{organization}/_apis/graph/users?api-version=5.0-preview.1
, followed byGET https://vssps.dev.azure.com/{organization}/_apis/graph/users?continuationToken={continuationToken}&api-version=5.0-preview.1
(I'm wondering if this is why you are only getting 500 users per your comment above. Unfortunately the documentation doesn't list the max page size for this API. If you are using the continuation token and all users are not being returned, that sounds like an API bug to me.)
2) Use Get User Entitlements. This provides top and skip parameters. The top parameter has a 10000 record limit per the documentation.
GET https://vsaex.dev.azure.com/{organization}/_apis/userentitlements?top=10000&api-version=5.0-preview.2
Thank you Eric for the reply, I tried the Graph-List users with continuation token indeed it is solving my problem. I haven't used the continuation token parameter in my earlier runs.
– Mahender
Jan 9 at 21:50
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53974453%2fvsts-pull-request-api-how-to-get-the-identityref%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
1) Use Graph - List Users, but also check for a X-MS-ContinuationToken response header to determine if there is still additional paged data to be retrieved. If so, resend the request with the continuation token value until all values are returned:
GET https://vssps.dev.azure.com/{organization}/_apis/graph/users?api-version=5.0-preview.1
, followed byGET https://vssps.dev.azure.com/{organization}/_apis/graph/users?continuationToken={continuationToken}&api-version=5.0-preview.1
(I'm wondering if this is why you are only getting 500 users per your comment above. Unfortunately the documentation doesn't list the max page size for this API. If you are using the continuation token and all users are not being returned, that sounds like an API bug to me.)
2) Use Get User Entitlements. This provides top and skip parameters. The top parameter has a 10000 record limit per the documentation.
GET https://vsaex.dev.azure.com/{organization}/_apis/userentitlements?top=10000&api-version=5.0-preview.2
Thank you Eric for the reply, I tried the Graph-List users with continuation token indeed it is solving my problem. I haven't used the continuation token parameter in my earlier runs.
– Mahender
Jan 9 at 21:50
add a comment |
1) Use Graph - List Users, but also check for a X-MS-ContinuationToken response header to determine if there is still additional paged data to be retrieved. If so, resend the request with the continuation token value until all values are returned:
GET https://vssps.dev.azure.com/{organization}/_apis/graph/users?api-version=5.0-preview.1
, followed byGET https://vssps.dev.azure.com/{organization}/_apis/graph/users?continuationToken={continuationToken}&api-version=5.0-preview.1
(I'm wondering if this is why you are only getting 500 users per your comment above. Unfortunately the documentation doesn't list the max page size for this API. If you are using the continuation token and all users are not being returned, that sounds like an API bug to me.)
2) Use Get User Entitlements. This provides top and skip parameters. The top parameter has a 10000 record limit per the documentation.
GET https://vsaex.dev.azure.com/{organization}/_apis/userentitlements?top=10000&api-version=5.0-preview.2
Thank you Eric for the reply, I tried the Graph-List users with continuation token indeed it is solving my problem. I haven't used the continuation token parameter in my earlier runs.
– Mahender
Jan 9 at 21:50
add a comment |
1) Use Graph - List Users, but also check for a X-MS-ContinuationToken response header to determine if there is still additional paged data to be retrieved. If so, resend the request with the continuation token value until all values are returned:
GET https://vssps.dev.azure.com/{organization}/_apis/graph/users?api-version=5.0-preview.1
, followed byGET https://vssps.dev.azure.com/{organization}/_apis/graph/users?continuationToken={continuationToken}&api-version=5.0-preview.1
(I'm wondering if this is why you are only getting 500 users per your comment above. Unfortunately the documentation doesn't list the max page size for this API. If you are using the continuation token and all users are not being returned, that sounds like an API bug to me.)
2) Use Get User Entitlements. This provides top and skip parameters. The top parameter has a 10000 record limit per the documentation.
GET https://vsaex.dev.azure.com/{organization}/_apis/userentitlements?top=10000&api-version=5.0-preview.2
1) Use Graph - List Users, but also check for a X-MS-ContinuationToken response header to determine if there is still additional paged data to be retrieved. If so, resend the request with the continuation token value until all values are returned:
GET https://vssps.dev.azure.com/{organization}/_apis/graph/users?api-version=5.0-preview.1
, followed byGET https://vssps.dev.azure.com/{organization}/_apis/graph/users?continuationToken={continuationToken}&api-version=5.0-preview.1
(I'm wondering if this is why you are only getting 500 users per your comment above. Unfortunately the documentation doesn't list the max page size for this API. If you are using the continuation token and all users are not being returned, that sounds like an API bug to me.)
2) Use Get User Entitlements. This provides top and skip parameters. The top parameter has a 10000 record limit per the documentation.
GET https://vsaex.dev.azure.com/{organization}/_apis/userentitlements?top=10000&api-version=5.0-preview.2
answered Jan 9 at 5:41
Eric MunnEric Munn
38814
38814
Thank you Eric for the reply, I tried the Graph-List users with continuation token indeed it is solving my problem. I haven't used the continuation token parameter in my earlier runs.
– Mahender
Jan 9 at 21:50
add a comment |
Thank you Eric for the reply, I tried the Graph-List users with continuation token indeed it is solving my problem. I haven't used the continuation token parameter in my earlier runs.
– Mahender
Jan 9 at 21:50
Thank you Eric for the reply, I tried the Graph-List users with continuation token indeed it is solving my problem. I haven't used the continuation token parameter in my earlier runs.
– Mahender
Jan 9 at 21:50
Thank you Eric for the reply, I tried the Graph-List users with continuation token indeed it is solving my problem. I haven't used the continuation token parameter in my earlier runs.
– Mahender
Jan 9 at 21:50
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53974453%2fvsts-pull-request-api-how-to-get-the-identityref%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3BOQUp3zzFL,wOC,OQP 18,JGre 1JLJ N,LY krw,vF,C vnZcMYl,Gyg1hHGnM d3Cq NhmmrXWFCKQ RnukD,DSOM8H Lh
Use the graph API: docs.microsoft.com/en-us/rest/api/azure/devops/graph/…
– Daniel Mann
Dec 30 '18 at 0:53
Thanks Daniel for the reply. I tried above "Users - Get" graph API but it needs the userDescriptor which i think it the GUID or some sort which isn't clear in the docs. I tried the user List graph api to list all users in the org but it only lists 500 users.
– Mahender
Dec 30 '18 at 5:45