Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3630

Tableau Server REST API - How to filter jobs by extractRefresh task ID?

$
0
0

Is there a way to filter jobs using the tableau REST API according to task ID?

I have an extract refresh task I want to run on demand using /runNow but I want to perform a check to see if a job with this task is already currently running.

I haven't found much information online addressing this case.

First I was going to extract the extractRefresh taskID I am looking for and then filter through the jobs endpoint to see if any of them are joined with this ID. It seems like there's no way to filter in this way though. See below.

public bool CheckIfExtractRefreshIsRunning(){    bool isRunning = false;    // Sign in here    try    {        string url = $"{server}/api/{version}/sites/{site}/tasks/extractRefreshes";        WebRequest req = WebRequest.Create(url);        webRequest.Headers.Add("X-Tableau-Auth", token);        WebResponse response;        response = req.GetResponse();        // Get XMLDocument response        var tasks = xmlDoc.SelectNodes("//task", nsManager);        foreach (XmlNode itemXml in tasks)        {            string taskID;            // Get task ID from tasks            if (sched == schedName)            {                //Filter through jobs here                url = $"{server}/api/{version}/sites/{site}/jobs?filter=args:has:{taskID}";            }        }    }    catch (Exception e)    {        throw e;    }    return isRunning;}

Viewing all articles
Browse latest Browse all 3630

Trending Articles