Reputation: 7434
Given a known buildDefinitionId I am attempting to determine the (one or more) Release Definitions that depend on the output of the build.
state that I can pass in an artifactSourceId
parameter in the format {projectGuid}:{BuildDefinitionId}
however when I try to pass in this parameter I get every release definition for the specified project.
Using the url : https://vsrm.dev.azure.com/my-company/d4155bbc-d85f-4aaf-9a8e-0ba70272cca4/_apis/release/definitions?artifactSourceId=d4155bbc-d85f-4aaf-9a8e-0ba70272cca4:950&api-version=5.0
In my project I get a list of 553 build definitions. Searching in the response body for the artifact key d4155bbc-d85f-4aaf-9a8e-0ba70272cca4:950
({projectGuid}:{buildDefinitionId}) gives me the expected 2 results as per below:
"artifacts": [
{
"sourceId": "d4155bbc-d85f-4aaf-9a8e-0ba70272cca4:950",
"type": "Build",
"alias": "my-build-definition",
// more fields here
}
]
Curiously if I don't pass in the artifactSourceId
parameter, I don't get any artifact data in the response at all - including when I specify the $expand=artifact
parameter - but I can specify artifactSourceId=xyz
and it will still return a list of all release definitions.
This seems like it could be a bug with the api, but if anyone has any insight or workarounds I would be grateful.
Upvotes: 1
Views: 243
Reputation: 31003
You need to use parameter $expand=artifacts
(not $expand=artifact
) to expand artifacts details.
Regarding parameter artifactSourceId
, you need to use parameters artifactType
and artifactSourceId
together to filter the Release definitions with given artifactSourceId.
Upvotes: 3