Skip to main content
Participant
March 3, 2021
Answered

Scheduling a task with REST API in Publishing Server

  • March 3, 2021
  • 1 reply
  • 869 views

Dear community,

I developped last year a REST API to create/update/trigger Framemaker Publishing Server 2019 tasks from an automation server. Apparently the interface has changed with the 2020 version, and I'm struggling to get it running following the Adobe user guide.

 

A working example in groovy language of a POST request to create a task is as follows:

 

httpRequest (
        contentType: 'APPLICATION_JSON', 
        httpMode: 'POST', 
        ignoreSslErrors: true, 
        requestBody: json_body,
        responseHandle: 'NONE', 
        url: "http://my_node:7000/v16/tasks", 
        wrapAsMultipart: false
    ) 

Replacing json_body and my_node by my specific task configuration and host where I run the server. I don't use authentication and that code is enough to successfully create a task.

Where I struggle at the moment is to run a task. The example in the user guide suggests using the task ID (earlier version 2019 required the task name):

http://<FMPS_server>:<port>/v16/queue/scheduleTask/:id

Therefore I'm scheduling the task as follows:

httpRequest (
   contentType: 'APPLICATION_JSON', 
   httpMode: 'POST', 
   ignoreSslErrors: true, 
   //requestBody: body.toString(), -> NO BODY
   responseHandle: 'NONE', 
   url: "http://my_node:7000/v16/queue/scheduleTask/:my_task_id", 
   wrapAsMultipart: false
) 

I'm fetching the id with a GET command that retrieves all tasks details, resulting in the following url (random id as example):

"http://my_node:7000/v16/queue/scheduleTask/:603e488ebe24e438bcf7dd0b"

I might be doing a silly mistake somewhere.

 

Many thanks in advance

 

This topic has been closed for replies.
Correct answer pulkitn

Hi @Marc5C0A 

There was a small typo with the URL, Please remove ": " before giving taskid .

For eg : 

http://my_node:7000/v16/queue/scheduleTask/603e488ebe24e438bcf7dd0b

 

POST /v16/queue/scheduleTask/{{YourTaskid}}

Further, You can also save your taskid while fetching json response of Create Task  API.

I hope it solves your issue.

Thanks
Pulkit Nagpal

1 reply

pulkitn
Adobe Employee
pulkitnCorrect answer
Adobe Employee
March 3, 2021

Hi @Marc5C0A 

There was a small typo with the URL, Please remove ": " before giving taskid .

For eg : 

http://my_node:7000/v16/queue/scheduleTask/603e488ebe24e438bcf7dd0b

 

POST /v16/queue/scheduleTask/{{YourTaskid}}

Further, You can also save your taskid while fetching json response of Create Task  API.

I hope it solves your issue.

Thanks
Pulkit Nagpal

Marc5C0AAuthor
Participant
March 3, 2021

Hi Pulkit,

Issue solved, thanks.

Now moving to the next step, when running the task, I have a Pre-publish script uploaded which takes as an input an XML file in DITA format and converts it to .FM after applying the right structure from a template. This input file is located in the same directory of the script. However, as I can see in the 2020 version, the Pre-publish script is copied to the windows temp folder and executed from there:

Running pre-publishing extendscript: C:\Users\my_user\AppData\Local\Temp\test\4184\my_pre_publish_script.jsx

Giving me the according error that it can't find the input XML file anymore as it's not present in the Temp folder.

Is this an expected behavior? It used to work to specify a relative path on included files in the pre-publish script:

#target framemaker
#targetengine main
#include "My_relative_path/helper_script.jsx"

// path to input XML file in the same directory
var path_repo = (new File($.fileName)).parent.fsName + "\\";
var input_file = "my_input_file.xml";

// my code

Why is the script executed from the Temp folder and not from the folder I'm uploading it? This had worked before in the 2019 version.

 

Thanks,

Marc

 

pulkitn
Adobe Employee
Adobe Employee
March 3, 2021

Hi Marc,

I need clarification on your workflow, It would be better if you can email me your query on punagpal@adobe.com , It would be a better medium of communication for your workflow.

Thanks
Pulkit Nagpal