Skip to content

Commit 27d350c

Browse files
committed
Migrate to Jira API v3
1 parent aec90fd commit 27d350c

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

src/engines/jira.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const engine: Engine = {
1616
init: (options: { origin: string; token: string; user: string }) => {
1717
client = axios.create({
1818
auth: { password: options.token, username: options.user },
19-
baseURL: `${options.origin}/rest/api/2`,
19+
baseURL: `${options.origin}/rest/api/3`,
2020
});
2121
origin = options.origin;
2222
},
@@ -27,8 +27,7 @@ const engine: Engine = {
2727
throw Error("Engine not initialized");
2828
}
2929

30-
// TODO: Use API v3?
31-
// https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/#searching-for-issues-examples
30+
// https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-search/#api-rest-api-3-search-jql-get
3231
const data: {
3332
issues: {
3433
fields: {
@@ -40,8 +39,12 @@ const engine: Engine = {
4039
renderedFields: { description: string };
4140
}[];
4241
} = (
43-
await client.get("/search", {
44-
params: { expand: "renderedFields", jql: `text ~ "${sanitize(q)}"` },
42+
await client.get("/search/jql", {
43+
params: {
44+
expand: "renderedFields",
45+
fields: "description,summary,updated",
46+
jql: `text ~ "${sanitize(q)}"`,
47+
},
4548
})
4649
).data;
4750
return data.issues.map(issue => ({

0 commit comments

Comments
 (0)