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)
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;
}
Awesome Tim,
and thanks for sharing the code to the community. It is much appreciated!
Happy Easter and stay safe!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
please refer to this article on the alternative REST endpoints to use instead.
Thanks and regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ken,
Hope that helps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.