Twitter api request - twitter

I have read the documentation of twitter , and created an app and have all the keys needed .
Now i am trying to understand that simple one line http request ,to get a user latest twits .
I have read this Simplest PHP example for retrieving user_timeline with Twitter API version 1.1
but there is not one line code in there to make the request ( i don't know java script).
so , i have this :
https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=twitterapi&count=2
Which will not work because my keys should be in this line, but i don't understand how to add them?? where and how i add my keys to this ?

This url is like a node or address so twitter server knows what kind of request you need.
https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=twitterapi&count=2
Beside url you can pass many other parameter using http header, which is best to be used with server langunge programming, e.g PHP.
In PHP you can pass your credentials by changing header. While current twitter API are using Oauth, it's going to difficult to learn using Oauth this way, the easiest option is to use others' library. Check out 'twitter API library' (just google it)

Related

Parse.com REST API authentication

Parse.com's REST API docs (https://www.parse.com/docs/rest) say: Authentication is done via HTTP headers. The X-Parse-Application-Id header identifies which application you are accessing, and the X-Parse-REST-API-Key header authenticates the endpoint. In the examples with curl that follow, the headers are stored in shell variables APPLICATION_ID and REST_API_KEY, so to follow along in the terminal, export these variables.
I am building a Sencha Touch app as a native app on iOS and Android using Phonegap, and I was wondering whether it is secure to expose these keys to the client while making the REST calls?
Also, can someone explain to me how does security work in this scenario? Help is much appreciated! Thanks!
Without phonegap , in a proguard , post processed android apk , the string values of the 2 headers you mention are exposed client-side . not a big issue. TLS covers the http header values during network leg and far more important for app security, you have Full ACL at the DB row level(parse/mongo) contingent on permissions of 'current user()'. So with no access to logon, some outsider doesn't have any more than obfuscated string value to an app-level access token.
. One odd thing is that with parse the lease time on the client-side token value foapi key is permanent rather than say a month.
Parse REST security is robust n well executed.
Can't speak to what PG framework offers in obfuscate/minify/uglify area but you should check that.

Its possible to set fields values of a site and submit then with a Programing Language?

I have this site:
https://acad.unoesc.edu.br/academico/login.jsp
And I want to put info in the fields values and submit then, to get the next page and navigate in that site. Thats because I want to create an android app or something like that. Im using lua in first case, with luasocket(http).
I know that the input has its names, but I dont know how to set then and send then to the server. If someone can help me with this.
Thank you.
You can use POST method with luasocket. See the official documentation and a detailed example in this SO answer.
Since you seem to be doing authentication, you'll probably need to save the cookie value returned to you as part of the login response and then pass that cookie back to the server (otherwise your subsequent requests will fail as the server will reject those requests as non-authenticated).
Since you are sending this over https, you'll need to use LuaSec, which provides ssl.https module as replacement for the http module that luasocket provides. You may check my blog post for some example of how this can be done.

Get tweets for a specific user V1.1

I'm not really sure where to begin with this.
Prior to the upgrade to version 1.1 of the API I was able to request tweets in XML format using
$url = 'http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=' . $TWITTER_USERNAME;
A couple of things have changed, the return format is now JSON which isn't a problem but I'm not sure how to authenticate my app to request the tweets in JSON format.
I've read this link but am unsure how I'm supposed to implement it.
For instance, where do I get the consumer secret from ?
How do I request a bearer token in PHP ?
Any pointers would be great
you need to use plugin that is written for v1.1, In new version they have added security layer so you need to be authorized in order to get the tweets via API, here are the links that will be helpful for you
http://www.webdevdoor.com/php/authenticating-twitter-feed-timeline-oauth/ http://www.fullondesign.co.uk/coding/2516-how-use-twitter-oauth-1-1-javascriptjquery.htm

How to get results with twitter search api?

I wish to get tweets with a keyword. But There is no result with any keyword.
http://search.twitter.com/search.json?q=summer
How to get results with Twitter Search API?
Version 1 of the twitter API has been deprecated and is being removed. Not sure how you can miss the giant warnings on the twitter dev site ;) This means simple code like the above will not work any more.
So, you now need to make authenticated requests (OAuth) using the 1.1 API, and it's nowhere near as simple as just doing a (in PHP) file_get_contents(http://search.twitter.com/ ...).
I couldn't see any server-side languages you use from your profile, but I wrote a lengthy post explaining the issue (with pictures) and how to use a php library to perform authenticated requests.

yelp error :MISSING_PARAMETER

I am new to yelp API. I am using version2. I did sign up for API access and got, Consumer Key,Consumer secret, token, token_secret, then I used to the following link
http://api.yelp.com/v2/search?http://api.yelp.com/v2/search?term=food&location=San%2BFrancisco&oauth_consumer_key=SOMEKEY&oauth_consumer_secret=SOMESECRET&oauth_token=SOMETOKEN&oauth_token_secret=SOMESECRET
to get the data but then I get a series of MISSING_PARAMETER errors. For signature_method I used HMAC-SHA1 but for the rest (oauth_signature, oauth_nonce, oauth_timestamp) I iddn't know what to put, so i used an empty field but then I got "INVALID CREDENTIAL" error. How do I get these missing fields?
They are not in my API access page.
First of all you can't publish your keys like that, you need to run a script to "encrypt" them and once you "send" those keys you handshake with yelp and than make a query for the search you are trying to get results for.
Basically you need a script in your preferred language (PHP for example) to make the query. a good start might be https://github.com/Yelp/yelp-api/tree/master/v2

Resources