Skip to content

feat: add support for jira server API#33

Merged
emrearmagan merged 12 commits into
emrearmagan:mainfrom
xamcost:feat/jira-server-api-support
Jun 7, 2026
Merged

feat: add support for jira server API#33
emrearmagan merged 12 commits into
emrearmagan:mainfrom
xamcost:feat/jira-server-api-support

Conversation

@xamcost

@xamcost xamcost commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Hi there! Thank for this nice plugin. I extended it to support not only the cloud API of Jira, but also the server one. More precisely, this PR introduces two new options in the Jira provider:

  • the api_type: can be cloud or server, defaults to cloud to keep the current behaviour.
  • the auth_method: can be basic or bearer, defaults to basic to keep the current behaviour. bearer allows you to use an API token only instead of email/password.

For reference, I used these docs to implement the server API support.

Of course, feel free to reject this PR if you think it clutters your plugin.

@emrearmagan

Copy link
Copy Markdown
Owner

Awesome, thanks for the contribution!
This has been on my roadmap as well.

I will give it a try tomorrow and take a closer look. Much appreciated!

end

local escaped_key = vim.fn.escape(project_key, "&=?")
local endpoint = string.format("/issue/createmeta?projectKeys=%s&expand=projects.issuetypes", escaped_key)

@emrearmagan emrearmagan Jun 6, 2026

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried this against a local Jira Data Center (Version: 9.12) and "Create issue" didn't work for me. So far this worked for me for the server case:

	if config.jira_config().api_type == "server" then
		local endpoint = string.format("/issue/createmeta/%s/issuetypes", escaped_key)
		return service.request("GET", endpoint, nil, function(result, err)
			if err ~= nil or type(result) ~= "table" then
				callback(nil, err or "Empty response")
				return
			end
			local raw_types = result.values
			if type(raw_types) ~= "table" then
				callback({}, nil)
				return
			end
			local issue_types = {}
			for _, raw in ipairs(raw_types) do
				local issue_type = normalizer.to_issue_type(raw)
				if issue_type ~= nil then
					table.insert(issue_types, issue_type)
				end
			end
			callback(issue_types, nil)
		end, {
			action = "Fetch create metadata",
			project_key = project_key,
		})
	end

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for overlooking that, and thanks for the fix. I added it in 4d9034d .

On my side, I needed more to make it work, but it's because of the specific Jira server configuration: it seems it didn't enable setting the description of an issue in the REST API (it returns a Field 'description' cannot be set error, similar to this issue). I unfortunately don't have access to the Jira server settings (it's managed by my employer), so I implemented a workaround in 64cec99 , which consists of creating the issue then immediately update it, in case the error is raised: having said that, considering how specific it is, I am happy to remove this commit to keep your codebase clean, just let me know.

@emrearmagan emrearmagan Jun 7, 2026

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works like a charm, thank you! The workaround is isolated and will probably save the next person stuck with the same jira config 👍

Just in case you are also using Bitbucket Server -> I have been slowly working on it over the last few weeks and just opened a draft PR for it.

@emrearmagan emrearmagan merged commit 33d872b into emrearmagan:main Jun 7, 2026
1 check passed
@emrearmagan

Copy link
Copy Markdown
Owner

@all-contributors please add @xamcost for code

@allcontributors

Copy link
Copy Markdown
Contributor

@emrearmagan

I've put up a pull request to add @xamcost! 🎉

emrearmagan added a commit that referenced this pull request Jun 7, 2026
# By Xamcost (1) and allcontributors[bot] (1)
# Via GitHub
* main:
  docs: add xamcost as a contributor for code (#34)
  feat: add support for jira server API (#33)

# Conflicts:
#	lua/atlas/issues/providers/jira/init.lua
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants