Comment on page
How to get the your data
To get the correct data from the API, an easy method is making a report that contains the data presented as needed. Using the developer tool that is included in Google Chrome (and other browsers), one are able to extract the correct API request.
A method to get what fields and values needed to get your specific data is using Google Chrome and reading the URL used to get data within the application. This can be done using the Developer tools that are part of Google Chrome.
In Google Chrome, open the menu in the top left, go to "More tools" and here select "Developer tools"

Log in to Moment as usual and open the report containing the required data .
Edit the report to contain fields and values according to filters, e.g. tags etc.

Return the developers tools window, select to filter by XHR only (See screenshot below)
In the left panel, the URLs that where used to display the report is shown. Click on the first one, verify in the right panel that the Request URL is getting data from the API.
To get a copy of the URL, right-click the URL in the left panel. Select "Copy", then "Copy link address"



The example above resulted in the URL shown below.
https://demo.moment.team/api/1.0/companies/demo/projects/projectRegisteredHoursReport?fromDate=2021-05-01&toDate=2021-05-31&projectTagOperator=and&timeRecordTagOperator=and&groupUserAccountOption=roles&billableRateOption=registered&subtractAbsences=countAsBillable
demo.moment.team
Click on the link to see the resulting JSON for the request
In this case the "/companies/{company}/projects/projectRegisteredHoursReport" endpoint and the following parameters/values was used.
Parameter | Value |
fromDate | {start date} YYYY-MM-DD |
toDate | {end date} YYYY-MM-DD |
projectTagOperator | and |
timeRecordTagOperator | and |
groupUserAccountOption | roles |
billableRatioOption | registered |
subtractAbsences | countAsBillable |
Based on this example it should be possible to create the API request needed.
Last modified 2yr ago