Open document via REST API

Having trouble deploying Oxygen XML Web Author? Got a bug to report? Post it all here.
leo2341
Posts: 2
Joined: Mon Jul 12, 2021 7:22 pm

Open document via REST API

Post by leo2341 »

Hello,

In my web application I am trying to open a document using the Web Author REST plugin directly rather than browsing for documents. My Goal is something like this:

Code: Select all

https://localhost:10443/webauthor/api/document?url=rest%3A%2F%2Flocalhost%3A10443%2Fwebauthor%2Fapi%2Ffiles%3Furl%3D%2Fdita%2Fflowers%2Ftopics%2Fflowers%2Fgardenia.dita%26ccOnEnter%3Dfalse%26stylesheet-titles%3DBasic%2C%2B%20Inline%20insertion%20actions%26author%3DAnonym
The documentation (https://github.com/oxygenxml/web-author ... PI-spec.md) states four endpoints for file operations. However, they seem to apply only to binary files and I can't find documentation about how the endpoint in my Java backend must look like for XML Documents.

Can you please point my in the right direction?

Cheers
leo2341
Posts: 2
Joined: Mon Jul 12, 2021 7:22 pm

Re: Open document via REST API

Post by leo2341 »

I tried

Code: Select all

https://localhost:10443/webauthor/app/oxygen.html?url=rest%3A%2F%2Flocalhost%3A10443%2Fwebauthor%2Fapi%2Ffiles%3Furl%3D%2Fdita%2Fflowers%2Ftopics%2Fflowers%2Fgardenia.dita%26ccOnEnter%3Dfalse%26stylesheet-titles%3DBasic%2C%2B%20Inline%20insertion%20actions%26author%3DAnonym
and that results in a XHR call for

Code: Select all

https://localhost:10443/webauthor/rest/v23.1.0/doc/load?userName=Anonym 
which seems what I need. I am just wondering if the expected result from
doc/load
is somewhere documented I haven't checked yet.

Cheers
mihai_coanda
Posts: 78
Joined: Wed Jul 20, 2016 8:22 am

Re: Open document via REST API

Post by mihai_coanda »

Hello,
In the REST plugin you configure your server's URL as REST Server URL, documented as $BASE_URL.
When you try to open

Code: Select all

https://localhost:10443/webauthor/app/oxygen.html?url=rest%3A%2F%2Flocalhost%3A10443%2Fwebauthor%2Fapi%2Ffiles%3Furl%3D%2Fdita%2Fflowers%2Ftopics%2Fflowers%2Fgardenia.dita%26ccOnEnter%3Dfalse%26stylesheet-titles%3DBasic%2C%2B%20Inline%20insertion%20actions%26author%3DAnonym
A request to your server will be made:
$BASE_URL/file?url=rest%3A%2F%2Flocalhost%3A10443%2Fwebauthor%2Fapi%2Ffiles%3Furl%3D%2Fdita%2Fflowers%2Ftopics%2Fflowers%2Fgardenia.dita

In this request, you will have to detect the file that you should serve and respond with the file's content.

Is this request not made to your REST server?
Please note that this request is made from the server, not the browser.

Regards,
Michael
Michael

https://www.oxygenxml.com
Post Reply