So I want to tweet on Twitter by sending a POST request to the Twitter API.
I have not found a simple way to do this (unless I use a wrapper), and I'm not too experienced with Lua.
This is Twitter's own example using curl:
$ curl --request POST
--url 'https://api.twitter.com/1.1/statuses/update.json?
status=Test%20tweet%20using%20the%20POST%20statuses%2Fupdate%20endpoint'
--header 'authorization: OAuth oauth_consumer_key="YOUR_CONSUMER_KEY",
oauth_nonce="AUTO_GENERATED_NONCE", oauth_signature="AUTO_GENERATED_SIGNATURE",
oauth_signature_method="HMAC-SHA1", oauth_timestamp="AUTO_GENERATED_TIMESTAMP",
oauth_token="USERS_ACCESS_TOKEN", oauth_version="1.0"'
--header 'content-type: application/json'
But from some wrappers I've seen, it seems that you can use:
consumer_key
consumer_secret
access_token
access_token_secret
I just want a simple way of tweeting without being able to have all of the other API functionality that the Twitter API has. So no wrapper or anything. Just a simple script, but I can't seem to figure it out. Any help is greatly appreciated.
Use a specialized Lua library for Twitter, e.g. https://github.com/leafo/lua-twitter
luarocks install https://luarocks.org/manifests/leafo/twitter-dev-1.rockspec
or a more general Lua library for OAuth, e.g. https://github.com/ignacio/LuaOAuth and do the rest yourself.
Related
I first asked this question over at https://community.auth0.com/, but
re-iterating here to reach a wider audience,
https://community.auth0.com/t/machine-to-machine-dynamic-application-registration/96639
I'm wondering, how can I specify a dynamically created client as type Machine-to-Machine (for use with an API) at creation time? My high-level goal is to allow developers the ability to create their own applications, then use the client credentials flow to access information via a resource server, as per OIDC spec.
Seems like every approach requires me to manually update a "Generic" dynamic application. For instance, I can do something like
curl --request POST \
--url 'https://<tenant>.us.auth0.com/oidc/register' \
--header 'content-type: application/json' \
--data '{"client_name":"My Dynamic Application","redirect_uris": ["https://application.example.com/callback", "https://application.example.com/callback2"] }'
But then it defaults My Dynamic Application to type "Generic". Ideally, i'd like to specify something like { "app_type": "m2m" }, and be able to "extend" the functionality of the oidc/register endpoint.
How can I contribute and UPLOAD PWS data to wunderground.com? Is there an API documentation available out there?
I found an API showing how to RETRIEVE data from the PWSs:
https://weather.com/swagger-docs/call-for-code
curl -X GET "https://api.weather.com/v2/pws/observations/current?stationId=KMAHANOV10&format=json&units=m&apiKey=adsf" -H "accept: application/json" -H "Accept-Encoding: gzip"
From asking Dr Google I also found:
https://weatherstation.wunderground.com/weatherstation/updateweatherstation.php?QUERY_PARAMS
Is that the place to make data available? But where is an API doc available?
see https://feedback.weather.com/customer/en/portal/articles/2924682-pws-upload-protocol?b_id=17298 - important is the parameter b_id, thanks to Google having it in the index.
I am new to ruby want to create an api which post tweet to twitter without help of any gem include as we did on command line by running below code:
curl --request 'POST' 'https://api.twitter.com/1.1/statuses/update.json' --data 'status=Maybe+he%27ll+finally+find+his+keys.+%23peterfalk' --header 'Authorization: OAuth oauth_consumer_key="i6baQCTt1sCXAo8YWcKhuly9Z", oauth_nonce="12f94f3e4b2ded3bbfdfe781de60ae73", oauth_signature="x6%2Fi2w%2F0RjN4prcFmA5HthOZU3Q%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1461568353", oauth_token="2291131736-LpQkfe5diMTung5mVQ0Dc5EKA9u8qnIgWuPqau9", oauth_version="1.0"' --verbose
But in controller how can we use this command so it get ouath_signature and post the tweet.
As In php it did with curl want same way ion ruby.
Please help me to get out of it
You may use rest-client to make your api calls.
Or if you really don't even want to use that gem also.
Try this : http://ruby-doc.org/stdlib-2.3.0/libdoc/net/http/rdoc/Net/HTTP.html
which comes with the ruby standard library
If I understand correctly, you can use:
http://ruby-doc.org/stdlib-2.3.0/libdoc/net/http/rdoc/Net/HTTP.html
Ever since I upgraded to api 1.1, I am unable to search for tweets from multiple users. For example this search-https://api.twitter.com/1.1/search/tweets.json?q=from:commute_by_bike OR from:BikeLeague OR from:peopleforbikes OR from:bikesbelong &count=20 returns zero tweets. This worked previously with the 1.0 api. If I search for just one of these users, I get the corrects results so I know the authentication is working. Any suggestions? thanks.
I've tested the query you post above and using the following curl command (which I got from Twitter's OAuth tool), and I get several tweet results back. Your actual query does work, there is probably just a problem with the formatting somewhere. Retry your query using the OAuth tool to troubleshoot out any formatting problems, then edit your query.
curl --get 'https://api.twitter.com/1.1/search/tweets.json' \
--data 'count=20&q=from%3Acommute_by_bike+OR+from%3ABikeLeague+OR+from%3Apeopleforbikes+OR+from%3Abikesbelong+' \
--header 'Authorization: OAuth oauth_consumer_key="XXXXXXXX", oauth_nonce="XXXXXXXX", oauth_signature="XXXXXXXX", oauth_signature_method="XXXXXXX", oauth_timestamp="XXXXXXXXX", oauth_token="XXXXXXXX", oauth_version="1.0"' --verbose
With the new 1.1 api, I'm searching for a hashtag with the following line of code:
[NSString stringWithFormat:#"https://api.twitter.com/1.1/search/tweets.json?q=%%23%#&result_type=mixed", hashtag]
Where hashtag is an NSString, not containing the #. You need authentication for that, but you mentioned that the authentication works. Good luck!
I want to create a twitter POST request without having the Oauth header
My request will be like
curl --request 'POST' 'https://api.twitter.com/1/statuses/update.json?oauth_signature=IeeuNHBH4bLhwy8w42Z0qbpXvFI%3D&oauth_version=1.0&oauth_nonce=ec2397446398196ff26b1c17a23cfdb6&oauth_signature_method=HMAC-SHA1&oauth_consumer_key=gGrr4khdilkzano8gYxK4Q&oauth_token=146439820-n07FzSB78bDWEUzPPP9WZnwdnwW917FyJi1gwKWM&oauth_timestamp=1341388264'--data 'status=hello+world'
Kindly help me regarding this.
You can't do what you're trying to do.
Those are "GET params".
Try using the -d flag with CURL to send POST body parameters. (It's the same flag as the --data param you're using elsewhere.)