It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

jobProgressToken: Jira (Zephyr) Rest API

Akash Sahu May 13, 2017


I am using Jira (Zephyr) rest calls to create Test Cycle and add Tests cases into it. According to information mentioned here if I use this rest call to add tests to Cycle then as a response I will get JobProgressToken. JobProgressToken is nothing but will tell the progress of Test Case addition in Test Cycle.

The JobProgressToken looks like:

{
"jobProgressToken": "0001491864384175-f6f74daa3cce-0001"
}

Now the problem which I am facing is I am not getting any output from this JobProgressToken. I tried firing the GET rest call using the format mentioned but I am getting empty response.

Can somebody please explain how to use this JobProgressToken to get the Progress of my task? I want to verify that the tests which I added to Cycle are added susccessfully or not?

1 answer

1 vote
Arun Ravindran Jun 08, 2017

Hi Akash

Thanks for your interest in Zephyr.

In general if we get a job progressId and a response 200 it means the API call is done  and that is the success response

The practical case to use this token is in the "Get job Progress Status" API

http://docs.zfjcloud.apiary.io/#reference/jobprogress/get-job-progress-status/get-job-progress-status

You will get the response as attached in screenshot and  by reading the Json response "message" you can confirm if all the tests are added to cycle.

jobprogress.pngThanks

ZephyrSupport

Peter Li Jun 09, 2017

Hello Zephyr Support,

I am trying to create a new cycle based on another cycle with a cloneCycleId. This has worked previously and the new cycle Id is returned in JSON field "id". 

Currently, I am getting this "jobProgressToken", how do I extract the new test cycle id field?

From the documentation, it seems I might have to execute http get: ".../rest/zapi/latest/execution/jobProgress/:jobProgressToken?type=XXXXXXX" to get information, I cannot find what I need to pass for the type parameter??

 

 

Our whole automated test is based on the id being returned by cloning. Now that you changed stuff without informing us How can we move forward??

Peter Li Jun 16, 2017

Hey Francis,

We figured out a workaround with regards to this issue. We were also relying on the "id" field and this change broke our entire process.

To circumvent this issue, we simply make a webservice call to retrieve all the jobs and put them into a list and then we filter it based on name. 

This is the call: "domain/rest/zapi/latest/cycle?projectId=XXXXXXX". From the response that you get, grab the "name" field and check for the name you are looking for and then save the id accordingly (see code below for more details)

 

getReq = new HttpGet (domain + "/rest/zapi/latest/cycle?projectId=" + projectId);
response = httpClient.execute(getReq, localContext);

jsonObj = readJSON(new InputStreamReader(response.getEntity().getContent()));
jsonObj = jsonObj.getJSONArray(versionId).getJSONObject(0);
jsonObj.remove("recordsCount");
Iterator<?> j = jsonObj.keys();

while(j.hasNext()) {
 String key = (String) j.next();
 if(jsonObj.getJSONObject(key).getString("name").contains(cloneName)) {
  clonedId = key;
  logger.info("Cloned Template ID obtained from brute force look up.");
  break;
 }
}
  • clonedName is the name of the test cycle we are looking for
  • clonedId is the filtered id we get back from full list of test cycles.

Hope this helps.

 

Thanks for the help Peter!

I was just hoping zephyr could've given a straight forward solution, especially when the product is not cheap.

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Marketplace Apps & Integrations

Join our webinar: “Asset Management: The Role of Context in ITSM” with Atlassian & Riada

  Hi Atlassian Community! This is Teresa from the Jira Service Desk team. On June 19th, I’ll be hosting a webinar “Asset Management: The Role of Context in ITSM” with Atlassian Partne...

179 views 2 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you