Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fields method to follow airtable spec #6

Merged
merged 2 commits into from
Apr 13, 2022

Conversation

minorgod
Copy link
Contributor

@minorgod minorgod commented Apr 6, 2022

When adding fields[21] (more than 21 fields), airtable API throws an error such as:

{
	"error": {
		"type": "INVALID_REQUEST_UNKNOWN",
		"message": "Invalid request: parameter validation failed. Check your request data."
	}
}

Don't ask me why this breaks airtable, but according to the airtable api docs, the list of fields params should only include the brackets, not a number. Here's an example from their docs:

For example, to only return data from Event Name and Performers, send these two query parameters:
fields%5B%5D=Fieldname1&fields%5B%5D=Fieldname2
Note: %5B%5D may be omitted when specifying multiple fields, but must always be included when specifying only a single field.

Submitting the requests without the numeric indexes in the fields[] works fine with 21 or more fields in the list.

When adding `fields[21]` (more than 21 fields), airtable API throws an error such as:
```json
{
	"error": {
		"type": "INVALID_REQUEST_UNKNOWN",
		"message": "Invalid request: parameter validation failed. Check your request data."
	}
}
```
Don't ask me why this breaks airtable, but according to the airtable api docs, the list of fields params should only include the brackets, not a number. Here's an example from their docs:

"
For example, to only return data from Event Name and Performers, send these two query parameters:

fields%5B%5D=Fieldname1&fields%5B%5D=Fieldname2

Note: %5B%5D may be omitted when specifying multiple fields, but must always be included when specifying only a single field.
"

Submitting the requests without the numeric indexes in the fields[] works fine with 21 or more fields in the list.
…testcase. Also added a fix for a Java 8 compiler issue due to method ambiguity. IDE inspections may complain that there is an unnecessary cast (JsonNode) but at least Java 8 will be able to compile the file now. See here for discussion regarding the issue and the fix: https://stackoverflow.com/questions/32294140/java-8-reference-to-method-is-ambiguous
Copy link
Owner

@fuxingloh fuxingloh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, oh wow. I am wondering if they might have changed the specs recently.

The difficult part would be publishing this into maven since I need to gpg sign it. Don't have access to it on my remote workspace. Will attempt to publish over the weekend.

@fuxingloh fuxingloh merged commit 397cb56 into fuxingloh:master Apr 13, 2022
@minorgod
Copy link
Contributor Author

Hey, thanks for merging that! I was temporarily using Jitpack to substitute my fork and my team was complaining about it. I was worried you might not still be maintaining this lib. Glad to see you still are! Hope you can figure out how to publish to Maven so I can remove Jitpack from my build config before someone on my team rages on me. :)

@fuxingloh fuxingloh added the kind/fix Fix a bug label Apr 16, 2022
@fuxingloh
Copy link
Owner

Hey thanks, it's published https://repo1.maven.org/maven2/dev/fuxing/airtable-api/0.3.2/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/fix Fix a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants