Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

REST API - Disabled and enabled Tasks in all stages

Eshwar Prasad Yaddanapudi June 7, 2020

Hi team.

I am looking for an endpoint which can help me find the disabled and enabled tasks in all the stages for a plan. Looking forward to your help. Thanks in advance.

3 answers

1 accepted

0 votes
Answer accepted
Eshwar Prasad Yaddanapudi June 9, 2020

to help other members who might eventually find their way here - as per above comment from @Richard White _TechTime_  there is no way to get task information using REST API

0 votes
Eshwar Prasad Yaddanapudi June 8, 2020

@Richard White _TechTime_  thank you for taking time to answer the query. Having looked at the above solution, it is not the one that could help me. 

I will try and elaborate a bit more -

As we can see below, I have a task which is disabled

task_disabled.PNG 

 

So, if I have 2 stages and 4 jobs within them and each of the jobs has - say 5 tasks.

How do I know which of the tasks in which these jobs are disabled? using the REST API?

Richard White _TechTime_
Atlassian Partner
June 8, 2020

Ah I see, I my response will only give the status for each job, not each task.

To the best of my knowledge there is no rest api which will give you task information.

0 votes
Richard White _TechTime_
Atlassian Partner
June 7, 2020

Hi,

 

You can use the plan endpoint to get this information:

/rest/api/latest/plan/<plan-key>?expand=stages.stage.plans

If you set header

Accept:"application/json` 

you will get something in the following format:

{
  "expand":"actions,stages,branches,variableContext",
  ...,
  "project":{
    <project info like key description etc.>,
    "enabled":true,
    "stages":{
      "size":4,
      ...,
      "stage":[
        {
          ...
          "plans":{
            "plan":[
              {
                "key":"TEST",
                "type":"JOB"
                ...<Other plan info>,
                "enabled":true,
              },
              ... <Other jobs>
            ]
          }
        }
      ]
    }
  }
}

Which hopefully is the info you are looking for?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events