Project Specific Select Field REST API with jira-python

JUS February 18, 2018

Hi, the Project Specific Select Field REST API uses access URL as in example http://localhost:2990/rest/projectspecificselectfield/1.0/customfield/FCTA/customfield_10400

But the jira-phyton function find() to "Find Resource object for any addressable resource on the server" extends path to
http://localhost:2990/rest/api/2/projectspecificselectfield/1.0/customfield/FCTA/customfield_10400
(/api/2/ inserted) which does not match the required URL. Any hint to resolve this ? Many thanks, Jens-Uwe

1 answer

0 votes
Shaun S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 5, 2018

Looking at the source code for the jira-python library (link), it looks like the url path for api calls is constructed using some default values for rest_path and rest_api_version provided by the JIRA class. 

From the code:

class JIRA(object):

...

DEFAULT_OPTIONS = {
"server": "http://localhost:2990/jira",
"auth_url": '/rest/auth/1/session',
"context_path": "/",
"rest_path": "api",
"rest_api_version": "2",
"agile_rest_path": GreenHopperResource.GREENHOPPER_REST_PATH,
"agile_rest_api_version": "1.0",
"verify": True,
"resilient": True,
"async": False,
"client_cert": None,
"check_update": False,

Without modifying the codebase the only workaround I can think of would be to provide values for those two options so that the URL is constructed properly.  

Example:

import jira.client
from jira.client import JIRA


jira_options={'server': 'http://localhost:2990/jira','rest_path': 'projectspecificselectfield','rest_api_version':'1.0'}
jira=JIRA(options=jira_options,basic_auth=('admin','password'))

* Remainder of your code*

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events