Have been searching high and low and cannot find any relevant answer on this. I was wondering if anyone has come across the Tumblr API v2 call that will let you access data from a private blog. I would like to post and retrieve listings from some of my private blogs while providing authentication of course.
Thank you
Using correct OAuth calls to the API, with an access Token for a private blog, it is possible to access at least some of that private blog's information with the Tumblr API v2.
Here are some observations I have made:
api.tumblr.com/v2/blog/{base-hostname}/posts
Normally you make this call with your Public API Key, and that allows you to access the posts of any Tumblr that is not private.
However! Good news: If you include the full OAuth headers when making this request, it will return the list of posts of a Private Tumblr account. You need an access Token for that Tumblr, of course, to do this. Yes, I have tried this, done this, and it works.
If you only use your consumer API key, e.g.
api.tumblr.com/v2/blog/{base-hostname}/posts?api_key=w8878374r384r...
Then you will get nothing. You have to make a fully-authenticated request with all of the proper OAuth parameters.
api.tumblr.com/v2/blog/{base-hostname}/info
Will not work at all for a private blog, even when using all the proper OAuth stuff to make the API call.
api.tumblr.com/v2/user/info
Normally this returns a list of "blogs" for the given authenticated user. However, any private tumblrs will not show up in this list of blogs.
Note:
I have not tested many of the other API calls with private blogs, so I cannot tell you for sure if creating/editing/removing posts works or not.
I have not tested this at all with xAuth, only regular OAuth and a standard access Token obtained through the "web authorization flow"
$conskey = "CONSUMER KEY";
$conssec = "CONSUMER SECRET";
$tumblr_blog = "myblog.tumblr.com";
$to_be_posted = "This is the text to be posted";
$oauth = new OAuth($conskey,$conssec);
$oauth->fetch("http://api.tumblr.com/v2/blog/".$tumblr_blog."/post", array('type'=>'text', 'body'=>$to_be_posted), OAUTH_HTTP_METHOD_POST);
$result = json_decode($oauth->getLastResponse());
if($result->meta->status == 200){
echo 'Success!';
}
Try the code above to post to your blog using API.
Hope that helps.
Related
I am using Instagram API for my application. I need access to the feed of private users whom I am following, but the response is:
code: 400
error_type: APINotAllowedError
error_message: you cannot view this resource
I could not find anything in the documentation regarding this.
I was hoping that as I am able to see the user's feed on my app, I would be able to retrieve the same using the API.
Any way around this?
Please help.
[As instagram changes their api, this tips may not work forever]
I faced same issue and the cause is it happens when the posts are private , even if user access token is passed with endpoints this errors happen.
Solution: just in place of userid use 'self' for private profile. means if a profile has private posts then who connects should be the same person of the profile and other person can not view his/her posts.
Example:
https://api.instagram.com/v1/users/USER_ID/media/recent/?access_token=USER_ACCESS_TOKEN_HERE if this endpoints shows error then use
https://api.instagram.com/v1/users/self/media/recent/?access_token=USER_ACCESS_TOKEN_HERE
(just replace 'userid' with 'self')
I want to read google calendars through oauth credentials for my desktop application.
I am done with following things
registered with google api console
got client id ,client secret key
Now as I was looking for some examples,which tells me that
this can be achieved with dot net framework 4.0 with google calendar api v3.
But for some reasons i need to stick to dot net framework 2.0.
So how i can achieve this?
I am done with reading calendars with username and password but now need to read through oauth.
And As I was able to read contacts by oauth I am sure there will be some way to do this for calendars.
Code for conatcts :
RequestSettings ObjectRequestSetting= new RequestSettings("appname",
"consumerkey", "consumersecretkey", "user", "domain");
ContactsRequest objContactReq = new ContactsRequest(ObjectRequestSetting);
ContactsService objService = new ContactsService("appname");
To connect to OAuth2 with out using googles client librarys is a little tricky but it can be done. I normaly use this method becouse i dont like having to release third party dll's with my applications.
The first thing you need is to build the URL that will get you the AutenticationCode.
public static Uri GetAutenticationURI(Autentication MyAutentication)
{
List postData = new List();
postData.Add("client_id=<strong>{Client ID}</strong>");
postData.Add("redirect_uri=<strong>{Redirect URI}</strong>");
postData.Add("scope=<strong>{Scope}</strong>" );
postData.Add("response_type=code");
return new Uri("https://accounts.google.com/o/oauth2/auth" + "?" + string.Join("&", postData.ToArray()));
}
The URI it returns should look something like this https://accounts.google.com/o/oauth2/auth?client_id=.apps.googleusercontent.com&redirect_uri=urn:ietf:wg:oauth:2.0:oob&scope=https://www.googleapis.com/auth/calendar.readonly&access_type=offline&approval_prompt=force&response_type=code
You need to have a webbrowser control on your form someplace. Where ever you want to call it do something like this. It will open the screen for the user to authorise your aplication.
wbAuthenticate.Url = Autentication.GetAutenticationURI(myAutentication);
When the wbAuthenticate_DocumentCompleted returns you need to rip the Autentication code out of the body of HTML. Don't bother trying to rip it from the title this isn't always corect.
Once you have an AutenticationCode you need to exchange it for a refreshtoken and a accesstoken. The access token is the one you use for all your calls to the API. You use the refreshtoken to get a new access token back after it expires which is normaly in an hour. The only thing you need to save for next time is the RefreshToken.
I have code for all that in a blog post but its pritty big and i'm not sure about spaming that amount of code here. http://daimto.com/google-api-and-oath2/
Trying to obtain blog followers using Tumblr's API and RESTConsole in Chrome (not building an app, just want to check a request response).
I'm new to Tumblr's API and to RESTConsole, so two sources of possible error here.
I've already ...
Registered an app on Tumblr, receiving OAuth Consumer Key and Secret Key in the process.
Entered into REST Console my target: http://api.tumblr.com/v2/blog/{blogname}.tumblr.com/followers
Entered into REST Console's "Setup oAuth" window my OAuth Consumer Key and Secret Key, along with Tumblr's Request Token URL, Access Token URL and Authorize URL.
Approved read/write access to my application when prompted by Tumblr.
Entered the provided Token Key and Token Secret into REST Console's oAuth window.
When I attempt GET requests for follower counts (on my own blog or others'), Tumblr returns 401, "Not Authorized." My blog's preferences page lists the application I'm trying to use as having access.
I've tried this placing base-hostname:{blogname}.tumblr.com in REST Console's request parameters fields; I receive the same error. I tried running a different OAuth method from Tumblr's API (queued posts) and receive the same error.
Help?
Thanks. Let me know if this isn't clear.
Edit: Sorry, meant to add -- I think I may need Oauth Verifier. I haven't been able to find this token, or understand how to obtain it.
Edit (2): So, turns out Tumblr's API needs a comma separator from the REST Console. Thanks all.
''
Zack
$conskey = "CONSUMER KEY";
$conssec = "CONSUMER SECRET";
$tumblr_blog = "myblog.tumblr.com";
$to_be_posted = "This is the text to be posted";
$oauth = new OAuth($conskey,$conssec);
$oauth->fetch("http://api.tumblr.com/v2/user/following", array('offset'=>0) ,OAUTH_HTTP_METHOD_GET);
$result = json_decode($oauth->getLastResponse());
foreach($result->response->blogs as $key){
echo $key->url;
}
The code above will retrieve your followers list.
Hope this helps.
maybe I am not understanding the OAuth flow correctly, but this is what I want to be able to do: I have a service that will issue request to Trello's API, so, in order to perform some of the requests, I need to have a access token.
Is this even possible? I know that you can do this with other services, like Twitter, but I don't know if I can do this against Trello.
I am using NodeJS with a library called oauth to do this, and my flow looks like this: I created a new OAuth object, call getOAuthRequestToken and then I call getOAuthAccessToken in the callback, and is there where I get an 500 error saying that the oauth_verifier is missing.
Here the piece of code I am talking about:
var OAuth = require('oauth').OAuth,
oauth = new OAuth('https://trello.com/1/OAuthGetRequestToken?key=' + config.key,
'https://trello.com/1/OAuthGetAccessToken',
config.key,
config.secret,
'1.0',
null,
'PLAINTEXT');
oauth.getOAuthRequestToken(function(error, oauth_token, oauth_secret, results){
//Here I have some error handling code
oauth.getOAuthAccessToken(oauth_token, oauth_secret,
function(error, oauth_access_token, oauth_access_token_secret, access_results){
//Here I would be storing the access token for later, etc.
}
});
So, obviously, I am not passing the oauth_verifier parameter to the getOAuthAccessToken method (I checked in the code and that function is expecting the verifier as third parameter), but I am not doing it because I do not have it: the results object is empty and I do not know how to get it programmatically.
Another thing to notice is that I am passing the key parameter in the request token url and using plaintext as signature because I just thought that would be the right thing to do (I haven't see any reference in the documentation about what kind of signature to use or if I need to pass the key as a parameter).
Am I doing things really wrong? Am I in the correct track? what am I missing?
As always, thanks in advance! =)
Trello docs don't say much about oAuth.
I'd speculate that the issue would be that Trello is oAuth 2.0 (used by Facebook, Google) and you're using the oAuth 1.0 scheme (used by Twitter, Tumblr).
For what it's worth, the node-oauth library has an oAuth2 implementation in its lib directory you can include via require in node.js.
Any idea about how to post on our Google+ Stream using javascript or json?
I'm not searching how to use the google+ button, I need to post on the wall(or stream)
The (recently announced) Google+ API currently provides read-only access to public data. All API calls require either an OAuth 2.0 token or an API key.
Here's some information to help you get started.
http://googleplusplatform.blogspot.com/2011/09/getting-started-on-google-api.html
http://developers.google.com/+/
These two urls do what you want, but need a confirmation from the user:
https://m.google.com/app/plus/x/?v=compose&content=YOUR_TEXT
https://plus.google.com/share?url=YOUR_URL_HERE
No public API is available, so just register for the private API and check for yourself
https://services.google.com/fb/forms/plusdevelopers/
EDIT: The API is available now:
https://developers.google.com/+/
That's the downside of the Google Plus...
See here: http://code.google.com/p/google-plus-platform/issues/detail?id=41