CURL POST Generating Error 405 (Verb Not Allowed)

Kevin Morgan November 12, 2018

When attempting to use CURL to create a new Jira Story, I am receiving the following error:

"405 - HTTP verb used to access this page is not allowed."

Here is what I am passing:

curl --request POST --url https://domain.atlassian.net/rest/api/3/issue/ --header Authorization: Bearer <api_token> --header Accept: application/json --header Content-Type: application/json --data { <data> }

And the <data> being sent is JSON, like this:

{
   "fields": {
      "project": {
         "key": "key"
      },
      "summary": "summary",
      "description": "description",
      "issuetype": {
         "name": "Bug"
      },
      "customfield_10200": "data"
   }
}

I suspect there is some authentication missing from the Jira side, but I am not entirely sure. My first time attempting to write a script to create a Jira Story.

2 answers

1 accepted

0 votes
Answer accepted
Kevin Morgan November 12, 2018

I discovered that I was not properly base64 encoding my user and API token. I also found that I was using Authorization: Bearer when I should have been using Authorization: Basic.

These changes resolved my issue.

0 votes
Kevin Morgan November 12, 2018

I have also tried using this:

--user <username>:<api_token>

Instead of this:

--header Authorization: Bearer <api_token>

As I have done anything with OAuth for REST APIs in Jira. Perhaps that's what I am missing, but that seems to be more about add-ons than scripts.

Suggest an answer

Log in or Sign up to answer