Somebody just asked this via PM.
It's possible, but Facepunch doesn't actually return this data with the rest of the post data, it gets it via an extra AJAX request. I don't want the overhead of making this request on every getposts request, since not everyone wants it, but I can wrap the request and return it in a nice format via a separate call if a few people request it.
[QUOTE=Hexxeh;38858491]Somebody just asked this via PM.
It's possible, but Facepunch doesn't actually return this data with the rest of the post data, it gets it via an extra AJAX request. I don't want the overhead of making this request on every getposts request, since not everyone wants it, but I can wrap the request and return it in a nice format via a separate call if a few people request it.[/QUOTE]
It'd be super awesome if you could do that, I was actually going to request a "getratings" call too!
[QUOTE=Banana Lord.;38858512]It'd be super awesome if you could do that, I was actually going to request a "getratings" call too![/QUOTE]
You can get the ratings of a post using ajax.php but you'l have to filter out all the not so interesting stuff (also I don't know how hexxeh feels about this :S):
[php]
function RatingsList(postid)
{
if ($('#ratingslist_'+postid).length > 0)
{
$('#ratingslist_'+postid).slideToggle('fast');
return false;
}
$.get('ajax.php', {'do': 'rate_list', postid: postid}, function(data){
var x = $('#rating_'+postid).offset().left;
var y = $('#rating_'+postid).offset().top + $('#rating_'+postid).height() + 9;
var div = CreateFloatingDiv(x, y, 'ratingslist_' + postid, 'ratingslist');
//$(div).stop().hide();
div.innerHTML = data.list;
$(div).click(function(){
$(this).slideUp('fast');
});
$(div).slideDown('fast');
}, 'json');
return false;
}[/php]
Example: [url]http://facepunch.com/ajax.php?do=rate_list&postid=38858512[/url]
I'm trying to make an ego watcher using the ticker part of the API. But there is no documentation for the types of events that the getTicker returns.
Is this something that is still a WIP or is it something that devs should just figure out?
I can try to document what I find but it won't be as pretty as a first party documentation.
[QUOTE=Mega1mpact;38863958]I'm trying to make an ego watcher using the ticker part of the API. But there is no documentation for the types of events that the getTicker returns.
Is this something that is still a WIP or is it something that devs should just figure out?
I can try to document what I find but it won't be as pretty as a first party documentation.[/QUOTE]
It's more a case of I just didn't get around to writing documentation. If you want to write it, then I can tidy it up and add it to the main site.
Also a small bug report: The ticker data is in reverse. The stuff that is at the bottom on the website it at the top of the list. Should be an easy fix as far as I know.
EDIT:
I just realized that this is not an issue due to the fact that it is supposed to be parsed that way.
[img]http://i.imgur.com/nREuD.png[/img]
[QUOTE=Mega1mpact;38864220]Also a small bug report: The ticker data is in reverse. The stuff that is at the bottom on the website it at the top of the list. Should be an easy fix as far as I know.
EDIT:
I just realized that this is not an issue due to the fact that it is supposed to be parsed that way.
[img]http://i.imgur.com/nREuD.png[/img][/QUOTE]
Yep, working as expected.
The ticker doesn't tell you if you've been mentioned. It does have a boolean that is called mentioned and it only appears if it's a thread that you've read and is always true. The only way to find out if you've been mentioned is to get the post and try to find out if you've been mentioned.
This can generate a lot of requests that are not really needed. Below is an example:
Mention
{"date":1355753975,"type":"post","username":"Hexxeh","userid":63187,"forum":"Programming","forumid":240,"thread":"Facepunch API","threadid":1162943,"postid":38864385,[b]"mentioned":true[/b],"lastread":"6 minutes ago"}
Read thread
{"date":1355753612,"type":"post","username":"bobiniki","userid":253361,"forum":"Programming","forumid":240,"thread":"What Are You Working On December 2012","threadid":1229762,"postid":38864350,[b]"mentioned":true[/b],"lastread":"14 minutes ago"}
Normal thread
{"date":1355753617,"type":"post","username":"ned_ballad","userid":378913,"forum":"Team Fortress 2","forumid":277,"thread":"Major Update Speculation Thread V10: No Restriction without Representation","threadid":1221466,"postid":38864351}
conclusion:
I don't even
This should be fixed now (can't tell for sure until somebody mentions me again).
[QUOTE=Hexxeh;38864688]This should be fixed now (can't tell for sure until somebody mentions me again).[/QUOTE]
Does it use "mentioned":False if the thread has been read but you weren't mentioned?
Also mention test
No, it'll only have mentioned as true if you were mentioned. The key is omitted completely if you weren't.
I'm done with the documentation. I wrote a simple script that just collects all the variations etc for me (lazy).
The final documentation: [url]http://pastebin.com/jkgnLJDE[/url]
The data that my script collected: [url]http://pastebin.com/T5ySpqsj[/url]
The script (python 2.7): [url]http://pastebin.com/uCb4XGiz[/url]
Heh, neat little script...
I'm wondering why the API is in some semi-official status. If you know FP secrets, couldn't you bug Garry to add code to FP that would be more efficient/accurate running inside vBulletin?
Thinking about push notifications (vB hooks on things for which this would be useful) and the oft-mentioned usergroups in particular. And, hey, if someone even were to write a pull API that directly accesses the vB database and code library, that should run much better too.
[QUOTE=DrTaxi;38922393]I'm wondering why the API is in some semi-official status. If you know FP secrets, couldn't you bug Garry to add code to FP that would be more efficient/accurate running inside vBulletin?
Thinking about push notifications (vB hooks on things for which this would be useful) and the oft-mentioned usergroups in particular. And, hey, if someone even were to write a pull API that directly accesses the vB database and code library, that should run much better too.[/QUOTE]
tl;dr garry doesn't want to modify vBulletin.
[QUOTE=Hexxeh;38923206]tl;dr garry doesn't want to modify vBulletin.[/QUOTE]
He already made an official api though.
[url]http://api.facepunch.com[/url] (this one used to work, idk what happened)
[url]http://api.facepunch.com/API/FORUM/LIST/001/[/url]
[url]http://api.facepunch.com/API/THREAD/LIST/001/?forumid=240&page=1[/url]
[url]http://api.facepunch.com/API/POST/LIST/001/?threadid=1162943&page=1[/url]
Altough he put a disclaimer, "This a lab. Don't rely on anything here staying the same, or even being here tomorrow."
[QUOTE=Jvs;38923282]He already made an official api though.
[url]http://api.facepunch.com[/url] (this one used to work, idk what happened)
[url]http://api.facepunch.com/API/FORUM/LIST/001/[/url]
[url]http://api.facepunch.com/API/THREAD/LIST/001/?forumid=240&page=1[/url]
[url]http://api.facepunch.com/API/POST/LIST/001/?threadid=1162943&page=1[/url]
Altough he put a disclaimer, "This a lab. Don't rely on anything here staying the same, or even being here tomorrow."[/QUOTE]
That's not part of vBulletin, though.
[QUOTE=Jvs;38923282]He already made an official api though.
[url]http://api.facepunch.com[/url] (this one used to work, idk what happened)
[url]http://api.facepunch.com/API/FORUM/LIST/001/[/url]
[url]http://api.facepunch.com/API/THREAD/LIST/001/?forumid=240&page=1[/url]
[url]http://api.facepunch.com/API/POST/LIST/001/?threadid=1162943&page=1[/url]
Altough he put a disclaimer, "This a lab. Don't rely on anything here staying the same, or even being here tomorrow."[/QUOTE]
Oh, cool. I take it he still hasn't made push functionality though?
[QUOTE=Hexxeh;38923517]That's not part of vBulletin, though.[/QUOTE]
It doesn't have to be.
When did you make it so we had to authenticate? I was checking WAYWO and: {"error":"No session for that authentication information, login first to begin a session"}
[QUOTE=jamie1130;38950414]When did you make it so we had to authenticate? I was checking WAYWO and: {"error":"No session for that authentication information, login first to begin a session"}[/QUOTE]
It's always been that way. You might be seeing that because your session expired.
I've been up all night so I'm probably missing it but is there a way of getting a users posts? Would be nice to be able to get all of them
I am trying to make a script that checks the ticker for me but it doesn't show the "mentioned" and "rated" events.
I tried to authorize by opening the ticker like "http://api.facepun.ch/?action=authenticate&username=<username>&password=<passwordmd5>&action=getticker", am I doing anything wrong?
[QUOTE=superstepa;38985643]I am trying to make a script that checks the ticker for me but it doesn't show the "mentioned" and "rated" events.
I tried to authorize by opening the ticker like "http://api.facepun.ch/?action=authenticate&username=<username>&password=<passwordmd5>&action=getticker", am I doing anything wrong?[/QUOTE]
Yup, you call authenticate first and then the action you want:
http://api.facepun.ch/?action=authenticate&username=<username>&password=<passwordmd5>
http://api.facepun.ch/?action=getticker&username=<username>&password=<passwordmd5>
The authenticate calls returns a session ID, you can pass this instead of your username and password for subsequent calls if you like:
http://api.facepun.ch/?action=authenticate&username=<username>&password=<passwordmd5>
http://api.facepun.ch/?action=getticker&session_id-<sessionid>
[QUOTE=Hexxeh;38991002]Yup, you call authenticate first and then the action you want:
http://api.facepun.ch/?action=authenticate&username=<username>&password=<passwordmd5>
http://api.facepun.ch/?action=getticker&username=<username>&password=<passwordmd5>
The authenticate calls returns a session ID, you can pass this instead of your username and password for subsequent calls if you like:
http://api.facepun.ch/?action=authenticate&username=<username>&password=<passwordmd5>
http://api.facepun.ch/?action=getticker&session_id-<sessionid>[/QUOTE]
Thank you so much, it should be working now
[editline]27th December 2012[/editline]
Still doesn't seem to work but that's probably because I messed something up on my end
What's this?
[IMG]http://puu.sh/1GpaM[/IMG]
(the object with only a date, this is from the ticker by the way)
boostar maybe?
[QUOTE=FlashStock;39005629]What's this?
[IMG]http://puu.sh/1GpaM[/IMG]
(the object with only a date, this is from the ticker by the way)[/QUOTE]
That's an unknown event. Stuff like boostar etc.
Also Hexxeh when are you going to implement the documentation and should I make some more documentation for the other functions?
Hexxeh. Since you are already caching ratings does that mean you are storing them in a database? If so PLEASE can we get access to this?
[QUOTE=jamie1130;39008263]Hexxeh. Since you are already caching ratings does that mean you are storing them in a database? If so PLEASE can we get access to this?[/QUOTE]
It's not stored in a format you can search really, it's literally a page for page cache of Facepunch.com with some stuff like ratings fixed up. I store the results we're going to serve, not the page HTML, and then fix it up before serving it out of memory on a subsequent request.
I was working in my spare time over summer on an overhaul that moves the API over to App Engine and caches things on an object level, but it's a big job and I've just not had the time or motivation to work on it.
If anyone's familiar with Datastore (and using it efficiently), Memcache and BeautifulSoup, and wants to help out, then do get in touch.
Sorry, you need to Log In to post a reply to this thread.