Resource Managment API - Reports

When connecting to the report rows endpoint, I am receiving an error when using the timeframe as shown in the API documentation.

"time_frame":{  "from": "2022-01-01",

  "to":"2022-12-31"}


Error message received:

{'message': 'to is not a valid time_frame'}



The API works without error when using one of the canned strings such as:

  • this_week
  • this_month
  • this_quarter
  • this_year
  • last_week
  • last_month
  • last_quarter
  • last_year
  • next_30
  • next_60
  • next_90
  • last_30
  • last_60
  • last_90
  • last_and_next_90


I'm using Python and the request package here is the basic code:


response = requests.post('https://api.rm.smartsheet.com/api/v1/reports/rows',

                            headers={

                               

                                "Content-Type": "application/json",

                                "auth":token,

                               

                            }, params={

                                "view":'time_fees_hours',  

                                "time_frame":{

                                "from": "2022-01-01",

                                "to":"2022-12-31"}


                            })


print(response.json())


Any help is greatly appreciated.


Cheers!

Answers

  • Genevieve P.
    Genevieve P. Employee Admin

    Hi @Dataman

    Can you test removing "time_frame": from this request (but keeping the dates in)?

    In my testing, "time_frame" was only needed if I was specifying one of the canned strings you have mentioned above, but when identifying specific dates it was not needed.

    If this works for you, I'll put in a request to have the API Documentation updated as I can see that it puts "time_frame": before the From and To when identifying specific dates.

    Cheers,

    Genevieve

  • Hi @Genevieve P.

    Thanks for your response. I've removed the time_frame tag as you suggested. So the request just looks like:


    The API response has the set the default option to "time_frame": "this_week" regardless if I put this tag in or not. Additionally, the actual range in the dates section does not update to my custom range.


    Thanks,


    Dataman

  • Genevieve P.
    Genevieve P. Employee Admin

    Hi @Dataman

    I have to admit I'm not sure if what you're seeing is expected or not; please submit your findings to our RM Support team through this form, here. They'll be able to work with you directly in a private channel and identify if this is a bug and needs to be fixed, or expected and the documentation should be updated.

    Thank you!

    Genevieve