• Purchasing a license grants permission to use the software and to get Tech Support. A license purchase doesn't grant customization support.

Version 3.0 API

laaabaseball

Founder license
License owner
I know Rodolfo has it on the Roadmap for a future version of 3, but has anyone created a simple API yet?

Just looking for a simple guest upload to hold me over, as I use my site to post images to Twitter.
 

Baraka

Founder license
License owner
Upon 3.0's API there currently is one embedded. At the current time there isn't documentation on it but the API is very simple for the time being, if you would like to use the API all you would use is /json (http://www.yoursite.com/json) and call in the parameter switches. Currently yes, both guest uploading and logged in sessions are able to upload through the API. In this case the parameter you would use is "?action=upload&source=" (http://www.yoursite.com/json/?action=upload&source=) the "source=" is where the remote url would be such as "?action=upload&source=http://www.google.com/images/logo.png". So pretty much remote url's work. There is more actions that are listed as well for like getting users you would do "?action=list&list=users" <- that will obtain all the users you can also get users from a specific page with adding on "&page=1" (?action=list&list=users&page=1), you can get list of images and even albums as well. But if you wanted to say upload files other thing http:// request then you can do something like this ($_POST)

Code:
<form action="http://www.yoursite.com/json/?" method="post" enctype="multipart/form-data">
        <label for="source">Filename:</label>
        <input type="hidden" name="action" value="upload"> <!-- This action is called first as the case in the API is looking for an action therefore it will append to ? when submitted--!>
        <input type="file" name="source" id="source"><br><!-- Important that the name is source cause in the API its determining whether or not the source is a $_REQUEST or a $_FILE-->
        <input type="hidden" name="type" value="file"> <!-- Type is also needed same following statement above source --!>
        <input type="submit" name="submit" value="Submit">
</form>
So on and so on.. There is more in the API which i am not going to go all over but hope this helps probably soon i'll make some Chrome Addon or something (not sure but yeah ;) )
-Baraka
 

laaabaseball

Founder license
License owner
here's an API.php file you can use to fetch the viewer URL it created. Just create an api.php in your / directory

http://website.com/api.php?format=url_viewer&url=http://i.imgur.com/aqmFnNY.gif

is how you use it.

Code:
<?php
$url = ( isset( $_REQUEST['url'] ) ? $_REQUEST['url'] : null );
$format = ( isset( $_REQUEST['format'] ) ? $_REQUEST['format'] : null );
$str = file_get_contents('http://website.com/json/?action=upload&source=' . $url );
$json = json_decode($str);
echo $json->image->$format;
?>

I'm sure there's a better way to do this, but whatever
 

bubbl3

Founder license
License owner
A proper chrome addon would be nice if it can work with registered users.
 

jiajieit

Founder license
License owner
Hope to be able to add multi language or open source let the webmaster to translation in api3.0 client.
 

bubbl3

Founder license
License owner
My users are complaining for the lack of a browser extension since I upgraded to v3. Probably my bad since i did not check about the API, but hey who can imagine such a big feature would have been cut...

Anyone found a solution yet?
 

Baraka

Founder license
License owner
My users are complaining for the lack of a browser extension since I upgraded to v3. Probably my bad since i did not check about the API, but hey who can imagine such a big feature would have been cut...

Anyone found a solution yet?
Could you elaborate on what you mean for a solution, because there is an API which i have talked about it above in this thread (http://chevereto.com/community/threads/version-3-0-api.4250/#post-24529)
There is still features yet to be added and they can be added upon any 3.x release from what Rodolfo stated. Also i am in the works making a Chrome Extension/App. No e.a on it but i am just exploring the full extent of the 3.0 release :)
 

bubbl3

Founder license
License owner
Could you elaborate on what you mean for a solution, because there is an API which i have talked about it above in this thread (http://chevereto.com/community/threads/version-3-0-api.4250/#post-24529)
There is still features yet to be added and they can be added upon any 3.x release from what Rodolfo stated. Also i am in the works making a Chrome Extension/App. No e.a on it but i am just exploring the full extent of the 3.0 release :)
Mainly I am talking about the browser extension, I am not a noob but not a good coder, so atm there is no simple solution for a browser extension. I was of the idea it would be easy to manually modify the existing ones and that the API would have been kept similar in functionality.
 

Baraka

Founder license
License owner
Mainly I am talking about the browser extension, I am not a noob but not a good coder, so atm there is no simple solution for a browser extension. I was of the idea it would be easy to manually modify the existing ones and that the API would have been kept similar in functionality.
Ahh i see, i can understand that fully, well from playing around, i did manage to get things working with the current API state, its just really the matter on the things you want to have/use an extension for. From the little example i put up above just that little bit can get anyone started in how to process really anything from PUT,GET,DELETE. I agree, it might seem there isn't much of a way to make it work with registered users for an extensions use, but i have found something that i can get it to work but it would be best if the API had OAuth in it which would make development even easier but that is up to Rodolfo if he decides to implement that functionality i could do it no problem but who knows at anytime of a 3.x release things can change. There is a lot to expect and really the API's current state is really enough but if you think about it from the 2.x release the API was the same having in "api?&key=&format=redirect&upload=" its really the same case for 3.0's one from the example i gave "?action=upload&source=&type=file" as long as the posted image is a valid image it would no question work, so that might just help you out :) But anyhow i hope this helps , as to my extension i am still tinkering around with it, there lots to be done but again its more of me exploring its extent.... (some input from Rodolfo @ line 2. http://chevereto.com/community/threads/webmaster-questions.4345/#post-24848)
 
Last edited:

bubbl3

Founder license
License owner
My site is for private use, no profit and no external adv, so I do need an eventual extension to support registered users.
To be honest I see the lack of an easy way to implement this as quite the drawback in v3.
 

Rodolfo

Chevereto Developer
Chevereto Staff
API will be added when the development gets to a more mature stage. You don't notice it but APIs opens things that could jeopardize your site. If you have closely follow all the REST implementations over the years many things has changed and that is because APIs needs heavy restrictions and security to don't cause trouble.
 

Baraka

Founder license
License owner
API will be added when the development gets to a more mature stage. You don't notice it but APIs opens things that could jeopardize your site. If you have closely follow all the REST implementations over the years many things has changed and that is because APIs needs heavy restrictions and security to don't cause trouble.
Awesome to hear, looking forward upon that figured that would come to light :) I guess for now i'll hold off making an extension( just a little preview >.> to show what i am doing )


 

bubbl3

Founder license
License owner
There is any way to downgrade to 2.x then? My users are now using a different site due to the lack of browser extensions...
 

Baraka

Founder license
License owner
There is any way to downgrade to 2.x then? My users are now using a different site due to the lack of browser extensions...
Well if you're asking to downgrade from 3.0 to 2.x i don't think so, but if you are asking on for downgrading your extension well anything is possible, I know you said you're not a good coder but you can use the current "API" with your 2.x extension. Thing is i don't know how your extensions' source code, nor don't have it in front of me to really to determine that for you. So really without that I can't say....
 

bubbl3

Founder license
License owner
Well if you're asking to downgrade from 3.0 to 2.x i don't think so, but if you are asking on for downgrading your extension well anything is possible, I know you said you're not a good coder but you can use the current "API" with your 2.x extension. Thing is i don't know how your extensions' source code, nor don't have it in front of me to really to determine that for you. So really without that I can't say....
I did have the standard chrome and firefox extensions available here, links for you:
http://old.tpspic.me/TPSPIC_upload-1.0.0.xpi
http://old.tpspic.me/TPSPIC_upload-1.0.0.crx
I also had the AUS mod installed and Lautaro helped me to modify the API so that it would upload under the logged in user account through the extension.
 

Rodolfo

Chevereto Developer
Chevereto Staff
Please note: Since Chevereto 3.1.1 the system has protection against unintended requests (known as csrf attacks). Use /json as your API won't work at all.
 

bubbl3

Founder license
License owner
Please note: Since Chevereto 3.1.1 the system has protection against unintended requests (known as csrf attacks). Use /json as your API won't work at all.
So unless you create a new API we are screwed. Are the blocked requests only remote ones, or it include local ones (like made with a local php script).
 
Top