Project

General

Profile

how to create issue via api

Added by jon morgan over 13 years ago

Hi,

I'm trying to create an issue via the rest api, however whenever i post to /projects/1/issues.xml I get a 405 error telling me POST is not accepted?

Can anyone help with this? or know the url that I should be posting to?

Thanks,
Jon


Replies (3)

RE: how to create issue via api - Added by jon morgan over 13 years ago

After a little more investigation, I am now posting to '/issues.xml' and getting a different error:
'Form authenticity token is missing or is invalid. API calls must include a proper Content-type header (text/xml or text/json).'

I'm using httparty and posting using the following line
self.class.post("/issues.xml", :body => {:issue => {:subject => 'test, :description => 'test, :project_id => 1}})

Can anyone help?

thanks

RE: how to create issue via api - Added by Felix Schäfer over 13 years ago

Can anonymous create issues on your redmine? If not, you need to use authentication, get the API key from your "my account" page.

RE: how to create issue via api - Added by jon morgan over 13 years ago

Thanks for the reply Felix

I cant work out where to enable anonymous issue creation, does anyone know where this can be done? (will allow me to rule out authentication issues), but i'm trying to use basic authentication with the default user using the following line of code.

self.class.basic_auth 'admin', 'admin'

I will give the api key approach a go tomorrow and see if that produces any better results.

thanks,
Scott

    (1-3/3)