Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic setup #52

Open
sollidius opened this issue Apr 8, 2015 · 10 comments
Open

Basic setup #52

sollidius opened this issue Apr 8, 2015 · 10 comments

Comments

@sollidius
Copy link

Hey tumblr,

Could you explain the "basic usage" a little bit more?
eg: 'The first step is setting up a Client:'
In what file should we add this? Create an index.php ? and include all other files or?

I'm a little bit confused.

Thanks for replying

@free-ghz
Copy link

i agree!

@tiagogon
Copy link

tiagogon commented Aug 2, 2015

i agree.

@markl181
Copy link

Here's what I did if it helps

  1. Download Tumblr API files and place them in the root of your project
  2. Get a consumer key and secret by registering your application [https://www.tumblr.com/oauth/apps]
  3. Go to https://api.tumblr.com/console/calls/user/info and enter these to get your oauth token and token secret
  4. Ensure you have oauth downloaded (I used [https://github.com/EHER/OAuth/tree/master/src/Eher/OAuth]) and put it in the API folder
  5. Install composer (I used homebrew to do this)
  6. Ensure you have composer.phar and vendor/autoload.php in the root of your project
  7. Create a php file with your $consumerKey, $consumerSecret, $token and $tokenSecret all set as above.
  8. Include vendor/autoload.php, /lib/Tumblr/API/Eher/OAuth/Token.php and /lib/Tumblr/API/Client.php
  9. $client = new Tumblr\API\Client($consumerKey,$consumerSecret,$token,$tokenSecret);

The structure of the returned information doesn't appear to be documented anywhere from what I can tell, so you will probably need to do some digging.

@markl181
Copy link

Also if this helps, basic demo of the getBlogPosts method (obviously this example is not very useful just intended for illustration)

$url = 'yoururl';
$posts = $client->getBlogPosts($url, ['type'=>'text', 'notes_info'=>'true']);

foreach ($posts->posts as $post)
{

foreach ($post->notes as $noteAr)
{

    echo $noteAr->type;

}

}

@Clararigaud
Copy link

Thanks a lot @markl181 !
The structure of the response can be found in the API console by hitting "example output"

@eQX8HNMTU2
Copy link

@markl181
Is there a way to use the api without installing any composer software or anything. Just downloading the files?
I want a quick reply please

@ceyko
Copy link
Contributor

ceyko commented Oct 18, 2017

@AndiHamolli You don't need to have composer on the server your using it on, but it will be a lot easier if you get composer on your local computer first.

Then make a new directory and composer require tumblr/tumblr, which will populate vendor/. You can then copy that vendor director anywhere and after a require_once 'vendor/autoload.php'; in another php file, you'll be able to use, e.g., Tumblr\API\Client.

If you can't even use composer locally, it's going to be more difficult. You'd need to collect all the dependencies manually.

@eQX8HNMTU2
Copy link

@ceyko
I am telling you, I still have win xp :D, on the laptop i'm currently using. Installing software is nearly impossible. I need just some simple php lib I can download and modify und upload on the server.

@sollidius
Copy link
Author

Depending on the use you could just call the Tumblr API with your API key in the URL.
eg:

This is how I intially coded stuff back in the day @AndiHamolli
Works perfect if you just need to read data. For posting stuff and updating stuff etc you'll need the Oauth solution.

@eQX8HNMTU2
Copy link

eQX8HNMTU2 commented Oct 19, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants