Method not allowed error when trying to add value via API

Issue #37 resolved
Joe Mallon created an issue

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:

http://example.com/rest/projectspecificselectfield/1.0/option/add/DEMO/customfield_11500?value=Test%20value

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)

  1. Holger Schimanski 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

  2. Joe Mallon 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?

  3. Holger Schimanski 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.

  4. Joe Mallon 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?

  5. Joe Mallon 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?

  6. Holger Schimanski 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.

  7. Joe Mallon 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?

  8. Joe Mallon 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.

  9. Log in to comment