is it correct passing time frame as an object to resource management reports API?
Hello,
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'}
I also tried to pass the 'from' and 'to' as a separate parameter without passing the 'time_frame' tag, I am also receiving an error.
any idea on how to pass the a date range to the time_frame parameter ?
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
Below is the screenshot when passing a string to the time frame - it works fine.
Below screenshot after passing the time frame as a date range object
Best Answer
-
Hi @Genevieve P. ,
I managed to do it, I am using Python and Jupyter notebook.
This is how I made the request:
the problem was that I was making the request like this :
The point is when we have a parameter that is passed as an object (time_frame) then within the request we need pass the pramas like this (json = params) not (params = params).
Please note that rq is an alias for the request (import request as rq)
Answers
-
Have you been able to resolve this? I am only currently able to test in Postman, and in my instance I'm able to get the Report with the time frame structured as follows:
However I know in a previous Community post you mentioned in your program you need to write the Group By array in additional quotes for it to pass through. I am wondering if there's a similar format adjustment needed for the time frame parameters... for example, single quotation marks instead of double.
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
-
Hi @Genevieve P. ,
I managed to do it, I am using Python and Jupyter notebook.
This is how I made the request:
the problem was that I was making the request like this :
The point is when we have a parameter that is passed as an object (time_frame) then within the request we need pass the pramas like this (json = params) not (params = params).
Please note that rq is an alias for the request (import request as rq)
-
Hey @Tamer Moustafa
Thank you for coming back to explain how you achieved this! This is very helpful information to know for anyone else using both Python and Jupyter.
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.8K Get Help
- 439 Global Discussions
- 138 Industry Talk
- 470 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 67 Community Job Board
- 486 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives