How to create wiki page via API

cancel
Showing results for 
Search instead for 
Did you mean: 
uakhhh
Member II

How to create wiki page via API

Hi all,

I want create wiki page via API, but i can't find guide anywhere.

Thanks for support.

3 Replies
upforsin
Senior Member

Re: How to create wiki page via API

Hi @uakhhh 

do you mean Rest API? If yes, there is a PUT request /alfresco/s/slingshot/wiki/page/{siteId}/{pageTitle} - you can find it's definition in the org/alfresco/slingshot/wiki/page.put.*

If you are interested in the Java API, have a look at the WikiPageMovePost.java (basically there is a WikiService)

uakhhh
Member II

Re: How to create wiki page via API

Hi @upforsin 

Yes rest API.
Could you help me about "curl" example or any thing like that? 

I tried but got error 500: Wrapped Exception (with status template): null. Thanks alot!

upforsin
Senior Member

Re: How to create wiki page via API

Sample request: PUT http://localhost:8080/alfresco/slingshot/wiki/page/swsdp/Sample_title

Sample json body: {"page":"wiki-page","pageTitle":"Sample title","pagecontent":"<p>Lorem <strong>ipsum</strong></p>","tags":["tag1"]}

 

With cURL that would be something like: 

curl -XPUT -H 'Accept: application/json'  -H 'Authorization: Basic XXX=' -d '{"page":"wiki-page","pageTitle":"Sample title","pagecontent":"<p>Lorem <strong>ipsum</strong></p>","tags":["tag1"]}' 'http://localhost:8080/alfresco/slingshot/wiki/page/swsdp/Sample_title'

 

To get more info about getting the auth Token have a look here https://docs.alfresco.com/content-services/7.0/develop/rest-api-guide/install/