Wiki API




  • Avatar
    Jay Mitchell

    Hi Lisa,

    Thanks for posting. I think several people have had similar questions. The Mingle help is fairly comprehensive, but is sometimes missing practical examples. The Go help gives examples of how to use their API using the curl command line utility. I'm going to take that approach to try to explain how to use this API.

    To add the this wiki page using curl, I entered the following at my terminal (split over several lines for readability):

    curl -v -u jay:mongoose 

    -d "page[name]=testing wiki creation2&page[content]=this is new wiki content"


    • -v just makes the output a bit more verbose. I did this just to point out a few things in the API call.

    • -u allows me to pass my user name (jay) and password (mongoose).

    • -d contains the HTTP POST data. This is where I place the page name and content.

    • http://localhost:8080/api/v2/projects/test_project/wiki.xml is just the address of the API. (I'm just testing this locally.)

    The (relevant) output of that call is:

    > POST /api/v2/projects/test_project/wiki.xml HTTP/1.1

    > Authorization: Basic dHdvcmtlcjox

    > Content-Length: 72

    < HTTP/1.1 201 Created

    < Location: http://localhost:8080/api/v2/projects/test_project/wiki/testing_wiki_creation.xml

    • ">" indicates data sent, and "<" indicates data received.

    • The first line indicates this is an HTTP POST

    • The second line indicates that we are using basic authentication (which needs to be turned on in order to use the Mingle API).

    • The third line indicates the content length is 72. This is the length of "page[name]=testing wiki creation2&page[content]=this is new wiki content" - this is the content of the call.

    • The fourth line indicates that the page was created correctly.

    • Finally, we are sent back the location of the new page. Some Mingle API calls return XML in the content, this one just returns a location.

    As a result of this call, I have the following in my logs (split over several lines for readability):

    Processing PagesController#create to xml (for at 2010-09-23 14:17:05) [POST]

    [2010-09-23 14:17:05,934] [btpool0-6] [/]   Parameters: {"page"=>{"name"=>"testing wiki creation", 

    "content"=>"this is new wiki content"}, "controller"=>"pages", "action"=>"create", "format"=>"xml", 

    "api_version"=>"v2", "project_id"=>"test_project"}

    You can see that the name and content are passed as part of the page parameter.

    Sorry that I can only tell you what needs to be done rather than how to do it. How to make this call depends on the language and library that you are using. I personally use Ruby with "net/https", but I know others use Ruby with ActiveResource, PHP, Java, .NET, etc.

    If you let me know what language and library you are using, I might be able to give a more concrete answer.


    Comment actions Permalink
  • Avatar

    Thanks Jay!
    You've got no idea how much this helps me to understand.

    Comment actions Permalink

Please sign in to leave a comment.