GetWorklog API call not working today April Fools Joke

Ken Nash April 1, 2020

We have the following code that has been working.   Today it has stopped.

 

Getting a 404 Not Found Error

 

Any help would be appreciated.   

 

 domainAddress = "https://app.tempo.io/api/1/getWorklog"
   
    apiOptions = "&baseUrl=https://company-agile.atlassian.net&format=xml&diffOnly=false&addBillingInfo=true&addIssueDetails=true&addUserDetails=true&addWorklogDetails=true&addIssueDescription=true&addIssueSummary=true&tempoApiToken=supersecretAPI"

 

timeSheetURL = domainAddress & "?dateFrom=" & Format(startDate, "yyyy-mm-dd") & "&dateTo=" & Format(midDate, "yyyy-mm-dd") & apiOptions
        Application.StatusBar = "Downloading Timesheet Data " & Format(startDate, "yyyy-mm-dd") & " To " & Format(midDate, "yyyy-mm-dd") & "..."
        DoEvents
        xmlDoc.Load (timeSheetURL)
   

3 answers

1 accepted

0 votes
Answer accepted
Tim Owen April 2, 2020

This is how I ended up doing it. Looping through all the tempo entries saving the data I need from each row in an array, then doing a jira api search with all the tasks to get the account information which I store in a map. Converting the rest of the code after that was trivial.

 

$worklogs = array(); // All data from tempo worklog api
$accountDetails = array(); // Key = task, value = account information
$url = "https://api.tempo.io/core/3/worklogs?from=" . $start . "&to=" . $end . "&limit=1000";
while (true){
$response = Unirest\Request::get($url,$headers);
if($response->code > 204){
print "ERROR: ";
print $url;
return;
}
$result=$response->body->results;
$tasklist = "";
foreach ($result as $row){
$task = $row->issue->key;
if(!isset($accountDetails[$task])) {
$accountDetails[$task] = "pending";
$tasklist .= "$task,";
}
$worklogs = saveRequiredFields($worklogs, $row);
}
// Now get account info from Jira
$tasklist = rtrim($tasklist, ','); // Remove final ','

$jurl = "https://teknique.jira.com/rest/api/3/search";
Unirest\Request::auth($login, $apikey);

$startAt = 0;
while (true){
$custombody = str_replace("XXXXX", "$tasklist", $jbody);
$custombody = str_replace("STARTAT", "$startAt", $custombody);
$jresponse = Unirest\Request::post($jurl, $jheaders, str_replace("XXXXX", "$tasklist", $custombody));
$jresult = $jresponse->body;
if(sizeof($jresult->issues) == 0) break;
foreach ($jresult->issues as $row){
$fields = array();

// Save the account info I need in a map
$fields["project_name"] = $row->fields->project->name;
$fields["id"] = $row->fields->customfield_11810->id;
$fields["account_id"] = $row->fields->customfield_11810->id;
$fields["name"] = $row->fields->customfield_11810->properties->name;
$fields["project_key"] = $row->fields->project->key;
$fields["categoryname"] = $row->fields->customfield_11810->properties->category->name;
$fields["category"] = $row->fields->customfield_11810->properties->category->name;
$fields["category_code"] = $row->fields->customfield_11810->properties->category->key;
$accountDetails[$row->key] = $fields;
}
$startAt+=100;

}

if(!isset($result->next)) break;
$url = $result->next;
}

 

 

 

function saveRequiredFields($worklogs, $result){
  $row = array();
$row["key"] = trim((string) $result->issue->key);
$row["displayName"] = trim((string) $result->author->displayName);
$row["full_name"] = trim((string) $result->author->displayName);
$row["accountId"] = $result->author->accountId;
$row["userAccountId"] = $result->author->accountId;
$row["startDate"] = $result->startDate;
$row["work_date"] = $result->startDate;
$row["hours"] = (float) ($result->timeSpentSeconds / 3600);

 

array_push($worklogs, $row);
return $worklogs;
}

Alexander Eck [Tempo]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 3, 2020

Awesome Tim,

and thanks for sharing the code to the community. It is much appreciated!

Happy Easter and stay safe!

1 vote
Hlynur Johnsen April 1, 2020

Hi Ken,

Today we decommissioned the Servlet API in order to align with Atlassian's security requirements for Cloud applications.  This change was originally announced early 2019, and we have done our best to communicate this to our customers with several announcements since then, as well as reaching out directly via email to our contacts.

I'm very sorry if this has caught you by surprise. Here is our lates announcement which includes links to documentation and knowledge base articles about how to transition to using the more secure REST API.

https://tempo-io.atlassian.net/wiki/spaces/CLOUDNEWS/pages/763691139/2020-04-01+Tempo+has+Decommissioned+the+Servlet+API

I recommend watching the Tempo Cloud announcement page to get notification when we make important changes to our cloud products. 

https://tempo-io.atlassian.net/wiki/spaces/CLOUDNEWS/pages/242942398/Tempo%2BCloud%2BAnnouncements

Kind regards,

Hlynur Johnsen

Group Product Manager - Tempo for Jira 

Tim Owen April 1, 2020

I was also taken by surprise by this yesterday. And now to my dismay, it looks like the REST API can not provide the information that is essential to my reporting.

 

I HAVE to get the billing category and account code per worklog but it does not look like that is possible. This is a biiiig problem for me!

 

Please tell me there is a workaround

 

Tim

Ken Nash April 2, 2020

We are in the same boat.   Billing information associated to the Tempo time.  Not sure how to get it.

0 votes
Alexander Eck [Tempo]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 2, 2020

Hello,

please refer to this article on the alternative REST endpoints to use instead.

Thanks and regards

Ken Nash April 2, 2020

Thanks.

 

I have read that article and still don't have a clear idea on how to get the billing and user data.

Alexander Eck [Tempo]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 2, 2020

Hi Ken,

  1. The user properties are available from the Jira API .
  2. The account information is NOT returned from the worklog REST API. But there is an endpoint to get all worklogs tight to an account (https://api.tempo.io/core/3/worklogs/account/{accountKey})

Hope that helps

Tim Owen April 2, 2020

Please confirm my understanding:

 

I have to retrieve the worklogs I want and then query the Jira API with each task from that list to get the account information?

 

Is that correct?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events