Page 1 of 1

Open document via REST API

Posted: Mon Jul 12, 2021 7:32 pm
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

Re: Open document via REST API

Posted: Tue Jul 13, 2021 10:04 am
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

Re: Open document via REST API

Posted: Tue Jul 13, 2021 5:11 pm
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