Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Jira REST api - Problem creating issue

Scott Sherwood April 13, 2013

Hi,

Im trying to use teh Jira REST api to create an issue, but have run into a problem that i cant seem to find a solution for, does anyone know of where I am going wrong. (Ive been able to do get requests ok, so happy that the authentication and url are setup correctly)

Code

self.class.base_uri @api_url
self.class.basic_auth @api_username, @api_password
        
self.class.headers({'Content-Type' => 'application/json'})

response = self.class.post("/issue", :body => {
  :fields => {
    :issuetype => {
      :id => "1"
    },
    :project => {
      :key => "DEMO"
    },
    :summary => "Test ticket", 
    :description => "Test Desc"
  }
})

Response

{"errorMessages"=>["Unrecognized token 'filssmay': was expecting 'null', 'true', 'false' or NaN\n at [Source: org.apache.catalina.connector.CoyoteInputStream@6d63c5; line: 1, column: 17]"]}

Thanks,
Scott

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Michal Husar
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 14, 2013

Hi Scott, can you please take a look(or you can post it here) on your JSON string whether it is correct?

Scott Sherwood April 14, 2013

Thanks for your response, you triggered a thought and it turned out that I wasnt actually generating the json and isntead just sending over normal params.

Michal Husar
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 15, 2013

You are welcome ;) Please mark answer as correct answer if it helped to you.

0 votes
Sandeep Arneja July 30, 2013

thanks @scott

0 votes
Michal Husar
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 15, 2013

You are welcome ;) Please mark answer as correct answer if it helped to you.

TAGS
AUG Leaders

Atlassian Community Events