Unable to get previous timesheets, only current timesheet can be retrieved

This thread is now closed to new comments.
Some of the links and information provided in this thread may no longer be available or relevant.
If you have a question please start a new post.
EdCadorniga
4 Posts
User

4Posts

0Kudos

0Solutions

Solved: Go to Solution

Unable to get previous timesheets, only current timesheet can be retrieved

Hi, 

 

I am trying to query for past timesheets using Postman and am able to only get the current week's timesheet data (while no filter is used). 

 

This query does not work: (see screenshot below)

{{company_file_uri}}/{{company_file_id}}/Payroll/Timesheet/?$filter=StartDate eq datetime'2020-10-19' and EndDate eq datetime'2020-10-25'

 

I've also tried filtering with only the StartDate or EndDate - no success.

 

While this query works: 

{{company_file_uri}}/{{company_file_id}}/Payroll/Timesheet/ but only shows the current period's timesheets.

 

LastPayPeriodsTimesheet.png

 

This seems to be the same issue as what was here: https://community.myob.com/t5/MYOB-API-questions-and-answers/Timesheets-Request-Only-Returns-Timeshe...

 

I've already tried the solution there with no success.

 

Also, if there is some prepared query that you can share that will provide a report similar to the one we can generate through REPORTS > Timesheets, that would be awesome. 

 

Any assistance would be appreciated. 

 

Regards,

Ed

6 REPLIES 6
Mike_James
Ultimate Partner
5,861 Posts
Ultimate Partner
New Zealand
Ultimate Partner

5,861Posts

1,026Kudos

756Solutions

Re: Unable to get previous timesheets, only current timesheet can be retrieved

Hi @EdCadorniga , for a range of timesheets, I wonder if this would work:

$filter=StartDate ge datetime'2020-10-19' and EndDate le datetime'2020-10-25'

or possibly this:

$filter=StartDate ge datetime'2020-10-19 00:00:00' and EndDate le datetime'2020-10-25 23:59:59'

 

I don't have access to any timesheet data atm, so I can't test it.


Regards, Mike (mike@datawise.co.nz)
DataWise Limited (www.datawise.co.nz), developers of:
DataWise ProActive - Custom Reporting from MYOB programs
(MYOB Business, including AccountRight Live, AccountRight v19.x and exo Payroll)

Bulk download of attachments (more details...)

EdCadorniga
4 Posts
User

4Posts

0Kudos

0Solutions

Re: Unable to get previous timesheets, only current timesheet can be retrieved

Hi, @Mike_James.

 

Thanks for responding. I tested both filters and both were unsuccessful, unfortunately.  I have attached the responses I have received. 

 

Regards,

Ed

 

 

 

1st filter.jpg
2nd filter.jpg
EdCadorniga
4 Posts
User

4Posts

0Kudos

0Solutions

Re: Unable to get previous timesheets, only current timesheet can be retrieved

The issue still remains. Please help. 

 

Thanks.

Tana
MYOB Moderator
43 Posts
MYOB Moderator
MYOB Moderator

43Posts

92Kudos

3Solutions

Accepted Solution Solved

Re: Unable to get previous timesheets, only current timesheet can be retrieved

Hi there.

Thank you for reaching out and apologise for the delayed response.

The /{cf_uri}/Payroll/Timesheet endpoint contains a query/filter by default in the URI response of your standard request.

This query is compulsory and is what enables this area to display the timesheets in the current period without needing to have your own query to do so.

What I recommend is copy this URI from your response and use it as a template to create the query.
You will notice that this query isn't quite formatted like our typical Odata filters.

Here is what it will look like:

https://ar1.api.myob.com/accountright/36c69572-d2a7-4539-86df-5d47256d098c/Payroll/Timesheet/d6a5a299-0c4e-40f1-9a98-df1575cdf9d1?StartDate=2020-10-21T00:00:00&EndDate=2020-10-27T00:00:00"
Edit the details/date and run your GET request using this and you will be able to display the timesheets within the date range.

If you have any difficulty with this let me know.
Kind regards

Thanks,
@Tana


MYOB API Specialist


MYOB API Support Centre|MYOB App Marketplace|MYOB AccountRight API Endpoint Doc's



Did my answer help?


Mark it as a Solution

EdCadorniga
4 Posts
User

4Posts

0Kudos

0Solutions

Re: Unable to get previous timesheets, only current timesheet can be retrieved

Thanks for your response, Tana.

 

I tried the query (after editing the dates) but still can't get data. One thing I noticed is that I don't have a variable for the Timesheet GUID.  How do I get that data? 

 

Ran the queries: 

I tried it as is after I modified the dates - nogo. 

I also tried changing the CF_Uri with our own - nogo.

 

***Tried without the {Timesheet GUID} and that worked.

 

{{company_file_uri}}/{{company_file_id}}/Payroll/Timesheet/?StartDate=2020-10-19T00:00:00&EndDate=2020-10-25T00:00:00

 

Does this mean I can no longer apply any filter to this query? 

 

Not sure if that should be a new question but I'll mark your response as the solution. 

 

Thank you for your help. 

 

Regards,

Ed

 

with correct CFUri in query.jpg
Tana
MYOB Moderator
43 Posts
MYOB Moderator
MYOB Moderator

43Posts

92Kudos

3Solutions

Re: Unable to get previous timesheets, only current timesheet can be retrieved

Thank you for the update there.

The URI I posted came directly from the response headers when running a GET request to /{cf_uri}/Payroll/Timesheet/{timesheet URI} (We used insomnia for this test).

This URI automatically had the query at the end, so for us was just a matter of changing the dates and copy/pasting this URI as a standard GET request, this appears to be the only way run this query.

The image you have pasted I would assume wouldn't work, trying to use the params wont work like that i'm afraid and can only be entered as a request.

If you would like us to investgate this further create a support ticket here and we can run some tests using some of your details and try replicate our success.

Kind regards
 


Thanks,
@Tana


MYOB API Specialist


MYOB API Support Centre|MYOB App Marketplace|MYOB AccountRight API Endpoint Doc's



Did my answer help?


Mark it as a Solution

Didn't find your answer here?

Try using advanced search to find a post more easily Advanced Search
or
Get the conversation started and make a new post Start a Post