Bundling responses using fields parameter
In the documentation there is a short mention about building responses. We use Google Apps Script, and because a podio response is about 30kb, we can hit a daily 100Mb limit quite fast. I want to optimize my calls and found this option.
But, is there any documentation about the way to use these parameters?
Bundling responses using fields parameter
It can often be useful to include more or less content in responses than the defaults provided by Podio. E.g. by default a request to Filter Items does not include the files of each individual item or when you get a single item you might want to include the app the item belongs to in the response. To solve those cases you can use a fields parameter in your URL.
// Include "votes" when getting a single item
/item/{item_id}?fields=votes
// Include files when getting filtered items
/item/app/{app_id}/filter/?fields=items.fields(files)
// Include the full app when getting an item
/item/{item_id}?fields=app.view(full)
These examples show the three main ways to use the fields parameter:
Include additional attributes on the object you are getting (such as votes on an item)
Include additional attributes on objects from a nested property (such as including files on the items property)
Use a standard view instead of listing all fields (such as including the full app on an item). Typical values are micro, mini, full
You can use nesting to get additional fields on any number of sub-properties. E.g. you can get the full app and the full space when fetching a single item:
// Include the full app and the full space when getting an item
/item/{item_id}?fields=app.view(full).fields(space.view(full))
Using fields to bundle objects can be a way to drastically reduce the amount of API requests you have to make.
-
Official comment
Hi Riel,
The fields parameter has been build mostly with the case in mind where you need more data, not less.
But what you can do, is that you can ask for a different view, which will return less data, for example the "micro" view. How do you know which views exists? We are still finalizing this, but to give you an idea you can take a sneak peak here:
Comment actions
Please sign in to leave a comment.
Comments
2 comments