Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

REST API Access on Cloud hosted Jira instance

Robert Bercik July 30, 2019

Our organization uses a cloud hosted Jira instance https://<org>.atlassian.com and we would like to use the REST api to create jira tickets automatically from python. I've been reading through the documentation for the last few days and the documentation and examples i've seen here all seem to be gear towards hosted instances of the Jira platform. The python oauth example in bitbucket also refers to servlet paths which do not appear to be available on our hosted instance.

 

Can someone give me some pointers on how to proceed here and ideally point me to an example of how to do basic authentication or OAuth authentication for the REST api using a cloud hosted instance? 

 

 

 

 

1 answer

0 votes
Warren
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 31, 2019

Hi @Robert Bercik 

If you're going to be using the API, this will be very useful for you. This may also help you with authentication

Robert Bercik July 31, 2019

Thanks this is what i'm looking for, I've got a basic REST end-to-end working but it seems like there is an issue with permissions.

 

when i to call the endpoint:

curl --request GET --url 'https://signifyd.atlassian.net/rest/api/3/issue/54591' --header 'Authorization: <XXXXXX>' --header 'Accept: application/json'

I get a response of:

{"errorMessages":["Issue does not exist or you do not have permission to see it."],"errors":{}}

 

The API key was created using my account and I have admin privileges. Here's the output of the rest call to get permissions:

 

{
"permissions": {
"ADD_COMMENTS": {
"description": "Ability to comment on issues.",
"havePermission": false,
"id": "15",
"key": "ADD_COMMENTS",
"name": "Add Comments",
"type": "PROJECT"
},
"ADMINISTER": {
"description": "Create and administer projects, issue types, fields, workflows, and schemes for all projects. Users with this permission can perform most administration tasks, except: managing users, importing data, and editing system email settings.",
"havePermission": false,
"id": "0",
"key": "ADMINISTER",
"name": "Administer Jira",
"type": "GLOBAL"
},
"ADMINISTER_PROJECTS": {
"description": "Ability to administer a project in Jira.",
"havePermission": false,
"id": "23",
"key": "ADMINISTER_PROJECTS",
"name": "Administer Projects",
"type": "PROJECT"
},
"ASSIGNABLE_USER": {
"description": "Users with this permission may be assigned to issues.",
"havePermission": false,
"id": "17",
"key": "ASSIGNABLE_USER",
"name": "Assignable User",
"type": "PROJECT"
},
"ASSIGN_ISSUE": {
"deprecatedKey": true,
"description": "Ability to assign issues to other people.",
"havePermission": false,
"id": "13",
"key": "ASSIGN_ISSUE",
"name": "Assign Issues",
"type": "PROJECT"
},
"ASSIGN_ISSUES": {
"description": "Ability to assign issues to other people.",
"havePermission": false,
"id": "13",
"key": "ASSIGN_ISSUES",
"name": "Assign Issues",
"type": "PROJECT"
},
"ATTACHMENT_DELETE_ALL": {
"deprecatedKey": true,
"description": "Users with this permission may delete all attachments.",
"havePermission": false,
"id": "38",
"key": "ATTACHMENT_DELETE_ALL",
"name": "Delete All Attachments",
"type": "PROJECT"
},
"ATTACHMENT_DELETE_OWN": {
"deprecatedKey": true,
"description": "Users with this permission may delete own attachments.",
"havePermission": false,
"id": "39",
"key": "ATTACHMENT_DELETE_OWN",
"name": "Delete Own Attachments",
"type": "PROJECT"
},
"BROWSE": {
"deprecatedKey": true,
"description": "Ability to browse projects and the issues within them.",
"havePermission": false,
"id": "10",
"key": "BROWSE",
"name": "Browse Projects",
"type": "PROJECT"
},
"BROWSE_PROJECTS": {
"description": "Ability to browse projects and the issues within them.",
"havePermission": false,
"id": "10",
"key": "BROWSE_PROJECTS",
"name": "Browse Projects",
"type": "PROJECT"
},
"BULK_CHANGE": {
"description": "Modify collections of issues at once. For example, resolve multiple issues in one step.",
"havePermission": false,
"id": "33",
"key": "BULK_CHANGE",
"name": "Make bulk changes",
"type": "GLOBAL"
},
"CLOSE_ISSUE": {
"deprecatedKey": true,
"description": "Ability to close issues. Often useful where your developers resolve issues, and a QA department closes them.",
"havePermission": false,
"id": "18",
"key": "CLOSE_ISSUE",
"name": "Close Issues",
"type": "PROJECT"
},
"CLOSE_ISSUES": {
"description": "Ability to close issues. Often useful where your developers resolve issues, and a QA department closes them.",
"havePermission": false,
"id": "18",
"key": "CLOSE_ISSUES",
"name": "Close Issues",
"type": "PROJECT"
},
"COMMENT_DELETE_ALL": {
"deprecatedKey": true,
"description": "Ability to delete all comments made on issues.",
"havePermission": false,
"id": "36",
"key": "COMMENT_DELETE_ALL",
"name": "Delete All Comments",
"type": "PROJECT"
},
"COMMENT_DELETE_OWN": {
"deprecatedKey": true,
"description": "Ability to delete own comments made on issues.",
"havePermission": false,
"id": "37",
"key": "COMMENT_DELETE_OWN",
"name": "Delete Own Comments",
"type": "PROJECT"
},
"COMMENT_EDIT_ALL": {
"deprecatedKey": true,
"description": "Ability to edit all comments made on issues.",
"havePermission": false,
"id": "34",
"key": "COMMENT_EDIT_ALL",
"name": "Edit All Comments",
"type": "PROJECT"
},
"COMMENT_EDIT_OWN": {
"deprecatedKey": true,
"description": "Ability to edit own comments made on issues.",
"havePermission": false,
"id": "35",
"key": "COMMENT_EDIT_OWN",
"name": "Edit Own Comments",
"type": "PROJECT"
},
"COMMENT_ISSUE": {
"deprecatedKey": true,
"description": "Ability to comment on issues.",
"havePermission": false,
"id": "15",
"key": "COMMENT_ISSUE",
"name": "Add Comments",
"type": "PROJECT"
},
"CREATE_ATTACHMENT": {
"deprecatedKey": true,
"description": "Users with this permission may create attachments.",
"havePermission": false,
"id": "19",
"key": "CREATE_ATTACHMENT",
"name": "Create Attachments",
"type": "PROJECT"
},
"CREATE_ATTACHMENTS": {
"description": "Users with this permission may create attachments.",
"havePermission": false,
"id": "19",
"key": "CREATE_ATTACHMENTS",
"name": "Create Attachments",
"type": "PROJECT"
},
"CREATE_ISSUE": {
"deprecatedKey": true,
"description": "Ability to create issues.",
"havePermission": false,
"id": "11",
"key": "CREATE_ISSUE",
"name": "Create Issues",
"type": "PROJECT"
},
"CREATE_ISSUES": {
"description": "Ability to create issues.",
"havePermission": false,
"id": "11",
"key": "CREATE_ISSUES",
"name": "Create Issues",
"type": "PROJECT"
},
"CREATE_PROJECT": {
"description": "Create projects separate from shared configurations and schemes. Next-gen projects don't affect existing projects or shared configurations like workflows, fields or permissions. Only licensed users can create next-gen projects.",
"havePermission": false,
"id": "-1",
"key": "CREATE_PROJECT",
"name": "Create next-gen projects",
"type": "GLOBAL"
},
"CREATE_SHARED_OBJECTS": {
"description": "Share dashboards and filters with other users.",
"havePermission": false,
"id": "22",
"key": "CREATE_SHARED_OBJECTS",
"name": "Share dashboards and filters",
"type": "GLOBAL"
},
"DELETE_ALL_ATTACHMENTS": {
"description": "Users with this permission may delete all attachments.",
"havePermission": false,
"id": "38",
"key": "DELETE_ALL_ATTACHMENTS",
"name": "Delete All Attachments",
"type": "PROJECT"
},
"DELETE_ALL_COMMENTS": {
"description": "Ability to delete all comments made on issues.",
"havePermission": false,
"id": "36",
"key": "DELETE_ALL_COMMENTS",
"name": "Delete All Comments",
"type": "PROJECT"
},
"DELETE_ALL_WORKLOGS": {
"description": "Ability to delete all worklogs made on issues.",
"havePermission": false,
"id": "43",
"key": "DELETE_ALL_WORKLOGS",
"name": "Delete All Worklogs",
"type": "PROJECT"
},
"DELETE_ISSUE": {
"deprecatedKey": true,
"description": "Ability to delete issues.",
"havePermission": false,
"id": "16",
"key": "DELETE_ISSUE",
"name": "Delete Issues",
"type": "PROJECT"
},
"DELETE_ISSUES": {
"description": "Ability to delete issues.",
"havePermission": false,
"id": "16",
"key": "DELETE_ISSUES",
"name": "Delete Issues",
"type": "PROJECT"
},
"DELETE_OWN_ATTACHMENTS": {
"description": "Users with this permission may delete own attachments.",
"havePermission": false,
"id": "39",
"key": "DELETE_OWN_ATTACHMENTS",
"name": "Delete Own Attachments",
"type": "PROJECT"
},
"DELETE_OWN_COMMENTS": {
"description": "Ability to delete own comments made on issues.",
"havePermission": false,
"id": "37",
"key": "DELETE_OWN_COMMENTS",
"name": "Delete Own Comments",
"type": "PROJECT"
},
"DELETE_OWN_WORKLOGS": {
"description": "Ability to delete own worklogs made on issues.",
"havePermission": false,
"id": "42",
"key": "DELETE_OWN_WORKLOGS",
"name": "Delete Own Worklogs",
"type": "PROJECT"
},
"EDIT_ALL_COMMENTS": {
"description": "Ability to edit all comments made on issues.",
"havePermission": false,
"id": "34",
"key": "EDIT_ALL_COMMENTS",
"name": "Edit All Comments",
"type": "PROJECT"
},
"EDIT_ALL_WORKLOGS": {
"description": "Ability to edit all worklogs made on issues.",
"havePermission": false,
"id": "41",
"key": "EDIT_ALL_WORKLOGS",
"name": "Edit All Worklogs",
"type": "PROJECT"
},
"EDIT_ISSUE": {
"deprecatedKey": true,
"description": "Ability to edit issues.",
"havePermission": false,
"id": "12",
"key": "EDIT_ISSUE",
"name": "Edit Issues",
"type": "PROJECT"
},
"EDIT_ISSUES": {
"description": "Ability to edit issues.",
"havePermission": false,
"id": "12",
"key": "EDIT_ISSUES",
"name": "Edit Issues",
"type": "PROJECT"
},
"EDIT_OWN_COMMENTS": {
"description": "Ability to edit own comments made on issues.",
"havePermission": false,
"id": "35",
"key": "EDIT_OWN_COMMENTS",
"name": "Edit Own Comments",
"type": "PROJECT"
},
"EDIT_OWN_WORKLOGS": {
"description": "Ability to edit own worklogs made on issues.",
"havePermission": false,
"id": "40",
"key": "EDIT_OWN_WORKLOGS",
"name": "Edit Own Worklogs",
"type": "PROJECT"
},
"LINK_ISSUE": {
"deprecatedKey": true,
"description": "Ability to link issues together and create linked issues. Only useful if issue linking is turned on.",
"havePermission": false,
"id": "21",
"key": "LINK_ISSUE",
"name": "Link Issues",
"type": "PROJECT"
},
"LINK_ISSUES": {
"description": "Ability to link issues together and create linked issues. Only useful if issue linking is turned on.",
"havePermission": false,
"id": "21",
"key": "LINK_ISSUES",
"name": "Link Issues",
"type": "PROJECT"
},
"MANAGE_GROUP_FILTER_SUBSCRIPTIONS": {
"description": "Create and delete group filter subscriptions.",
"havePermission": false,
"id": "24",
"key": "MANAGE_GROUP_FILTER_SUBSCRIPTIONS",
"name": "Manage group filter subscriptions",
"type": "GLOBAL"
},
"MANAGE_SPRINTS_PERMISSION": {
"description": "Ability to manage sprints.",
"havePermission": false,
"id": "-1",
"key": "MANAGE_SPRINTS_PERMISSION",
"name": "Manage sprints",
"type": "PROJECT"
},
"MANAGE_WATCHERS": {
"description": "Ability to manage the watchers of an issue.",
"havePermission": false,
"id": "32",
"key": "MANAGE_WATCHERS",
"name": "Manage Watchers",
"type": "PROJECT"
},
"MANAGE_WATCHER_LIST": {
"deprecatedKey": true,
"description": "Ability to manage the watchers of an issue.",
"havePermission": false,
"id": "32",
"key": "MANAGE_WATCHER_LIST",
"name": "Manage Watchers",
"type": "PROJECT"
},
"MODIFY_REPORTER": {
"description": "Ability to modify the reporter when creating or editing an issue.",
"havePermission": false,
"id": "30",
"key": "MODIFY_REPORTER",
"name": "Modify Reporter",
"type": "PROJECT"
},
"MOVE_ISSUE": {
"deprecatedKey": true,
"description": "Ability to move issues between projects or between workflows of the same project (if applicable). Note the user can only move issues to a project they have the create permission for.",
"havePermission": false,
"id": "25",
"key": "MOVE_ISSUE",
"name": "Move Issues",
"type": "PROJECT"
},
"MOVE_ISSUES": {
"description": "Ability to move issues between projects or between workflows of the same project (if applicable). Note the user can only move issues to a project they have the create permission for.",
"havePermission": false,
"id": "25",
"key": "MOVE_ISSUES",
"name": "Move Issues",
"type": "PROJECT"
},
"PROJECT_ADMIN": {
"deprecatedKey": true,
"description": "Ability to administer a project in Jira.",
"havePermission": false,
"id": "23",
"key": "PROJECT_ADMIN",
"name": "Administer Projects",
"type": "PROJECT"
},
"RESOLVE_ISSUE": {
"deprecatedKey": true,
"description": "Ability to resolve and reopen issues. This includes the ability to set a fix version.",
"havePermission": false,
"id": "14",
"key": "RESOLVE_ISSUE",
"name": "Resolve Issues",
"type": "PROJECT"
},
"RESOLVE_ISSUES": {
"description": "Ability to resolve and reopen issues. This includes the ability to set a fix version.",
"havePermission": false,
"id": "14",
"key": "RESOLVE_ISSUES",
"name": "Resolve Issues",
"type": "PROJECT"
},
"SCHEDULE_ISSUE": {
"deprecatedKey": true,
"description": "Ability to view or edit an issue's due date.",
"havePermission": false,
"id": "28",
"key": "SCHEDULE_ISSUE",
"name": "Schedule Issues",
"type": "PROJECT"
},
"SCHEDULE_ISSUES": {
"description": "Ability to view or edit an issue's due date.",
"havePermission": false,
"id": "28",
"key": "SCHEDULE_ISSUES",
"name": "Schedule Issues",
"type": "PROJECT"
},
"SERVICEDESK_AGENT": {
"description": "Allows users to interact with customers and access Service Desk features of a project.",
"havePermission": false,
"id": "-1",
"key": "SERVICEDESK_AGENT",
"name": "Service Desk Agent",
"type": "PROJECT"
},
"SET_ISSUE_SECURITY": {
"description": "Ability to set the level of security on an issue so that only people in that security level can see the issue.",
"havePermission": false,
"id": "26",
"key": "SET_ISSUE_SECURITY",
"name": "Set Issue Security",
"type": "PROJECT"
},
"SYSTEM_ADMIN": {
"description": "Ability to perform all administration functions. There must be at least one group with this permission.",
"havePermission": false,
"id": "44",
"key": "SYSTEM_ADMIN",
"name": "Jira System Administrators",
"type": "GLOBAL"
},
"TRANSITION_ISSUE": {
"deprecatedKey": true,
"description": "Ability to transition issues.",
"havePermission": false,
"id": "46",
"key": "TRANSITION_ISSUE",
"name": "Transition Issues",
"type": "PROJECT"
},
"TRANSITION_ISSUES": {
"description": "Ability to transition issues.",
"havePermission": false,
"id": "46",
"key": "TRANSITION_ISSUES",
"name": "Transition Issues",
"type": "PROJECT"
},
"USER_PICKER": {
"description": "View and select users or groups from the user picker, and share issues. Users with this permission can see the names of all users and groups on your site.",
"havePermission": false,
"id": "27",
"key": "USER_PICKER",
"name": "Browse users and groups",
"type": "GLOBAL"
},
"VIEW_DEV_TOOLS": {
"description": "Allows users in a software project to view development-related information on the issue, such as commits, reviews and build information.",
"havePermission": false,
"id": "29",
"key": "VIEW_DEV_TOOLS",
"name": "View Development Tools",
"type": "PROJECT"
},
"VIEW_READONLY_WORKFLOW": {
"description": "Users with this permission may view a read-only version of a workflow.",
"havePermission": false,
"id": "45",
"key": "VIEW_READONLY_WORKFLOW",
"name": "View Read-Only Workflow",
"type": "PROJECT"
},
"VIEW_VERSION_CONTROL": {
"deprecatedKey": true,
"description": "Allows users to view development-related information on the view issue screen, like commits, reviews and build information.",
"havePermission": false,
"id": "29",
"key": "VIEW_VERSION_CONTROL",
"name": "View Development Tools",
"type": "PROJECT"
},
"VIEW_VOTERS_AND_WATCHERS": {
"description": "Ability to view the voters and watchers of an issue.",
"havePermission": false,
"id": "31",
"key": "VIEW_VOTERS_AND_WATCHERS",
"name": "View Voters and Watchers",
"type": "PROJECT"
},
"VIEW_WORKFLOW_READONLY": {
"deprecatedKey": true,
"description": "admin.permissions.descriptions.VIEW_WORKFLOW_READONLY",
"havePermission": false,
"id": "45",
"key": "VIEW_WORKFLOW_READONLY",
"name": "View Read-Only Workflow",
"type": "PROJECT"
},
"WORKLOG_DELETE_ALL": {
"deprecatedKey": true,
"description": "Ability to delete all worklogs made on issues.",
"havePermission": false,
"id": "43",
"key": "WORKLOG_DELETE_ALL",
"name": "Delete All Worklogs",
"type": "PROJECT"
},
"WORKLOG_DELETE_OWN": {
"deprecatedKey": true,
"description": "Ability to delete own worklogs made on issues.",
"havePermission": false,
"id": "42",
"key": "WORKLOG_DELETE_OWN",
"name": "Delete Own Worklogs",
"type": "PROJECT"
},
"WORKLOG_EDIT_ALL": {
"deprecatedKey": true,
"description": "Ability to edit all worklogs made on issues.",
"havePermission": false,
"id": "41",
"key": "WORKLOG_EDIT_ALL",
"name": "Edit All Worklogs",
"type": "PROJECT"
},
"WORKLOG_EDIT_OWN": {
"deprecatedKey": true,
"description": "Ability to edit own worklogs made on issues.",
"havePermission": false,
"id": "40",
"key": "WORKLOG_EDIT_OWN",
"name": "Edit Own Worklogs",
"type": "PROJECT"
},
"WORK_ISSUE": {
"deprecatedKey": true,
"description": "Ability to log work done against an issue. Only useful if Time Tracking is turned on.",
"havePermission": false,
"id": "20",
"key": "WORK_ISSUE",
"name": "Work On Issues",
"type": "PROJECT"
},
"WORK_ON_ISSUES": {
"description": "Ability to log work done against an issue. Only useful if Time Tracking is turned on.",
"havePermission": false,
"id": "20",
"key": "WORK_ON_ISSUES",
"name": "Work On Issues",
"type": "PROJECT"
}
}
}
 
Warren
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 31, 2019

Hi @Robert Bercik 

I think your API call is incorrect. You need to be passing in the issue key, so the call should look like

/rest/api/3/issue/ABC-123

I'm hoping that this resolves your problem. 

Robert Bercik August 1, 2019

Hi @Warren 

I should have mentioned I get the same issue whether passing the issue id or the issue key. I can make other calls successfully. 

 

Do I need to modify permisisons for my user account? If so, which permissions do I need to add? Would global permissions do the trick? 

Suggest an answer

Log in or Sign up to answer