Fix include_email query param value for account/verify_credentials REST API endpoint #241
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Only 'true' and 'false' values are acceptable for it.
I've tested STTwitter on an application that is whitelisted by Twitter to access user's email address when calling GET account/verify_credentials REST API endpoint.
When calling getAccountVerifyCredentialsWithIncludeEntites method with includeEmail set to 1 , it adds the include_email parameter with the value of "1" to the query string parameters sent to the verify_credentials endpoint. (e.g.
https://api.twitter.com/1.1/account/verify_credentials.json?include_email=1
), however no email key is returned in the JSON response.After further debugging I've found that setting the include_email parameter to the value of "1" is the problem.
According to the docs on the verify_credentials endpoint, the possible values for it are "true" and "false":
Changing the values for the include_email parameter sent to the verify_credentials endpoint to "true" (e.g.
https://api.twitter.com/1.1/account/verify_credentials.json?include_email=true
), correctly returns the email parameter in the response.I think this is either an inconsistency in the Twitter API or a deliberate decision, because other endpoint parameters accept either true, t or 1 values. (e.g. skip_status)
or include_entities, even though the include_entities documentation only says it accepts "true" or "false"
However using include_entities with a value of "1" returns the entities in the response, even though the docs don't mention that it accepts anything other than "true" or "false" for its value.
To fix the problem with the include_email parameter I propose to change the values that STTwitter sends to the verify_credentials endpoint for it.