Help with filter syntax on assets endpoint

I’m attempting to retrieve all assets updated after a specific date. My interpretation of the documentation resulted in the following URL:

https://mydomain.freshservice.com/api/v2/assets?filter=“updated_at:>‘2023-01-01T00:00:00Z’”&per_page=100&page=1

But, I get a 400 Bad Request error.

What am I doing wrong?

Hi @DougAtBHB ,

Greetings!

The issue is that by default, the filter API will return only 30 data per page, and the endpoint won’t expect the per_page filter.

That’s the reason you received the 400 Bad Request Error. I have shared the corrected version of your endpoint below in a curl command. Kindly make use of it.

curl -v -u api_key:X -X GET 'https://domain.freshservice.com/api/v2/assets?filter="updated_at:>%272023-01-01%27"&page=1'

Hope this helps.

Thank you.

Thanks so much for taking the time to provide a response to my question!

I’ve correct my endpoint per your recommendation, but I still got the 400 error. It appears that this is because I am including time in my UTC date. Once I removed the time, it worked!

Thanks again!

Hi @DougAtBHB ,

Greetings!

Yeah, that’s the reason I have shared the curl URL with the correct format.

Hope this resolves your query. If yes, kindly mark it as a solution.

This would help others who faced the same issue.

Thank you.

Additional information for anyone who comes across this post. The assets API endpoint returns a response header link for the next page, but it doesn’t work. It does not support the rel=“next” phrase. If you remove it, the link works. It’s redundant, though, since the next page number is contained in the link.

1 Like

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.