-
-
Notifications
You must be signed in to change notification settings - Fork 151
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
Making adjustments to allow operation w/ API 2 #76
base: master
Are you sure you want to change the base?
Conversation
When will this pull request be merged? We need the API V2. |
Not sure the answer to that, but as a workaround you can specify the full URL for an API endpoint. That will keep it from adding the |
Thanks @AndyM84 , your patched version works as expected with v2 endpoints. |
Can you clarify how or where do i need to specify the full url for an api endpoint and what is the url? I already have your commit files Or how can i specify the url or the version? like on this function:
Using it give mi this error: Error: You currently have access to a subset of Twitter API v2 endpoints and limited v1.1 endpoints (e.g. media post, oauth) only. If you need access to this endpoint, you may need a different access level. You can learn more here: https://developer.twitter.com/en/portal/product If i change Twitter.php file public function request () to this:
It return this: Error: Server error #404 with answer If i also change the Twitter.php file send function lines to this:
I got this: Error: Requests with bodies must have content-type of application/json. So, what is the correct way to use the functions? |
@barart, the above message makes it sound like you have an issue with your Twitter API account, and not a problem with the library or my changes? |
No, is not a problem with my twitter account, i think its the library itself it's obsolete, twitter deprecated almost all the 1.1 endpoints, in order to create a tweet you need to use the v2 endpoint, but upload the media with 1.1 endpoint, to search tweets you need to use v2 as well, so, your changes do not work completely for v2, i think that unfortunately the library needs to be fully rewritten Example: statuses/update only works on 1.1 but is deprecated statuses/update do not exists on v2 (404 error) tweets is the endpoint for create a tweet Same as that endpoint is the search endpoint search/tweets endpoint is for 1.1 but dont exists on 2, for 2 it changed the words to this endpoint: tweets/search Try to use the send, search funcions of the library so you can check the errors, |
Maybe if I get some time to work on this I'll look into updating other parts, but I really only did this so I could automate deleting my tens of thousands of tweets when I left the platform after Musk took over. If you want to take a crack at it, it seems like you would just need to normalize the API endpoints that are used by the various methods so it matches where the new equivalents are at Twitter. Also, the |
Adjusted
Twitter::request(..)
to allow users the ability to query Twitter API v1.1 & v2:Twitter::makeApiUrl(..)
method for joining versioned API resource paths$apiSuffix
parameter toTwitter::request(..)
for specifying Twitter API version suffixTwitter::request(..)
logic to exclude '.json' append for API v2 pathsTwitter::request(..)
to useTwitter::makeApiUrl(..)
for incomplete API pathsTwitter::request(..)
to provide more informationreadme.md
to note that API v2 requests are possibleTested both of the following requests with my own keys to ensure they worked: