Post Tweet as other user using Twitter API? - twitter

I've sorted the OAuth Twitter stuff and currently all my application does is grab Tweets and display them on a web page. After the user has given permission for my application to use their account, is there a way to post a Tweet on their behalf i.e. post AS them?

First point of call would be reading here - https://dev.twitter.com/docs/auth/oauth/oauth-echo

Related

Search any twitter users feed

Its been a while since i last used the twitter api, Using Javscript, I would like to be able to search any random twitter users feed.
On the page I would enter there Twitter username and the app would go and find the users data returned as JSON.
I'm not after the code, I would just like to know what is the best API to use for this?
Do I just need the REST API, I assume this:
https://dev.twitter.com/rest/public/search
Also, authentication do I need to authenticate my app? how should I do that if its needed?
thanks.
If you want all of my tweets (#edent) you will need to use the User Timeline API
For example:
https://dev.twitter.com/rest/reference/get/statuses/user_timeline?screen_name=edent
Yes, you will need your app to be authenticated. You will need to use OAuth

Showing all posts from a Twitter user

Using Twitter's API is it possible to write an application to show all the posts from a particular user when you don't know the Twitter password for that user?
If the posts/tweets are not protected, yes. You need the Twitter user_id or screen_name.
Check this API

Twitter API: post on behalf of whom?

I want to use Twitter API so my program can post some tweets. To use it I have to register application in dev-center and get some parameters like "Consumer key", "Consumer secret" etc. Then I can use either REST API, or some libraries like twitter4j - OK, that's simple.
But the question is: who will be the "author" of such tweets? Or, in other words, where can I find them after posting? Will they be posted by application or by some user? I can't really figure out how particular user binds to registered API-application... Or how can I specify ("log-in") user to post tweet on behalf of?
The "author" is always going to be the authenticating user. From the Twitter API documentation for statuses/update:
Updates the authenticating user's current status, also known as tweeting.
To answer your other question about authenticating with another user's username/password, it is possible but you need to get permission from Twitter. You also still need to use OAuth. Check out the Twitter API OAuth documentation.
You need to have a twitter account to register your application. So your account will be the author of your posts.

Post on Users Timeline when Login via Facebook

I have an application where the user can login via Facebook. When he logs in the first time, it stores the email address in our database (the one we got from Facebook) and sends him a daily newsletter mail. This not so cool, because most user who log in via Facebook would prefer to have it in there stream instead of a mail.
Here my question: How can I post through the API to the users timeline. I couldn't find a manual, or is it just not possible?
(I'm using the https://github.com/mkdynamic/omniauth-facebook and rails, but my question is more general if it is possible via the facebook API)
You can post using "koala gem" to the users timeline.
Here is the documentation
https://github.com/arsduo/koala

After Oauth with facebook , how do I get the graph of the pages created by user?

After OAuth with facebook , how do I get the graph of the pages created by user?
I search over the documentation and event search inside the callback that facebook send me after the OAuth , I still can't get the pages that the user create , I have to use FQL for this? And how do I use FQL in rails?
You can use the graph api to query for this information after you have logged in using OAuth.
Facebook uses an unintuitive name for this interface - accounts. The URL you are looking for is - https://graph.facebook.com/me/accounts?access_token= < your_access_token >
This should list out a JSON array of objects that have been created by the logged in user. The pages created by the user will be in this list along with the list of pages that they are fans of.
After authentication you receive a token. Use it to request graph API and you are authenticated with user depend of this token.

Resources