Push a DITA archive to a webserver

Post here questions and problems related to editing and publishing DITA content.
gbv34
Posts: 38
Joined: Thu Jan 20, 2022 12:36 pm

Push a DITA archive to a webserver

Post by gbv34 »

Hello,
I discovered that Radu developed a plugin to zip a ditamap and all its contents/dependencies. That is pretty helpful and works perfectly. Nonetheless, knowing that I need to send DITA projects zipped to a server to be published in a Content Delivery Portal, I usually use a curl command and rely on the API of the CDP.

For instance, here's a frequent command:

Code: Select all

curl –X POST -H "Authorization: Basic XXXXXXXXXXXXXXX" --form file="@C:\fantastic-DITA-project.zip" https://my.CDP.net/xxx/api/sources/dita/upload?
Thus, I am curious to know how I could set a curl command or an equivalent using a web service, should I use an ant's exec task or is there another way to proceed?
What would be your suggestions :)
Radu
Posts: 8010
Joined: Fri Jul 09, 2004 5:18 pm

Re: Push a DITA archive to a webserver

Post by Radu »

Hi,

Maybe you can create your own "publish.bat" script which first calls the DITA Open Toolkit's "dita -i ....." command line to create the zip in an output folder, then from the same "publish.bat" you can call any other command line tool that you want to handle the zip further.
Or indeed Ant build files can run an arbitrary command line:
https://ant.apache.org/manual/Tasks/exec.html
so you could for example modify the Ant build file of my DITA to Zip plugin to also run an <exec> task after the zip is created in the output folder.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
gbv34
Posts: 38
Joined: Thu Jan 20, 2022 12:36 pm

Re: Push a DITA archive to a webserver

Post by gbv34 »

Hello, Radu!
Good news, I have a plugin that correctly zip the map, topics and resources. I included a target that pushes the archive to an external portal via a web service call.
However, when I test it, I have to select the new DITA-OT transformation in my scenarios, and I would like to automate this task. Do you know if there's any way to force or isolate a specific scenario when publishing with a DITA-OT hosted on a server?
Radu
Posts: 8010
Joined: Fri Jul 09, 2004 5:18 pm

Re: Push a DITA archive to a webserver

Post by Radu »

Hi Gaspar,

For automation why don't you run the DITA OT process directly from the command line?
https://www.dita-ot.org/dev/topics/buil ... mmand.html

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
xephon
Posts: 114
Joined: Mon Nov 24, 2014 1:49 pm
Location: Greven/Germany

Re: Push a DITA archive to a webserver

Post by xephon »

I've done something similar with Ant sshexec and Ant scp in a post publishing step.
stefanjung.netlify.com – Your DITA/DITA-OT XML consultant
gbv34
Posts: 38
Joined: Thu Jan 20, 2022 12:36 pm

Re: Push a DITA archive to a webserver

Post by gbv34 »

Hello Radu and Xephon!
Using the command line would be much easier in my case, but I must upload the DITA-OT to an external server for a client who uses a SaaS CCMS. Therefore, I can't ensure the transformation will be correctly selected that's why I wanted to force a specific transformation scenario in the DITA-OT itself.
However, I'm not sure it is feasible, so I will ask the CCMS vendor to orient me on the correct solution :)
Radu
Posts: 8010
Joined: Fri Jul 09, 2004 5:18 pm

Re: Push a DITA archive to a webserver

Post by Radu »

Hi Gaspar,
that's why I wanted to force a specific transformation scenario in the DITA-OT itself.
The DITA OT does not have the concept of "transformation scenario". Oxygen has this concept. An Oxygen transformation scenario calls the DITA OT with certain parameters/flags.
The DITA OT has the concept of output format which is passed using the "-f" or "-format" flag in the command line:
https://www.dita-ot.org/dev/topics/outp ... aid-title1
https://www.dita-ot.org/dev/topics/buil ... mmand.html

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
gbv34
Posts: 38
Joined: Thu Jan 20, 2022 12:36 pm

Re: Push a DITA archive to a webserver

Post by gbv34 »

Ok, I understand, that makes sense. thank you, Radu :)
Post Reply