Method not allowed error when trying to add value via API
What method should I use to add values? I've tried PUT and POST, and get 405 Method not allowed both times. Here is my URL:
The field is of type Project Specific Select Field (simple). If this type of field cannot be updated via the API, please let me know how to add values mechanically.
Here is the output: Method Not Allowed: The specified HTTP method is not allowed for the requested resource.
Using 2.2.0 on Jira 6.2.6.
Comments (16)
-
repo owner -
reporter 404 Not Found
-
repo owner Please enable detailed logging for jira.plugin.projectspecificselectfield.rest.OptionValuesManagerRest as described in the Wiki and have a look at the error message. It will show you one of these
- Missing or bad custom field id or project key
- Custom field not of type ProjectSpecificMultiSelectCFType or ProjectSpecificSingleSelectCFType
- Custom field not relevant for project or not of supported custom field type (This means that a custom field context is missing for the given combination of custom field and project)
Hope that helps
-
reporter I know it's not one of the new field types. It predates the API update: "Project Specific Select Field (simple)". Does this mean it can't be updated via the API? Can I easily, and with no data loss, change the field type?
-
repo owner Migration would mean add a new custom field of ProjectSpecificMultiSelectCFType or ProjectSpecificSingleSelectCFType and then copy old values to new custom field. By this the custom field ID will change. I will add some support for this as part of the next release.
But it is no problem to stay with "Project Specific Select Field (simple)". You can use SQL to add new values or disable existing ones. Please have a look at table AO_9661E7_SELECT_OPTION. I have updated the wiki concering SQL API.
-
reporter Thanks. Please close this issue.
-
repo owner - changed status to resolved
-
reporter - changed status to open
The API is still not working for me. This is with a Project Specific Select Field - the new kind, not the Simple kind.
I still get 405 - Method Not Allowed error when trying to submit this URL: https://example.com:8443/rest/projectspecificselectfield/1.0/option/add/DEMO/customfield_12102?value=Test+of+PHP+script
I've tried PUT and POST. GET returns a 401 error.
I am using CURL with PHP.
Do you have a script that successfully uses the API? If so, will you send it to me?
-
reporter Into which log will adding logging to jira.plugin.projectspecificselectfield.rest.OptionValuesManagerRest send logging messages? Do I need to restart Jira to start the logging?
-
repo owner Logging goes to standard JIRA logfile. Please remember to also provide username and password as part of your CURL command which identifies you as a JIRA administrator or project admin of that project.
-
reporter Which standard logfile? catalina.out? atlassian-jira.log? I am providing the username and password. Again, can you provide a script that uses the API successfully?
-
repo owner I don't know that much about curl, but I followed the examples from JIRA REST API Examples https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API+Example+-+Query+issues for curl syntax. I have successfully used on my local maschine the following statement to retrieve all option values.
curl -D- -u admin:admin -X GET http://holgers-macbook.fritz.box:2990/jira/rest/projectspecificselectfield/1.0/option/get/FCTA/customfield_10401
-
reporter Have you ever used a script to add values using the API?
-
repo owner curl -D- -u admin:admin -X GET http://holgers-macbook.fritz.box:2990/jira/rest/projectspecificselectfield/1.0/option/add/FCTA/customfield_10401?value=abc
Have you checked, that you are able to use JIRAs standard REST API e.g. for retrieving issues via the examples on https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API+Example+-+Query+issues?
-
reporter I had too many options in the curl call script. Once I got rid of all but the ones in your command line, it worked fine.
You might want to add to the docs that the API uses the GET method, since the regular Jira API uses POST and PUT for data entry.
Thank you for your help.
-
repo owner - changed status to resolved
- Log in to comment
Could you please try GET?