How to Trigger Daily Report Generation

  • 14Views
  • Last Post 2 weeks ago
  • Topic Is Solved
0
votes
Alvaro Salgado posted this 4 weeks ago

Hello Support,

Is there a way to trigger a Detailed Report generation for my whole team on a daily basis, say for example at 11:59 PM

Alternatively, do you have an API call that could be used for this same purpose?

 

Or any other way of doinf this?

 

Thank you.

 

Alvaro Salgado

Order By: Standard | Newest | Votes
0
votes
Aleksandr Serdyuk posted this 3 weeks ago

Hello Alvaro,

We have an API. Open https://app.tmetric.com/#/profile and click Get new API token link. There you'll find links to the API reference and authorization docs.

 

0
votes
Alvaro Salgado posted this 3 weeks ago

Hi Aleksandr,

Thank you for the quick response.

Using Swagger I was able to get the URL to generate my report, see below:

https://app.tmetric.com/api/reports/detailed/csv?reportParams.projectList=58785&reportParams.projectList=58786&reportParams.projectList=58787&reportParams.projectList=58788&reportParams.activeProjectsOnly=true&reportParams.accountId=25719&reportParams.startDate=2019-02-01&reportParams.endDate=2019-03-01

 

I am now trying to generate the report from inside Excel using VBA code but I am having trouble to get authenticated with the Bearer code.  Would you have an example on how to do this?

Here is my VBA code:

 

    Set HTTPReq = CreateObject("WinHttp.WinHttpRequest.5.1")

    HTTPReq.Option(4) = 13056

    HTTPReq.Open "GET", TargetURL, False

    HTTPReq.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"

    'HTTPReq.setRequestHeader "Content-Type", "application/json"

    HTTPReq.setRequestHeader "Authorization", "Basic 9a96369e0ebbff182f2b9248587267a2"

    HTTPReq.Send

    

    SourceStr = HTTPReq.responseText

    SLA.Cells(2, 1).Value = SourceStr

    MsgBox (SourceStr)

The response I get is as follows: {"message":"Authorization has been denied for this request."}

 

I thank you in advance.

 

Regards

 

Alvaro

 

 

0
votes
Alvaro Salgado posted this 3 weeks ago

Hi Aleksandr,

 

Never mind my last question, got it to work.

It's "Tres Cool", thank you for your help.

 

Alvaro

0
votes
Alvaro Salgado posted this 3 weeks ago

Hi Aleksandr,

 

Once I send the GET to Tmetric I am getting a correct response with the actual data of what will be contained in the CSV file.

Like this:

Day,User,Project,Project Code,Client,Time Entry,Tags,Time,Issue Id,Link
2019-02-04,Boyan Jin,DIGICEL FIJI,,DIGICEL FIJI,#11651 KYC Registration Web/SMS Failing,SP,1:51:00,,
...

My question is, how do I trigger the Downloading of the CSV file.

In Swagger there is  a link that can be clicked to download the file like this:

Response Body

https://app.tmetric.com/ea11d805-3964-48be-ad88-efd66fa6ab4a" download="detailed_report_20190201_20190228.csv">Download detailedreport20190201_20190228.csv

Thanks again

 

Alvaro

0
votes
Aleksandr Serdyuk posted this 2 weeks ago

I would't advise you to use CSV for automation. Each time you'll get a file with a different name. Using JSON response is more straightforward.

Close