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

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.

Related

Using Azure DevOps API to get Work Item Types Field values for a field that has dynamic data based on the value of another field

I'm using the API query
GET https://dev.azure.com/{organization}/{project}/_apis/wit/workitemtypes/{type}/fields/{field}?api-version=5.1
with great success to get all of the allowed values for my fields. The issue is that the options to one of my dropdown menus is populated based on the selected value of another dropdown menu. Is it possible to pass a value to this GET query and then retrieve all of the allowedValues for this dynamically populated menu?
I'm afraid that this is currently impossible to pass a value to this GET query and then retrieve all of the allowedValues for this dynamically populated menu.
Work Item Types Field-Get rest api should only get the allowedValues of a specified field, cannot implement the logic of returning the allowedValues of this field based on the value of another field.
In addition, according to URI Parameters, you also cannot add the value of another field as optional parameters to the url for conditional filtering .
You could add your request for this feature on our UserVoice site , which is our main forum for product suggestions.After suggest raised, you can vote and add your comments for this feedback. The product team would provide the updates if they view it.

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.

Using Smartsheet API 2.0 how to get ONLY the 'modifiedAt' property of a specific sheet

I need to get the last modified timestamp property of a sheet using Smartsheet API 2.0 (preferably Python SDK).
Ref:
https://smartsheet-platform.github.io/api-docs/
https://github.com/smartsheet-platform/smartsheet-python-sdk
Using Sheets.list_sheets I am able to get the 'modifiedAt' property (along with other properties) for all the sheets that I have access to.
Using Sheets.get_sheet(sheet_id) I get all the data (rows, columns) for the specified sheet.
How do I get only the 'modifiedAt' (it's OK if some other small properties are also present) for a specific sheet with a known sheet ID. I don't want the row, column, cell information to be present in the API response.
I wrote to Smartsheet support team and their answer served my purpose.
Thanks for contacting Smartsheet Support. In order to narrow down the
response that you're getting, you can use the exclude parameter:
http://smartsheet-platform.github.io/api-docs/#query-strings. In my
testing, I excluded all rows and columns where columnIds=0 and
rowIds=0. That left me with only the Sheet information, which includes
the modifiedAt for the sheet. You may be able to limit it further, but
the result I got from this was pretty short and sweet.
(Python SDK example)
response = ss_client.Sheets.get_sheet(MY_SHEET_ID, column_ids='0', row_ids = '0')
Using the above parameters, I was able to exclude all the sheet data and got only the metadata (which included modifiedAt property).
Basically my intention was to run a sync script periodically and store the Smartsheet data into my local db. I wanted the API response to skip the actual Sheet data (rows, columns, cells) if nothing would have changed since the last execution. Another nifty way of achieving this to use the ifVersionAfter parameter.
ifVersionAfter (optional): If version specified is still the current
sheet version, then returns an abbreviated Sheet object with only the
sheet version property. Otherwise, if the sheet has been modified,
returns the complete Sheet object. Intended to allow clients with a
cached copy to make sure they have the latest version.
last_version_fetched = 7724
response = ss_client.Sheets.get_sheet(MY_SHEET_ID, if_version_after=last_version_fetched)
The Get Sheet call will always return the content (row, column, data) from a specific sheet. While there is an 'exclude' query parameter that can filter out some properties, it does not work on the primary sheet data returned from the /sheets/{sheetId} endpoint.
The Sheets.list_sheets call seems like the easier route if you only need the modifiedAt property. I would use that one then iterate over the results until you find the matching id.

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

Filtering by action_target_id on Facebook Ads API

I am using the Facebook Ads API to try to filter out specific action target ids using the follwowing call:
(account-id)/reportstats?date_preset=yesterday&data_columns=["action_target_name","adgroup_id","adgroup_name","spend","actions","adgroup_objective"]&actions_group_by=["action_target_id", "action_destination"]&filters=[{"field": "action_target_id","type": "contains","value": 'insert id'}]
Every time I try to put in a specific ID, I get an empty data set back. Whenever I change the type to "not_contains", I get every piece of data returned. I've also tried the same with action_destination, but it keeps saying value needs to be numeric even though it a string.
It definitely seems like you can filter by action_target_id because when I tried to filter by something random, it told me that filter doesn't exist.
Can anyone help me please?
Unfortunately these values are nested under the actions fields of the results and filters only work on top level field values.