Login   Register  
PHP Classes
elePHPant
Icontem

Cannot reblog a tumblr post

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      PHP OAuth API  >  All threads  >  Cannot reblog a tumblr post  >  (Un) Subscribe thread alerts  
Subject:Cannot reblog a tumblr post
Summary:I get a HTTP 402 error trying to make a reblog
Messages:9
Author:Nico Zerpa
Date:2013-01-18 16:14:16
Update:2013-04-02 09:22:55
 

  1. Cannot reblog a tumblr post   Reply   Report abuse  
Picture of Nico Zerpa
Nico Zerpa
2013-01-18 16:14:17
Hello! I am using your OAuth API to integrate my website with Tumblr. Unfortunately, I cannot reblog any post, I always get a 401/Not Authorized error in the response.

This is the code:


/////////////////////
$oauth = new oauth_client_class();
$oauth->debug = true;
$oauth->server = 'Tumblr';
$oauth->client_id = Configure::read('tumblr_app_id');
$oauth->client_secret = Configure::read('tumblr_app_secret');
$oauth->Initialize();

if($oauth->Process()) {
$post_id = 40683854239;
$post_reblog_key = 'etDEKiko';

$params = array(
'id' => $post_id,
'reblog_key' => $post_reblog_key
);

$success = $oauth->CallAPI(
'http://api.tumblr.com/v2/blog/nicolas-vnstudios.tumblr.com/post/reblog',
'POST',
$params,
array('FailOnAccessError' => false),
$response
);
var_dump($success);
var_dump($response);

///////////////

However, when I use CallAPI to like a post, it works fine:

//////////
$response = array();
$success = $oauth->CallAPI(
'http://api.tumblr.com/v2/user/like',
'POST',
$params,
array('FailOnAccessError' => false),
$response
);
var_dump($success);
var_dump($response);

///////////////////


Do you know why isn't it working? Am I doing something wrong?
Thanks in advance.

  2. Re: Cannot reblog a tumblr post   Reply   Report abuse  
Picture of Manuel Lemos
Manuel Lemos
2013-01-19 04:35:05 - In reply to message 1 from Nico Zerpa
I was able to reblog that article successfully with this code.

$success = $client->CallAPI(
'http://api.tumblr.com/v2/blog/mallemos.tumblr.com/post/reblog',
'POST', array('id'=>'40683854239', 'reblog_key' => 'etDEKiko'),
array('FailOnAccessError'=>true), $reblog);

Are you using the latest version of the class?

  3. Re: Cannot reblog a tumblr post   Reply   Report abuse  
Picture of comp
comp
2013-03-29 17:28:52 - In reply to message 2 from Manuel Lemos
Hello Manuel! Your library is very usefull and just great! Thank you very much for it!
I also have a similar problem like Nico Zerpa does. All the tumblr's functionality works fine for me (like, follow, info, etc.), but each time when I try to use /post/reblog I have the same 401 error. I think this is not an issue of your lib, but just issue of Tumblr.
I am using the last version of your lib, also I tried to use your example

$success = $client->CallAPI(
'http://api.tumblr.com/v2/blog/mallemos.tumblr.com/post/reblog',
'POST', array('id'=>'40683854239', 'reblog_key' => 'etDEKiko'),
array('FailOnAccessError'=>true), $reblog);
but I have the same 401 error (Not Authorized).
Can you please help me (maybe you have a bigger experience with the Tumblr then I)?
Thank you in advance!

  4. Re: Cannot reblog a tumblr post   Reply   Report abuse  
Picture of Manuel Lemos
Manuel Lemos
2013-03-30 02:45:29 - In reply to message 3 from comp
I have tried it over and over again and it works flawlessly.

The only thing I can think is that you are calling the CallAPI function separately and the access_token_secret is not really set to a token secret value previously obtained from the server.

  5. Re: Cannot reblog a tumblr post   Reply   Report abuse  
Picture of comp
comp
2013-03-30 12:42:04 - In reply to message 4 from Manuel Lemos
Manuel, thank you for your answer. I have checked the script one more time, the "reblog" functionality works only for my own page, so I can reblog my own posts but I can't make it for other blogs. I think that this is the Tumblr's issue, because in web interface (directly on "any_name_of_blog".tumblr.com I can reblog any post and can't via API).

  6. Re: Cannot reblog a tumblr post   Reply   Report abuse  
Picture of Manuel Lemos
Manuel Lemos
2013-03-30 19:06:01 - In reply to message 5 from comp
I am not sure about that. For me it worked with every page I tried, even from other people.

I also tried putting the incorrect reblog key or page id and it gave error 400, not 401.

It gave me error 401 when I intentionally set the access_token_secret variable to an empty string. So I would check if that variable is correctly set when you call the API.

  7. Re: Cannot reblog a tumblr post   Reply   Report abuse  
Picture of comp
comp
2013-04-01 21:21:49 - In reply to message 6 from Manuel Lemos
Hello again, Manuel. I have tried to do like you mentioned, but nothing helps me. Can you please send me (if possible) the complete example (all the php code, all php files, include library) as zip-archive or so for me to test it on my side. Thank you in advance!

  8. Re: Cannot reblog a tumblr post   Reply   Report abuse  
Picture of Manuel Lemos
Manuel Lemos
2013-04-01 22:00:28 - In reply to message 7 from comp
The example is the same as the one provided with the class. The only difference is that I send an API call to the reblog API URL.

When the user authorizes API access, the class retrieves two values in the access_token and access_token_secret variables. Do not confuse these two values with the client_id and client_secret values.

You need both of these values to send API calls. When the user is not present, you can still send API calls as long as you initialize those variables with the previously obtained values.

Your problem seems that you may be setting the access_token but probably not access_token_secret. That is a common cause for error 401.

  9. Re: Cannot reblog a tumblr post   Reply   Report abuse  
Picture of comp
comp
2013-04-02 09:22:55 - In reply to message 8 from Manuel Lemos
Thank you Manueal one more time, I will try.