Skip to content
This repository has been archived by the owner on Jul 23, 2020. It is now read-only.

Can't create issue-405 method not allowed #193

Open
oanadonose opened this issue Oct 4, 2019 · 0 comments
Open

Can't create issue-405 method not allowed #193

oanadonose opened this issue Oct 4, 2019 · 0 comments

Comments

@oanadonose
Copy link

Hello. I'm just starting out with this package and I seem to be stuck with getting a 405 code when trying to create a new issue.

This is my code:

jira.createIssue = function(issue, callback) {
  var options = {
    uri: jira.buildURL("/issue/IS-2"),
    method: "POST",
    followAllRedirects: true,
    json: true,
    body: issue
  };

  console.log("above request + uri: " + options.uri);
  return jira.makeRequest(options, callback);
  console.log("under request");
};

const issue = {
  fields: {
    summary: "Create issue summary",
    issueType: "bug",
    priority: {
      id: "20000"
    },
    labels: ["please", "work"],
    environment: "DEV"
  }
};

jira
  .createIssue(issue)
  .then(function(data) {
    console.log("Promise resolved.\n" + data);
  })
  .catch(function(data) {
    console.log("Promise rejected.\n" + data);
  });

which prints out:

{ 
   "statusCode":405,
   "body":"",
   "headers":{ 
      "server":"AtlassianProxy/1.15.8.1",
      "content-type":"text/html;charset=UTF-8",
      "strict-transport-security":"max-age=315360000; includeSubDomains; preload",
      "date":"Fri, 04 Oct 2019 10:54:14 GMT",
      "atl-traceid":"75e6a43cadefd6d2",
      "x-aaccountid":"5d95b64fefc9290c2e6285ff",
      "x-arequestid":"b623d4e7-a3b9-4167-a327-31368a2a89c8",
      "x-xss-protection":"1;
mode=block",
      "transfer-encoding":"chunked",
      "timing-allow-origin":"*",
      "x-content-type-options":"nosniff",
      "connection":"close",
      "set-cookie":[ 
         "atlassian.xsrf.token=e336999c-abb0-4f8b-8cd1-78a612d7da1a_bc014592aeecefb3bb578143e538806baaf1b082_lin; Path=/; Secure"
      ],
      "allow":"HEAD,DELETE,GET,OPTIONS,PUT"
   },
   "request":{ 
      "uri":{ 
         "protocol":"https:",
         "slashes":true,
         "auth":null,
         "host":"tinclimate.atlassian.net",
         "port":443,
         "hostname":"tinclimate.atlassian.net",
         "hash":null,
         "search":null,
         "query":null,
         "pathname":"/rest/api/2/issue/IS-2",
         "path":"/rest/api/2/issue/IS-2",
         "href":"https://tinclimate.atlassian.net/rest/api/2/issue/IS-2"
      },
      "method":"POST",
      "headers":{ 
         "authorization":"Basic ZG9ub3Nlb2FuYUBnbWFpbC5jb206NDJxOGgyMnhkVkRyODh2WmZ1WTgzMUJG",
         "accept":"application/json",
         "content-type":"application/json",
         "content-length":136
      }
   }
}

I created a test instance of jira and only authenticated with the basic auth option.. not sure what is wrong

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant