Podio API filtering of returned fields without using a view - podio

Based on the information provided by Pavlo it appears there is no way to exclude certain fields and no way to include specific fields from Podio data returned from a JSON Post query. For the purpose of this question, the fields involved are (for example) text, category, date, calc field and others which can be added using 'modify template'.
The best work around is redesign of the app to reduce the amt of field data.
(original question)
Is there a way to limit the amount of Podio data returned from a JSON Post query to include only a few specific fields instead of every field?
I understand how to use a podio view or filtering in the Post query to limit how many items are returned, but my question has to do with reducing the amount of data returned for each item by preventing data in unnecessary fields from being returned.
(following is an example of the query I use currently, but as stated above I'm looking for a way to limit the fields returned to a small subset)
Example JSON query: https://api.podio.com/item/app/14773320/filter
Example JSON body:
{
"filters": {
"created_on": {
"from": "{date.addMonths(-6).format()}",
"to": "{date.today}"
}
},
"limit":250,
"offset":{props.offSet}
}

You can use fields parameter for that.
More details on how it works and how else it could be used are right here: https://developers.podio.com/index/api. Scroll down to Bundling responses using fields parameter section.
Most likely you are looking for fields=items.view(micro) parameter. Podio API will return then only 5 values for each item:
app_item_id
item_id
title
link
revision

Related

Podio API query

I have podio data with more number of column, but we need to fetch 5-6 column data through API. I attached column name screenshot. If we need only for example order id, city, country then how to write API query?
/item/app/{app_id}/filter/
If it is right, how to write query with selected column name with GET/POST.
The filter endpoint uses a POST body to filter which records to return, not which fields/columns to return. It is not possible to specify which fields/columns to return with an API call according to this SO thread from an old Podio support person.
If you are looking to remove fields from the query to reduce your datasource size within Klipfolio, I would recommend returning the API call in CSV format instead of JSON. Klipfolio support documents how to do this HERE by performing a GET operation and adding /csv to the end of the URL.
https://api.podio.com/item/app/Your-APP-ID/csv/

React Admin - Make input for filter based on other resource

I am using React Admin to make a dashboard and I have this Lead resource with the status field, that is computed based on another resource, Call, and wanted to make a filter component for Lead's list. The way it works is that for each lead, I query the last call (sorted by a date field) associated with this lead and get its status. The lead status is the status for the last call.
{ filter: { lead }, sort: { date: -1 }, limit: 1 }
the lead status query
I use this query to make a field (that appear in the list in the row of a single lead), and wanted to know how I can make an input component to use as a filter in the list. I know this pattern is weird, but it's hard to change it in the backend because of how it's structured. I am open to suggestions concerning how to change this messy computed field situation, but as I said, I would be satisfied with knowing how I can create the input component.
The solution I'm going with is a computed field. In my case, as I use MongoDB, it will be done through an aggregation pipeline. As I'm using REST instead of GraphQL, I cannot use a resolver that would only be called in the need of the status field, sometimes resulting in an uneeded aggregation (getting the last Call for a given Lead). However, it won't incur in an additional roundtrip - and instead only consume more processing time in the DB - which would be necessary for react-admin to compute this field in through a reference. And status is an important field that will usually be needed anyways.

Can podio's api filter item response with only a mini detail level for each item?

My script needs to check from time to time that all items present in an app are recorded in its own db. Indeed even when using the podio hooks, it happens that my script and podio are getting desynchronised.
It uses the filter item api call by batch of 100 of items. In this case the script doesn't need to know all the fields values, but only the basic informations: item_id, app, title, link and current_revision.
I wonder if it's possible to set a query parameter in the filter function only only get the mini view of each item. This could improve greatly performances.
You can use fields parameter for that.
More details on how it works and how else it could be used are right here: https://developers.podio.com/index/api in "Bundling responses using fields parameter" section.
Using fields to bundle objects can be a way to drastically reduce the amount of API requests you have to make.
Most likely you are looking for fields=items.view(micro) parameter. Podio API will return then only 5 values for each item:
app_item_id
item_id
title
link
revision

Splunk Search does not return all event data on a field

I'm facing a very strange issue in my Splunk search. I have a data input coming from a REST API that returns a multi-level (nested) JSON response:
The entity node has several nodes, each node represents one access point. Each access point contains a field called ipAddress.
This API is being called every 5 min and response stored in Splunk. When I do a search to get the list of IP Addresses from one event I don't get all of them. For some reason, is like Splunk is reading only the first seven nodes inside entity, because when I do:
source="rest://AccessPointDetailsAPI" | head 1
Splunk shows only the following values on the field (7 values although there are around 27):
I'm using demo license if that matters. Why I cannot see all values ? If I change my search to look for a specific iPAddress on the response but not on the list it won't return records.
Thanks and regards,
I think I understand the problem now. So the event is a big json and Splunk is not properly parsing all fields on the big json.
We need to tell splunk to parse the specific field we need with spath and specifying the field:
yoursearch | spath output=myIpAddress path=queryResponse.entity{}.accessPointDetailsDTO.ipAddress | table myIpAddress
http://docs.splunk.com/Documentation/Splunk/5.0.4/SearchReference/Spath
But I think also is important to analyze if maybe the data input needs to be divided in multiple events rather than a single huge event.

Few questions about Grails' createCriteria

I read about createCriteria, and kind of interested on how these works, and its usability in providing values for dropdown box.
So say, i have a table in the database, Resource table, where i have defined the table in the domain class called Resource.groovy. Resource table has a total of 10 columns, where 5 of it are
Material Id
Material description
Resource
Resource Id
Product Code
So using the createCriteria, and i can use just like a query to return the items that i want to
def resList = Resource.createCriteria().list {
and {
eq('resource', resourceInstance)
ne('materialId', '-')
}
}
Where in the above, i want to get the data that matches the resource = resourceInstance, and none of the materialId is equal to '-'.
I want to use the returned data from createCriteria above on my form, where i want to use some of the column on my select dropdown. Below is the code i used for my select dropdown.
<g:select id="resourceId" name="resourceId"
from="${resList}"
disabled="${actionName != 'show' ? false : true}" />
How do i make it so that in a dropdown, it only shows the values taken from column Product Code? I believe the list created using createCriteria returns all 10 columns based on the createCriteria's specification. But i only want to use the Product Column values on my dropdown.
How do i customize the data if in one of the select dropdown in my form, i wanted to show the values as "Resource Id - Resource Description"? The values are combination of more than 1 columns for one select dropdown but i don't know how to combine both in a single select dropdown.
I read that hql and GORM query are better ways of fetching data from table than using createCriteria. Is this true?
Thanks
First of all refer to the document for using select in Grails. To answer all questions:
Yes, the list to select from in the dropdown can be customized. In this case it should be something like from="${resList*.productCode}"
Yes, this can be customized as well with something like
from="${resList.collect { \"${it.resourceId} - ${it.resourceDesc}\" } }"
It depends. If there are associations involved in a domain then using Criteria will lead to eager fetches which might not be required. But with HQL one gets the flexibility of tailoring the query as needed. With latest version of Grails those boundries are minimized a lot. Usage of DetachedCriteria, where queries etc are recommended whereever possible. So it is kind of mixing and matching to the scenario under consideration.