Page 1 of 1
Push a DITA archive to a webserver
Posted: Sun May 15, 2022 5:34 pm
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

Re: Push a DITA archive to a webserver
Posted: Mon May 16, 2022 7:05 am
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
Re: Push a DITA archive to a webserver
Posted: Tue May 17, 2022 5:45 pm
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?
Re: Push a DITA archive to a webserver
Posted: Wed May 18, 2022 6:19 am
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
Re: Push a DITA archive to a webserver
Posted: Wed May 18, 2022 7:28 am
by xephon
I've done something similar with Ant sshexec and Ant scp in a post publishing step.
Re: Push a DITA archive to a webserver
Posted: Wed May 18, 2022 10:50 am
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

Re: Push a DITA archive to a webserver
Posted: Wed May 18, 2022 10:56 am
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
Re: Push a DITA archive to a webserver
Posted: Wed May 18, 2022 11:44 am
by gbv34
Ok, I understand, that makes sense. thank you, Radu
