Project

General

Profile

Add wiki pages via REST API

Added by marco gratzke about 11 years ago

Hi there,

i am trying to insert wiki pages via the REST API. I made a small command line tool that should do the job. The tool will be used for more REST operations later, but for now only wiki is in the focus. But it doesn't work. I am not able to create a page because redmine always says "Text field can't be blank" (indeed, it is not blank in the request)

Here is my complete request:


PUT /projects/wikitest/wiki/bugreporthelp.json?key=55399b1f0b256e9720c4bce08fbaab2d5e542dc5
Content-Type: application/json
{
        "wiki_page": {
                "title": "bugreporthelp",
                "text": "ABCDE",
                "comments": "AUTO-GENERATED" 
        }
}

... and the response i get:

{"errors":["Text field can't be blank"]}

I also tried to send the request as XML but this results in the same error (but formatted in XML). After i mentioned that the wiki-API is still "alpha" i tried to create or update an issue (this part of the API is marked as "stable"). But it doesn't work too:

  • When trying to creating a new issue, the response is always "subject can't be blank".
  • When trying to update an existing issue, redmine shows that the last time of modification is updated but no other field changed. (i checked this with a look at the mysql database).
  • GET requests seem always to work as far as i tried

I also mentioned when working with issues, the project_id has to be provided as a parameter to the request. When placing it into the request data, the controller cannot recognize the project. Is this a bug?

  • So, does anyone have an idea?
  • Did anyone use the REST API sucessfully?
  • Does anyone know how to raise the redmine log level to get more information?

I am working on a test installation with redmine 2.2.3 using the turnkey appliance


Environment:
  Redmine version                          2.2.3.stable
  Ruby version                             1.8.7 (x86_64-linux)
  Rails version                            3.2.12
  Environment                              production
  Database adapter                         MySQL
Redmine plugins:
  no plugin installed

Thanks in advance