I want to upload an image to the user's twitter account. For this, I need a URL which I will get in from of a json response.
I know the URL where the request should be sent i.e. 'http://api.twitpic.com/2/upload.json', but what should be the parameters for the request that I don't know.
Any Help?
which language you are using?
For now, check the examples here http://twittown.com/forums/showthread.php?t=768 and using TwitPic + OAuth to upload a photo + tweet to Twitter (.NET C#) - why no tweet?
They detailed every thing how to Twitpic including the OAuth
Related
What I'm trying to achieve via Microsoft Graph API is to upload an image to my personal OneDrive and get a URL which my code will then send to someone else to view at a later date. This URL must require no authentication and must able to be used in an img tag for a website.
I've managed to upload the image and use the /thumbnails endpoint to get the URL but it seems like the URL expires after some time (I think around 24 hrs). I have also tried:
using the /content endpoint - that also created a short-lived URL.
using the /createLink endpoint then encoding the URL and using the /shares endpoint - that also created a short-lived URL.
So...anybody know of any alternatives to create a non-expiring public URL for images on personal OneDrive accounts using Microsoft Graph API?
Many thanks in advance!
I would like to retrieve media inside statuses, but as I could read in the docs:
For media in direct messages, media_url_https must be accessed via an
authenticated twitter.com session or by signing a request with the
user’s access token using OAuth 1.0A. It is not possible to directly
embed these images in a web page
Now my question is, how to do that kind of request using Java API? or however what is the correct request with RestAPI, using App only auth?
another question: what is the difference for media in direct messages and media shared in Tweets? how can I see the difference inside json object representing a status?
what is the difference for media in direct messages and media shared in Tweets?
If an image is posted to a Twitter timeline, any Internet user can see it. For example on this Tweet the image is available to anyone, whether or not they're logged into Twitter. See https://pbs.twimg.com/media/CSGwFynWoAA2GGG.jpg
If an image is posted into a Direct Message, it is only possible for the sender and receiver to see the image. In order to enforce that, the user must either be signed in to their Twitter account, or send a signed request via an app.
For example, this image can only be seen by me & the person I sent it to https://ton.twitter.com/i/ton/data/dm/639737026624024579/639737026682691584/tg-4St-1.jpg
how can I see the difference inside json object representing a status?
The only difference (other than the API call you used to get the data) is the URl of the media. In a DM it starts with ton. e.g.
media_url": "https://ton.twitter.com/1.1/ton/data/dm/......
Whereas in a normal Tweet, it will look like e.g.
"media_url": "http://pbs.twimg.com/media/.......
Now my question is, how to do that kind of request using Java API? or however what is the correct request with RestAPI, using App only auth?
If the user is already logged in to Twitter, they will be able to download the image. For example, if you have written a web-app and the browser already contains the Twitter cookies etc.
If not - or you're using an app - you will need to sign the request on the user's behalf.
For REST - you need to send OAuth headers with the request. There's example code in the Twitter documentation
The extra header will look something like
Authorization:
OAuth oauth_consumer_key="xvz1evFS4wEEPTGEFPHBog",
oauth_nonce="kYjzVBB8Y0ZFabxSWbWovY3uYSQ2pTgmZeNu2VS4cg",
oauth_signature="tnnArxj06cWHq44gCs1OSKk%2FjLY%3D",
oauth_signature_method="HMAC-SHA1",
oauth_timestamp="1318622958",
oauth_token="370773112-GmHxMAgYyLbNEtIKZeRNFsMKPR9EyMZeS9weJAEb",
oauth_version="1.0"
For Java, I'd suggest you take a look at how Twidere does it.
In my app i need to integrate it with TripAdvisor API.
i searched a lot about it, i found this in there website:
https://developer-tripadvisor.com/content-api/
it's actually un useful!.
I didn't find any example or demo for this integration!
Anyone knows how to integrate with TripAdvisor in IOS? Or have any example about it?
thanks
Well, just like most APIs, you first have to get your API key from TripAdvisor. So go to the Request API Access form and fill that out (You have to sign up for Trip Advisor first, or sign in with a Facebook or Google account). They will then contact you with your API key and info.
Now that you have the key, the more interesting part takes place. You can use the app in HTTP requests in your app (Example Here) with the URL of the request you want to make. For example, if I wanted to get results for hotels with my coordinates, I would use this URL:
http://api.tripadvisor.com/api/partner/2.0/map/42.33141,-71.099396/hotels?key=<YOUR KEY HERE>
The response would be some JSON code which you can parse with Swift's built-in JSON parser, NSJSONSerialization. With this data, you can now store and make use of what you needed from their API.
To see the full API documentation of all the requests you can do and their details, just visit the TripAdvisor API Documentation.
Hope this helps,
Gabriel
Can any one explain how to send a Twitter request to get the latest tweets for a hashtag using Twitter API V1.1 using OAuth settings ? I have searched for documentation in Twitter site, but I am incomplete.
Can any one give the sample request & response through RestClient or Advanced Rest Client ?
Thanks in advance.
You have multiple questions here, so I'll answer them one by one.
The search/tweets method
You can search tweets using this method in the 1.1 API. According to those docs, you can pass a q parameter which is "a UTF-8 encoded query of 1000 characters maximum".
The query for your specific requirements
Scroll down on this page and you'll see that you can search for a specific hashtag using #hashtag. Yes, that's it.
How can I make V1.1 requests using OAuth?
Follow the detailed step-by-step post here, using this library to make authenticated requests.
I need to search images from a certain hashtag in twitter to my iOS 6 app. I am trying to code a query that retrieves a minimal size possible response.
So, I tried to use Twitpic, but the response is not good. it's outdated and incomplete. So, I went to the Twitter 1.0 API. The 1.1 is not good because it require user account in Twitter and a lot of my users don´t have it.
http://search.twitter.com/search.json?q=%23hashtag%20pic.twitter.com&rpp=100&include_entities=true&result_type=recent
Does have a better way to query images from twitter api? I only need the image urls, not the entire entities.
As Twitter and Instagram respond a big JSON, I decided to implement the logic in a server using PHP. My client send the hashtag and the server retrieve the image´s urls and send them this parameters and the next "page_id" from twitter and facebook.
It made the operation faster and more future friendly to my apps, besides avoid some "bad images".