0

I've been trying to create a wiki page, ufollowing the documentation of the Fossil JSON API. When I put the URL http://myrepo.top/json/wiki/create?name=test I get and answer similar to:

{"fossil":"81d7d3f43ebd4e77095cfbacee7ebc9ae043a014760cde56d437dbd8b6a37c92","timestamp":1496771043,"resultCode":"FOSSIL-3002","resultText":"'name' parameter is missing.","command":"wiki/create","procTimeUs":4000,"procTimeMs":4}

I don't know how the page name is supposed to be given in the URL. I was imagining that was similar to the way you query wiki pages, but seems that the API is expecting something different. Could someone show me the proper way of adding the page name to the Fossil JSON API URL?

Thanks,

Offray
  • 505
  • 1
  • 4
  • 15

2 Answers2

2

In the Fossil mailing list Warren gave me an answer on how to proceed:

curl -H "Content-Type: application/json" \ -d '{"authToken": "nunyabinness", \ "payload": {"name": "foo", "content": "bar"} }' \ http://localhost:8080/json/wiki/create

and that gives me the proper wiki page.

Offray
  • 505
  • 1
  • 4
  • 15
1

Looking at the source code, it would seem you need to send the new wiki page name in the body of the POST request:

{ name: "test"
, content: "# Test\n\nThis is a test page."
, mimetype: "text/x-markdown"
}

If I read the code correctly, both name and content need to be specified in the JSON body, but the mimetype can be specified either as a GET parameter, or in the JSON body.

Disclaimer: I haven't tested this code, since I have no JSON-enabled instance of Fossil at hand.

Martijn
  • 13,225
  • 3
  • 48
  • 58