Best Answer

I want to fetch users which have additional field value date to be not empty and in past

  • 5 October 2022
  • 2 replies
  • 211 views

Hi, I have use case where i have to set users to Active and Inactive based on the start date and date left that are additional fields in docebo. I want to fetch the users which have start date(which will never be null) as past dated and are Inactive to Move them to active. The first endpoint is to get the users with start date in past and users being Inactive.

Also, I want to fetch specific set of users which are Active but have leaving date additional field as not null and in past to move them to Inactive.  Both Start Date and Date Left additional fields are Date Type

 

I am not getting the filters which will be apt here to pass in Query Parameters in Rest APIs. if anyone can help me here that will be great. Thank you so much.

 

icon

Best answer by Bfarkas 10 October 2022, 00:48

View original

2 replies

@Bfarkas can you please help here. I checked filters queryParam in api-browser. they have sample like: “serialize object containing list of filters and their options. List of filters - ( code:{like, contains, not_equal, ends_with, starts_with, is_empty, not_empty, not_start_with, not_end_with, not_contains}, sold_to:{like, contains, not_equal, ends_with, starts_with, is_empty, not_empty, not_start_with, not_end_with, not_contains}, bundle_name:{like, contains, not_equal, ends_with, starts_with, is_empty, not_empty, not_start_with, not_end_with, not_contains}, plan_name:{like, contains, not_equal, ends_with, starts_with, is_empty, not_empty, not_start_with, not_end_with, not_contains} ).”

I need to return additional filed date_left which has key as field_18 and date value as “2022-10-09”. I want to add filter to return all records that are less than “2022-10-09”

Userlevel 7
Badge +4

Hmm, so I think you might be out of luck here this way. First, there is not a less than value for the filter serialization. Second, I’ve never had that work on additional fields. Additional field search is typically just the search_additional_field_id and the search_additional_field_id. So something like the below for you:

/manage/v1/user?active=false&search_additional_field_id=18&search_additional_field_value=2022-10-09

but that will only return the users with the exact value so you would need to basically run it over and over for all possible dates. 

Is this a daily type of process? You might be better off setting up a scheduled report that is triggered each day and build a process that can convert the CSV into a JSON and then use the API to re-activate those appropriate. I find this approach useful for a lot of things like this, saves API calls too to help mitigate the 1k calls/hour/IP limit.

Reply