Allow structures to be listed via the REST API
I should be able to request a list of all available structures via a GET request to the REST API, and get back a list of structure details (id, name, etc) for each structure in the response . Today I can query individual structures via the API, but there's no way to get a list of all available structures.
Delivered in Structure 2.0 – docs are at https://wiki.almworks.com/display/structure/Structure+Resource
-
Lee Goolsbee commented
Thanks Igor; that's exactly what I needed! I need to use whatever I can for now, but I'll be watching for API updates!
-
Hello Lee,
Err... no, this GET returns structures with the specified issue, and all recent structures (taken from a passed cookie) and 10 "popular" structures, but not all.
There's another undocumented REST API that returns all structures:
GET http://jira-base-url/rest/structure/1.0/gadget/structures
This returns a JSON with all structures that the user can view.
Gosh, I feel terrible about it! We need to tidy up our APIs before making them public. (This also means if you use the unpublished APIs now, your code will likely be incompatible at some point - but it should be easy to fix.)
Hope this helps!
Igor -
Lee Goolsbee commented
Hi Igor,
Thanks for replying, and thanks for the pointer on the undocumented API call :)
Can you confirm that the GET query above should return *all* structures? If not, is there a way to get it to return *all* structures (or, at least, all structures that a given user should have access to view/edit/control)?
Thanks!
- Lee -
Lee, thanks for your suggestion!
In fact, there's a way to list structures - our documentation for the REST API is somewhat outdated. Sorry about that.
The way to do that is to send GET query like this:
This is how list of structures is obtained for the structure selector on the issue page. You can tweak the parameters.
Let me know if that resource provides you with what you need.
We'll have developer documentation updated with the next release.
Igor