FAQ on ODATA

Created by Daniil Stasiuk, Modified on Tue, 31 May, 2022 at 8:46 AM by Qiang Zheng

There are some simple example about how to use ODATA filter in the API requests:


If you want to search on the first name from Get Users, try this: {{url}}/v1.1/sites/:siteId/users?$filter=user/first_name eq 'Salto'

If you want to search on the alias from Get users, try this: {{url}}/v1.1/sites/:siteId/users?$filter=alias eq 'Salto'


If you want to search on the email of the user from GET users, try this: {{url}}/v1.1/sites/:siteId/users?$filter=user/email eq 'example@gmail.com'


To check if any user's first name is included in a access group:


{{url}}/v1.1/sites/{site_id}/access_groups/{access_group_id}/users?$filter=first_name eq 'Test'


Examples

1. Is it possible to have a filter on entries https://clp-accept-user.my-clay.com/swagger/ui/index#!/Entries/Entries_GetEntriesV1_1

where I can filter between 2 dates for specific user_id’s? 


Yes, You can use the following parameters in the endpoint in CURL form


https://clp-accept-user.my-clay.com/v1.1/sites/********/entries?$inlinecount=allpages&$filter=local_date_time%20ge%20DateTime%272020-01-01T05:00:00.000Z%27%20and%20local_date_time%20le%20DateTime%272020-01-04T04:59:59.999Z%27&$orderby=local_date_time%20desc


his URL is encoded, so you'll have to clean it up a bit. This query looks between 1st of Jan and 4th of Jan. You can even use the type of event you want to get , just add that metric to $filter.


2. Can you help me with the filter by multiple user_id’s? 


Yes, https://clp-accept-user.my-clay.com/v1.1/sites/*SITEID*/entries?$filter=user_id eq guid'*USERID*'



Core API examples:

1. While retrieving the list of IQs, we wanted to be able to filter by the collection id

{{url}}/v1.2/iqs?$filter=collection_id eq 'yourUUIDHere'


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article