Open aik099 opened 7 years ago
Hi, I met the same issue. You can try to use
$jiraApi->getProjects(['expand'=>'lead'])->getResult()
to expand the parameter you want.
I've just tried to use REST API Browser
inside JIRA with lead
as expand
parameter value and still getting same expand: description,lead,url,projectKeys
back for all returned projects.
This is definitely a JIRA issue. What I'm trying to do is to minify network traffic by only requesting needed fields of each project.
May be you can access the api by this, I can get the expanded "lead" info from it:
http://www.example.com/jira/rest/api/2/project?expand=lead( or other parameter)
The JIRA api version I'm using is 7.4.1
Maybe I'm getting what I ask to be expanded, but the expand
parameter value of returned project record doesn't match what I've specified in the API call. Maybe some project properties are returned no matter what you've specified in expand
parameter.
Oh...I understand what you mean. This is indeed a JIRA issue. The JIRA api don't allow developers to call for specified expanded parameters, Except the designated expand parameters which the API allow us to use.
For example in issues I can expand any fields I like, but in projects this has no effect even if expand
parameter is present in API.
The walker uses the Jira search api., via $api->search(...) [L209 - Walker.php] . The Jira api definitely allows for the 'expand' parameter and will work if you do a post using something like Postman. However, 'expand' is entirely missing from the Api->search() and/or Walker->push() mechanism.
I believe it would be correct to implement this as it is fundamental to getting at deeper layers of data within Jira.
As the Walker has no method to return the Api class and in turn the Api::search() method hard codes the uri, the only way at the moment to add the 'expand' parameter is to subclass Api and override the search() method to add an'expand' section within the json post body being sent.
@chippyash , this is a different topic expand in search for issues
, but here we're talking about expand in search for projects
.
You're welcome to create PR to allow specifying expand to be used during search
method call done by the Walker.
@aik099 beg my pardon about topic confusion. I had to do such an override today, so when I get a free hour I'd be happy to add the functionality. cheers.
The Jira REST api allows to specify
expand
andrecent
parameters when getting projects (see https://docs.atlassian.com/jira/REST/cloud/#api/2/project-getAllProjects). TheApi::getProjects
doesn't allow to do that.I've tried to specify
expand
parameter, but I'm still getting back all fields withdescription,lead,url,projectKeys
expand returned.