Skip to main content

Hi,

 

I’m new on using this product and we are trying to integrate this into our system. I managed to setup the api and make some requests however, during my testing in the list records api with `POST` method. I was trying to use this parameter `returnFieldsByFieldId` in the request body but got an error stating this..

```

{

 "error": {

      "type": "INVALID_REQUEST_UNKNOWN",

      "message": "Invalid request: parameter validation failed. Check your request data."

  }

}

```

Mentioned parameter works with `GET` request. Tried a bunch of boolean equivalent for this parameter like

-  1
-  true
-  True
-  TRUE

Hoping someone can help. TIA.

Hi ​@crmonlineau_mike,

I am able to use the returnFieldsByFieldId parameter in a POST request. Please see the below command for an example request using this parameter.

curl -X POST \
"https://api.airtable.com/v0/YOUR_BASE_ID/YOUR_TABLE_NAME/listRecords" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"returnFieldsByFieldId": true,
"maxRecords": 3
}'

 


The List records endpoint only takes GET, and so it erroring out when you do a POST makes sense, right?  Sorry, think I’m not understanding something.  https://airtable.com/developers/web/api/list-records

What’re you trying to do with your request?


Hi,

I was trying out this particular note
 

Note Airtable's API only accepts request with a URL shorter than 16,000 characters. Encoded formulas may cause your requests to exceed this limit. To fix this issue you can instead make a POST request to /v0/{baseId}/{tableIdOrName}/listRecords while passing the parameters within the body of the request instead of the query parameters.

 

I was trying out to list down the records for a particular table using the POST method as suggested in the note just to avoid the URL limitations. Here is a sample request that i’m doing.
 

curl -X POST \

  --location 'https://api.airtable.com/v0/ebaseId]/[tableId]/listRecords' \

  --header 'Authorization: Bearer ntruncated]' \

  --header 'Content-Type: application/x-www-form-urlencoded' \

  --data-urlencode 'fields%5B%5D=fldaqbAq8L8EeN92J' \

  --data-urlencode 'sort%5B0%5D%5Bfield%5D=fldaqbAq8L8EeN92J'

  --data-urlencode 'returnFielddsByFieldId=1' \

  --data-urlencode 'fields%5B%5D=fldaqbAq8L8EeN92J' \

  --data-urlencode 'sort%5B0%5D%5Bfield%5D=fldaqbAq8L8EeN92J'



Thanks


Hi,

I think, i already understand now. kudos ​@djseeds. I was using a wrong content type for my payload. I tried using json as suggested and it works.

Thank you so much 🙏


Reply