Help

This Product Ideas board is currently undergoing updates, but please continue to submit your ideas.

API - When Using A View, Return Only Its Visible Columns

cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Tim_Dietrich
6 - Interface Innovator
6 - Interface Innovator

Currently, when you retrieve records through the API and specify a view, only those records that are visible through the view are returned, and they are returned in the order in which they are displayed. This is a noce feature, and I use it often.

It would also help if the API returned only the columns that are visible through the specified view. In other words, any hidden columns would be excluded from the result. I believe that this would help both in terms of security and performance.

~ Tim

7 Comments
dhc
5 - Automation Enthusiast
5 - Automation Enthusiast

Yes, please! I was quite surprised by how much unnecessary data was returned by the API - seems like thatโ€™s very much the point of having the views in the first place!

Yash_Shrestha
4 - Data Explorer
4 - Data Explorer

Is this why I am getting a super-set of the expected output when doing a Node retrieval request? I was expecting Output 1 but am getting Output 2:

Output 1:
{
โ€œidโ€: โ€œrecoubblcbUlQ4dkvโ€,
โ€œfieldsโ€: {
โ€œNameโ€: โ€œEmbraer E190โ€,
โ€œTypeโ€: โ€œEmbraer E190โ€,
โ€œAirplanesโ€: [
โ€œrecoBQnUDUlFWjq59โ€,
โ€œrecbwDn7RswDy6TwWโ€
],
โ€œRecIDโ€: โ€œrecoubblcbUlQ4dkvโ€
},
โ€œcreatedTimeโ€: โ€œ2016-01-08T00:33:47.000Zโ€
}

Output 2
{"_table":{"_base":{"_airtable":{"_apiKey":"","_endpointUrl":โ€œhttps://api.airtable.comโ€,"_apiVersion":โ€œ0.1.0โ€,"_apiVersionMajor":โ€œ0โ€,"_allowUnauthorizedSsl":false,"_noRetryIfRateLimited":false},"_id":""},โ€œidโ€:null,โ€œnameโ€:โ€œTypesโ€},โ€œidโ€:โ€œrecoubblcbUlQ4dkvโ€,"_rawJson":{
โ€œidโ€:โ€œrecoubblcbUlQ4dkvโ€,
โ€œfieldsโ€:{
โ€œNameโ€:โ€œEmbraer E190โ€,
โ€œNotesโ€:โ€œNote\n\nโ€,
โ€œTypeโ€:โ€œEmbraer E190โ€,
โ€œAirplanesโ€:[
โ€œrecoBQnUDUlFWjq59โ€,
โ€œrecbwDn7RswDy6TwWโ€
],
โ€œRecIDโ€:โ€œrecoubblcbUlQ4dkvโ€
},โ€œcreatedTimeโ€:โ€œ2016-01-08T00:33:47.000Zโ€
}
,โ€œfieldsโ€:{โ€œNameโ€:โ€œEmbraer E190โ€,โ€œNotesโ€:โ€œNote\n\nโ€,โ€œTypeโ€:โ€œEmbraer E190โ€,โ€œAirplanesโ€:[โ€œrecoBQnUDUlFWjq59โ€,โ€œrecbwDn7RswDy6TwWโ€],โ€œRecIDโ€:โ€œrecoubblcbUlQ4dkvโ€}}

Kasra_Kyanzade1
6 - Interface Innovator
6 - Interface Innovator

Hi!

We just released an API update that lets you limit which fields are returned in results, as well as filtering which records are returned.

You can read more about it on our blog or in the API documentation.

Kasra_Kyanzade1
6 - Interface Innovator
6 - Interface Innovator

It looks like youโ€™re printing the record object directly. To get the field values use the get method on the record object. e.g. to get the notes for a record: record.get('Notes').

We donโ€™t currently have a way of automatically getting all the field values as an object, but will consider adding it in the future.

Marc_Vilella
5 - Automation Enthusiast
5 - Automation Enthusiast

Having the API parameters is a great way to restrict information in the consumer side, but I think Timโ€™s suggestion is more focused on the creator side, so only one view (and the columns/rows we decide) are exposed to the API queries keeping other information private

Stephen_Juth
4 - Data Explorer
4 - Data Explorer

I also agree with Timโ€™s suggestion. Limiting fields via the API is a nice addition. However, it seems it would be easier to allow users to create (simplified) views containing hidden fields, and by default returning only those fields that are visible.

Perhaps an โ€˜includeHiddenโ€™ boolean parameter can be provided that allows a developer to choose their desired behavior.

Owen
4 - Data Explorer
4 - Data Explorer

Totally agree with this - would be great and it should be driven from the user end - particularly since there doesnโ€™t seem to be a way to get a list of hidden fields via API either, so you canโ€™t just query the view for visible fields and ask to only return those.