08-07-2015 04:22 AM - edited 03-01-2019 09:16 AM
Hi,
I want to get job status using Tidal REST API, so we are using JobRun.get API as below:
https://servername/api/sname/JobRun.get/111111111
where 111111111 is job number. Using this we are getting required information.
But problem is job number is dynamic and we are manually getting it from Tidal Web UI.
Question is how to get job status using Job name instead of Job number? Or is there any way to get dynamic job number using job name?
regards
Santosh.
08-12-2015 11:59 AM
This discussion has been reposted from Additional Communities to the Tidal Enterprise Scheduler community.
09-08-2015 06:50 AM
Here's 2 examples
one special thing to note is that you don't need to tag items in query conditions.
I'm working on a more comprehensive guide as I think I have finally figured all this out...
Marc
Assumptions
Given a jobrun in the schedule
jobmst_id = 19990
jobmst_alias='REST1'
select columns rundate, alias by jobmst_alias
<entry xmlns="http://purl.org/atom/ns#">
<tes:JobRun.get xmlns:tes="http://www.tidalsoftware.com/client/tesservlet">
<id></id>
<selectColumns>rundate, alias</selectColumns>
<queryCondition>alias='REST1'</queryCondition>
</tes:JobRun.get>
</entry>
one to grab everything by jobmst_id
<entry xmlns="http://purl.org/atom/ns#">
<tes:JobRun.get xmlns:tes="http://www.tidalsoftware.com/client/tesservlet">
<id></id>
<selectColumns></selectColumns>
<queryCondition>jobid=19990</queryCondition>
</tes:JobRun.get>
</entry>
09-10-2015 10:20 AM
Hi Marc - I am very interested in your guide if you are willing to share when you get it completed.
I currently have a requirement that our ticketing system (ServiceNow) connect to Tidal and issue a reboot set of jobs. What needs to happen is the Agent on the group job changes to the one passed by ServiceNow, but since a job action doesn't allow a variable in the agent field, I'm stumped.
Thank you!
Michelle Morris
09-10-2015 03:10 PM
Nice Challenge.... well you can't do it with 1 step... at least not without a script or workflow in servicenow... which when you get that far... let me know as I am interested in the servicenow integration down the road ... we are just starting to implement here (my new job).
In the use case you outlined you have to take a multiple step approach (could possibly be scripted with something like PowerShell, ServiceNow Workflow, etc.).
I executed this and it does work manually
Marc
Requirements
Need to know jobmst_id of target job/jobgroup in this case 20072
Must add “require operator release” setting
Must be able to query for latest jobrun_id and use in downstream REST calls
Desired Outcomes
I want to force a run on Agent XYZ nodmst_id = 117 for this particular run
I want to add different parameters for override (add a variable)
I want to execute with the changes above automatically
Caveat: you can’t change the agent on insert via GUI, this make the job/jobgroup have to have “require operator release” setting
Caveat: you have to specify all parameters as it will put in a blank parameter screen by default… this seems like a defect to me (GUIs will insert the params from the definition and allow you to override but not REST job.insert method)
Step 1 insert the job on operator release
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://purl.org/atom/ns#">
<tes:Job.insert xmlns:tes="http://www.tidalsoftware.com/client/teservlet">
<tes:id>20072</tes:id>
<tes:params>Write-Output '<JobParent>\<JobName> runs on <ALIAS_TidalSql.118> my new Params'</tes:params>
<tes:startdate>20150910</tes:startdate>
</tes:Job.insert>
</entry>
Step 2 Obtain the latest jobrun_id for target jobmst_id
Must get jobrun_id to manipulate the job using REST here’s where the process might break for you unless you can write a query to get the “max” run : SELECT MAX(jobrun_id) FROM jobrun WHERE jobmst_id = 20072
In this case the jobrunid/id = 669920
Step 3 Modify job in job activity and switch agents
In this case say I wanted to Switch Agent List (definition) to Specific Agent 117 so I have to run a jobrun.update method
<?xml version="1.0" encoding="UTF-8" ?>
<entry xmlns="http://purl.org/atom/ns#">
<tes:JobRun.update xmlns:tes="http://www.tidalsoftware.com/client/tesservlet">
<object>
<tes:id>669920</tes:id>
<tes:nodeid>117</tes:nodeid>
</object>
</tes:JobRun.update>
</entry>
Step 3 Release job
<?xml version="1.0" encoding="UTF-8" ?>
<entry xmlns="http://purl.org/atom/ns#">
<tes:JobRun.release xmlns:tes="http://www.tidalsoftware.com/client/tesservlet">
<id>669920</id>
</tes:JobRun.release>
</entry>
That's it..
09-11-2015 11:05 AM
Marc - It appears there is not an update method for the JobRun:
Method [update] does not exist for type [com.tidalsoft.scheduler.api.objects.impl.JobRun].
but...
If I wrap my job in a job group, I can edit the agent at the group level. Then, with the agent inherited in the job I can insert the group and the job runs on the correct agent!
Thank you so much for helping me get started on this. I will definitely let you know how we end up integrating this.
Here are the two steps:
Edit the agent at the group level:
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://purl.org/atom/ns#">
<id>3</id>
<tes:JobGroup.update xmlns:tes="http://www.tidalsoftware.com/client/tesservlet">
<tes:jobgroup>
<tes:id>20185</tes:id>
<tes:type>1</tes:type>
<tes:agentid>1660</tes:agentid>
</tes:jobgroup>
</tes:JobGroup.update>
</entry>
Insert job group
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://purl.org/atom/ns#">
<tes:Job.insert xmlns:tes="http://www.tidalsoftware.com/client/teservlet">
<tes:id>20185</tes:id>
<tes:startdate>20150911</tes:startdate>
</tes:Job.insert>
</entry>
04-16-2021 01:17 PM
Hi,
Is there a way to update the command parameter in job activity after the job is inserted through API?
I tried something like this below. Nothing worked.
<?xml version="1.0" encoding="UTF-8" ?>
<entry xmlns="http://purl.org/atom/ns#">
<tes:JobRun.update xmlns:tes="http://www.tidalsoftware.com/client/tesservlet">
<object>
<tes:id>3374762</tes:id>
--<tes:parameters>test johnny</tes:parameters>
--<tes:parameter>test johnny</tes:parameter>
--<tes:params>test johnny</tes:params>
--<tes:param>test johnny</tes:param>
</object>
</tes:JobRun.update>
</entry>
11-13-2019 06:53 PM
@santoshtupe1 Did u get to solve this. I am facing the same issue.
11-14-2019 05:33 AM
What Tidal product are you referring to?
If it's Cisco Process Orchestrator, I might be able to help. What issue did you run into?
11-16-2019 04:19 PM
Hi @Tuan Tran,
I am trying to use API for Tidal Enterprise Scheduler version 6.0 Web API. I was able to insert a job into schedule. But, I couldn't pull the jobrunid of the running job to pull its status. How can I pull the status of the running job.
Thank you.
Best,
Chinmayi Injam.
08-11-2021 10:23 AM
How to use Cisco Tidal REST APIs to get job status
Below are two approaches to get this data: first, using the job number and, second, using the job name. I've included a URL and XML example of each. Btw, these examples are really getting ALL the job data for you, including status. You should be able to parse out the status from what's returned.
Prep:
This is the base of the URL request: http://hostname:port/api/DSP-Name/ …
where 'DSP Name' is 'Demand Side Platform Name' (I think? It’s just how they write it in the Tidal API Reference Guide). For tidal, this is 'tes-6.X' which is your Tidal Enterprise Scheduler version (ex: tes-6.2)
Get status using Job Number (abbreviated Job No. on the Tidal application):
<?xml version="1.0" encoding="UTF-8" ?>
<entry xmlns="http://purl.org/atom/ns#">
<tes:JobRun.get xmlns:tes="http://www.tidalsoftware.com/client/tesservlet">
<id>11111111</id>
<selectColumns></selectColumns>
<queryCondition></queryCondition>
</tes:JobRun.get>
</entry>
Get status using Job Name:
<?xml version="1.0" encoding="UTF-8" ?>
<entry xmlns="http://purl.org/atom/ns#">
<tes:JobRun.get xmlns:tes="http://www.tidalsoftware.com/client/tesservlet">
<id></id>
<selectColumns></selectColumns>
<queryCondition>name='Job Name'</queryCondition>
</tes:JobRun.get>
</entry>
The unused tags in the XML (id, selectColumns, queryCondition) can be removed-- I just left them in to make clear they can all be used in the query.
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: