Google Directory API Search users by custom field not set - google-apps

According to the Google Directory API you can create custom fields for users and then search users by those fields.
https://developers.google.com/admin-sdk/directory/v1/guides/search-users
You can search for users matching certain attributes with the
users.list method of the Directory API. This method accepts the query
parameter which is a search query combining one or more search
clauses. Each search clause is made up of three parts:
Field
User attribute that is searched. For example, givenName. Custom
fields can be searched by schemaName.fieldName.
Operator
Test that is
performed on the data to provide a match. For example, the : operator
tests if a text attribute contains a value.
Value
The content of the
attribute that is tested. For example, Jane.
Searching for a boolean value appears to only show users that have been explicitly set true or false. Is it possible to search for users that do not have a set value or search for all values not true or not false?
It appears to have changed. When I search on Google APIs Explorer using
GET https:// www.googleapis.com/admin/directory/v1/users?customer=my_customer&projection=full&key={YOUR_API_KEY}
It returns about 70 results but using
GET https:// www.googleapis.com/admin/directory/v1/users?customer=my_customer&projection=full&query=userData.enabled%3Dfalse&key={YOUR_API_KEY}
returns 1 result and
GET https:// www.googleapis.com/admin/directory/v1/users?customer=my_customer&projection=full&query=userData.enabled%3Dtrue&key={YOUR_API_KEY}
returns no results.
I have about a dozen set to true and the rest set to false. There are only a few that I have not explicitly set to true or false.

It appears that you cannot search for values that aren't set explicitly. The only option is to pull the set values and find the difference between the ones that are set and the ones that aren't. For example using php array_udiff or by iterating through all the users and comparing the values.

Related

How does giving query parameter "FilterId" filter the Get Sheet API response of Smartsheet API? I see no difference

I am trying to give a particular filterId with a valid value of a manually created filter on a sheet, but the response however remains the same with and without this filter.
On the UI of the sheet, filtration works exactly fine but I do not see the API response getting filtered out. Am I missing out on something? Do I need to look out for something else? Is my understanding wrong here?
[Postman response][1]
I am expecting the same cells (rows and columns) to appear in API response as well as per the filter applied using filterId.
Specifying the filterId parameter in a GET Sheet request will not change the number of rows that the response includes. A GET Sheet response will always include all rows that the sheet contains, regardless of whether the filterId parameter is specified.
So, what does specifying the filterId parameter in a GET Sheet request do? It makes it so that each row in the GET Sheet response contains an attribute named filteredOut with a boolean value (true or false) to indicate the visibility of that row with the specified filter enabled.
"filteredOut": true indicates that the row is not visible with the specified filter applied
"filteredOut": false indicates that the row is visible with the specified filter applied
If you only want to process the rows that are visible when the specified filter is applied, your code will need to read the value of the filteredOut attribute for each row in the GET Sheet response and only process rows where that attribute value is false.
Finally, please note that for specifying the filterId to result in the behavior I've described above, the (user) account issuing the API request must have access to the filter. If another (user) account created the filter in Smartsheet and didn't make it a shared filter, then they are the only user (account) who will be able to access/use that filter.

Filtering a datasource using multi select wild character

Does anyone know if there is a wildcard character in AppMaker that can be used for all possible values for a field in a query?
I currently have a datasource that is being filtered based on the status using a multi-select widget. What I would like to accomplish is when all values have been de-selected I want to load all the records of that datasource without clearing the entire query in case other filters have been applied. I have it working in-a-sense that I have to explicitly construct my query as such:
widget.datasource.query.filters.Status._in = ['Status Value 1','Status Value 2','Status Value 3']
My current solution is loading the correct data when a value is selected and it correctly shows the union of the query as the values are modified. However, it selects all of the values in my multi-select; which I know is how it is supposed to work.
I tried using widget.datasource.query.filters.Status._contains = ''; and changing the assignment value to no avail. I even tried the opposite approach using _notContains
The intended outcome is to have a filtering dashboard appear much like any website where when no filtering is selected all records are displayed. I was hoping to find a wildcard character that would load all of the records. Just trying to find a way to mimic other website filters with all records when none are selected.
Thanks for the time!
So the easiest solution here is to set up your Multiselect as follows:
Options binding:
#models.YourModel.fields.Status.possibleValues
or if you don't have the possible Status values in your model then set your options binding to:
['Status Value 1','Status Value 2','Status Value 3']
Values binding:
#datasource.query.filters.Status._in
Now anytime you select any choices in the multiselect, the query will only include records that include the selected choices. And if you deselect all choices the query will ignore that filter or treat it as an empty array of values, therefore returning all records unless you applied other filters.

Proper multi-id syntax when using the custom_file_ids[] query parameter for the CLIO API "contacts" endpoint

What is the correct API syntax for using the custom_file_ids[] query parameter to specify multiple fields (but not all) in the CLIO API contacts result set? I need to specify multiple custom fields. I can get it to work for a single field, but not multiple fields at the same time.
Specifically, how do I specify and delimit the multiple fields? I have tried the following:
custom_file_ids[]=1234567,2345678
custom_file_ids[]=[1234567,2345678]
custom_file_ids[]=(1234567,2345678)
custom_file_ids[]={1234567,2345678}
custom_file_ids[]=1234567:2345678
The API documentation at https://app.clio.com/api/v4/documentation is silent on the list syntax that it expects.
Below is one specific API call I tried (both the actual URL-encoded call, and a decoded one for clarity) using a simple comma-delimited list, but which only returns custom field data for the first ID in the list--not the second. If I enclose the ID list in any kind of brackets (per above), the endpoint returns a 404 error.
https://app.clio.com/api/v4/contacts?custom_field_ids[]=1234567%2C2345678&custom_field_values[4529224]=true&fields=id%2Cname%2Cprimary_address%2Cprimary_work_address%2Cis_client%2Ctype%2C%20primary_email_address%2Cprimary_phone_number%2Ccustom_field_values%7Bid%2Cfield_type%2Cfield_name%2Cvalue%2Ccustom_field%7D
https://app.clio.com/api/v4/contacts?custom_field_ids[]=1234567,2345678&custom_field_values[4529224]=true&fields=id,name,primary_address,primary_work_address,is_client,type,primary_email_address,primary_phone_number,custom_field_values{id,field_type,field_name,value,custom_field}
Try:
custom_file_ids[]=1234567&custom_file_ids[]=2345678
I was able to do this with Contacts Custom Fields by putting custom_field_id[] on the URL as many times as you have IDs.
I hope this helps.

Get more product field value in Algolia json data

We are using Algolia extension for Magento 2. We added 2-3 field in the products, so we want to show the value of those fields on instant search result page. As we checking the view/frontend/templates/instant/hit.phtml is in use, we want to add the custom attributes to the JSON data so we can fetch those attributes value and show in listing page.
First you have to add new fields to Algolia product index if not already added. You can use one of the custom backend events. e.g. algolia_after_create_product_object
Once your fields are indexed properly (verify from Algolia account console), you should be able to get those in hit.phtml

Algolia Undeclared Property Filter

I'd like to filter Algolia by missing properties, is this possible?
At the moment we are using:
filters:(expires=0 OR expires<1506338742)
Which works fine for content that has the expires property, but not all content does, so they get omitted from the results.
Is there a way of adding an extra condition where property expires is not set/undefined? I have tried a few different variations but can't get it to work, and the documentation doesn't seem to cover this.
Algolia offers no way to filter on the presence of an attribute.
As a result, the solution to your issue depends on the expected results.
Here is one way you could return results that have not expiration attribute.
At indexing time, push another attribute has_expiration along with every record.
This attribute should be boolean that will equal true if expiration should be taken into account or false otherwise.
Then you need to adapt your filters query parameter as follow: filters:(expires=0 OR expires<1506338742) OR has_expiration=0