Capture.PNG
What is the "current project id" in the context of a REST call?
Unless you are pulling back an issue, in which case you can read the project from the issue, then there is no context for any particular call.
The "id/key" of the selected project.Capture.PNG
That's a user session, nothing to do with any REST call you might be making somewhere else.
Dasuni: why are you trying to get the "current project id"? When you have that information what will you do with it? Maybe if we knew what you were trying to do we could give you a helpful answer instead of one that is essentially: "Don't rely on that information, you can't get it via REST.".
For anyone looking for this specifically, I found the same API call that @Dasuni Kumarapperuma mentioned to be really the only reliable way to get current project from the JIRA API: rest/api/1.0/menus/browse_link?inAdminMode=false
Reason why I personally need this is we have an issue searcher custom field that looks at "currentproject()" in its JQL, if I'm pushing a bunch of issues via rest and this field gets invoked, I need to make sure my users are in the correct project so my script doesn't bomb.
I was using just the regular JQL api call to get one issue from the project and read the project ID, but this only works if the project has issues, for a brand new project, this doesn't work.
And for some reason the /project/recent tries to find a project with the id of "recent" as opposed to the atlassian documentation that states that it retrieves recent projects.
It looks like you're new here. Sign in or register to get started.