Take the 2-minute tour ×
Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. It's 100% free, no registration required.

Bounty Contest:

Build anything using the Soapi.JS JavaScript wrapper and either post the code or a link to a live demo.

When the question gets old enough (7 days I think) I will click 'start a bounty' and offer up 300 points. Add the 50 bonus points that the site tacks on and the answer with the most votes when the bounty expires picks up a cool 350 rep and a link from http://soapi.info.

Use whatever tools and libraries float your boat, jquery, mootools, dojo etc, but interaction with the API must be driven by Soapi.JS.

Good luck and may the most ridiculous app win. ;-)

NOTE Time allowing, I will be happy to answer any questions about the library and help out with code if you get stuck. Simply post an answer describing your problem and any relevant code.

share|improve this question
1  
I was planning on playing with the soapi.js library in the next few days anyway, so this is some added incentive ;) –  Mark Henderson Jun 12 '10 at 7:59
    
Sounds like a challenge to me! I will begin planning something. –  Nathan Osman Jun 12 '10 at 20:00
    
@smark - no worries dude. Now I see. I am going to delete my FRIST! that makes me look like a complete idiot now. thanks for the heads up, we can delete these comments if you like... unless you want to look like you are talking to your self ;p –  Sky Sanders Jun 14 '10 at 17:47
    
@george, 53346 is a question, I can only assume that you are looking for answer your answer - try 53466. soapi.info/code/js/stable/soapi-explore-beta.htm is a good tool for building queries and examining the expected results. –  Sky Sanders Jun 14 '10 at 19:46
    
@george - something to consider: stackapps.com/questions/707/… . r.e. your last question, soapi is a complete and faithful rendering of the so api. If the api exposes a method to do what you are asking then soapi provides a route and parameters to do the same. when in doubt use soapi-explore. –  Sky Sanders Jun 14 '10 at 20:12
    
@George - start an answer and describe what you are trying to do and how you are getting stuck. and please delete all the support comments. comments are not a good place for support dialog as the 'comment' comments get buried. –  Sky Sanders Jun 14 '10 at 22:26
    
@code: Deleted the comments now. –  Nathan Osman Jun 15 '10 at 7:06
    
please don't tag things [library] unless they are actually library entries. This is a contest of some sort. –  Jeff Atwood Aug 15 '10 at 6:15
    
@code: Congrats on the "Most Entries" prize - you deserved it! –  Nathan Osman Aug 15 '10 at 19:07
    
@geo - same to you. –  Sky Sanders Aug 15 '10 at 19:14

3 Answers 3

up vote 5 down vote accepted
+350

Here is my entry. It basically allows you to embed the open-source ads from Meta in your blog, etc.

It is simply a .js file you can include on the page.


My evaluation: Soapi.js is a very intuitive library for JavaScript. And by that, I mean the methods are laid out in a way that you would expect them to be. The whole thing is relatively self-documenting and integrates well with my above-mentioned application. I especially like the fact that API changes don't require a huge code rewrite - only a quick download!

share|improve this answer
    
not that you have much competition but you should probably link to this answer from your announcement and beg for votes here as that will determine who picks up the check when the bounty expires. (I will not click check unless there are not enough votes (3 i think) for the site to pick the winner) –  Sky Sanders Jun 16 '10 at 3:04
1  
@code: Don't let the site pick! If you do, only half the bounty gets awarded. You will just have to pick it yourself. –  Nathan Osman Jun 16 '10 at 3:13
    
ahhh, i did not consider that. looks like i have to pick. good catch –  Sky Sanders Jun 16 '10 at 3:28
    
@code: The bounty ends tomorrow, so please don't forget to accept my answer! –  Nathan Osman Jun 19 '10 at 23:58
    
no worries. i will cut the check @ 0:0:0 mountain time. –  Sky Sanders Jun 20 '10 at 21:12
    
@geo - if you add a brief honest evaluation of soapi.js to this answer i will break all the rules and cut the check early! ;-) –  Sky Sanders Jun 21 '10 at 3:33
    
@code: Sorry, got to this late - I'll write one now. Update: There, wrote one. –  Nathan Osman Jun 21 '10 at 6:21
    
@code: In addition, did you see this page that I also made with Soapi.js? Vote for it here. –  Nathan Osman Jun 21 '10 at 6:38
    
ding ding ding, winna winna big chicken dinna! for the record, now that the heated contest is concluded, this is exactly what I was looking for, a short sweet app written in a matter of hours leveraging the library. thanks for playing geo. r.e. votes-done and done. –  Sky Sanders Jun 21 '10 at 7:21
    
btw, @code, the bounty system has changed and now you have to click 350 button on the answer you chosen. just accepting it won't work. –  YOU Jun 21 '10 at 7:28
    
@code: Ya, he's right. –  Nathan Osman Jun 21 '10 at 7:32
    
@smark et.al hmmm, guess i need to pull myself away from apps and visit meta every once in a while. thanks –  Sky Sanders Jun 21 '10 at 8:09
    
@code: Actually it was on the blog :) –  Nathan Osman Jun 21 '10 at 8:10
    
@code: Uhm... according to the question above, I get a mention on Soapi.info? –  Nathan Osman Jun 21 '10 at 20:47
1  
@Geo - your soapi apps are linked from soapi.info. thanks for participating and good work. –  Sky Sanders Jun 26 '10 at 0:49

I was going to write this as a comment, but it got too long:

I've got about 50% of the way through my JS app using your wrapper, but I'm heading back to work after some extended leave and there's no way I'm going to get it finished. That said, what I used worked great, only one suggestion, it would be great if the requests could be synchronous (rather than a-sync), because then when queuing up multiple requests to the same method you don't need to create a watcher.

E.G. I wanted to retrieve 5 individual questions, mixing and matching them from different sites. So:

for (var x=0;x<sitedata.length;x++){
    var soapi = new  Soapi.RouteFactory(sitedata[x][0], apiKey);
    var q = soapi.QuestionsById(sitedata[x][1]);
    q.getResponse(function success(data) {
         //.....
    })
}

then needs a setInterval to detect when all the responses have come back (increasing a progress meter along the way). Not a huge thing, probably won't upset too many people, but I found myself constantly creating watchers to then fire another function.

Apart from that, I applaud a job well done and I look forward to your 30" monitor winning application (although in my opinion you'll be hard pressed to beat Six to Eight - if it gets released before the cutoff date).

share|improve this answer
    
Hey, the rest of us haven't given up on the monitor either :) –  Nathan Osman Jun 14 '10 at 7:18
1  
Aside from the obvious dark pit of hades into which I would be thrown if I were able to implement a blocking call in JS, how to implement a blocking call in a jsonp wrapper is not immediately apparent to me. The api calls are made via jsonp, injected script tags, not XMLHttpRequest. Do you have any ideas? I have implemented a viable blocking call in the silverlight version, but then I have threads and am able to force the call to be made on a thread other than the UI thread. No such animal in regards to browsers (workers in chrome) in general distribution any time in the near future. –  Sky Sanders Jun 14 '10 at 8:13
    
And I typically chain calls that would otherwise be suited to be run synchronously. e.g. make the next call from within the success function. With a little imagination and a flag or two this can serve such a purpose. And as far as a queue goes, I have an implementation somewhere in my qunit code. I will try to dig it up. –  Sky Sanders Jun 14 '10 at 10:12
    
Writing a blocking jsonp call seems like it shouldn't even be possible :) –  Nathan Osman Jun 14 '10 at 16:24
    
@code, as usual everything you've said sounds right... I was just too late into the design of my application to change it to one of the methods you mentioned. I didn't really put much thought into the idea to be honest, but I can see the problem that this is faced. I guess the answer is "no - next time design your app to use the library properly" ;) –  Mark Henderson Jun 14 '10 at 22:20
    
Can someone -1 this just so that it sits at the bottom of the list and doesn't get the bounty –  Mark Henderson Jun 16 '10 at 5:32

This will eventually turn into the entry for my app. It didn't! See my other answer.

Support: the page at http://stackoverflow.quickmediasolutions.com/stackad/ is having some trouble pulling answers.

// an url built with soapi-explore...

// http://api.meta.stackoverflow.com/0.8/questions/53346/answers?body=true&min=6&order=asc&sort=votes

// can be easily translated to Soapi.JS..

new Soapi.RouteFactory('api.meta.stackoverflow.com', '')
.QuestionsByIdAnswers(53346).applyParameters({
    body: true,
    min: 6,
    order: 'asc',
    sort: 'votes'
}).getResponse(
function success(data) {
    alert(data.answers[0].score);
},
function error(err) {
    alert(err.message);
});
share|improve this answer
    
george, i already addressed this - you are trying to query an 'answer' source with a question id. try 53466, which is an answer id to see what I mean. AnswersById gets answers specifically requested. If you want all of the answers to a specific question, use QuestionsById or QuestionsByIdAnswers –  Sky Sanders Jun 15 '10 at 0:36
    
and to answer your other question, yes, the api supports (but does not properly document) the ability to all of the answers for a specific question with a score of 6 or higher. Here is the raw url, api.meta.stackoverflow.com/0.8/questions/53346/… I will leave it to you to translate that into soapi.JS. (hint, the soapi was generated directly from the api) –  Sky Sanders Jun 15 '10 at 0:41
    
And did I mention that I spend a LOT of time in soapi-explore. You don't use visual studio so soapi-explore can save you a lot of time with the parameter tooltip documentation. you can build requests and test them, see the results, and then very easily translate the url in to soapi.JS –  Sky Sanders Jun 15 '10 at 0:44
    
@code: I changed my code to QuestionsByIdAnswers already. It still doesn't work. –  Nathan Osman Jun 15 '10 at 0:46
    
And I am having trouble translating API calls to SOAPI calls, though I'm starting to get the hang of it now. –  Nathan Osman Jun 15 '10 at 0:47
    
@george - this is what you are looking for. –  Sky Sanders Jun 15 '10 at 1:22
    
@code: This? What is "this?" –  Nathan Osman Jun 15 '10 at 1:35
    
what? you want me to write your code and then post it in comments? ;-) work with me dude. –  Sky Sanders Jun 15 '10 at 1:37
    
@code: Of course not, it's just that I have no idea where the problem even is - once we can find it, I can probably fix it no problem. –  Nathan Osman Jun 15 '10 at 1:47
    
Never mind. I didn't see that you edited my answer :) –  Nathan Osman Jun 15 '10 at 1:52
    
@code: I have copied your code verbatim and I get: Uncaught TypeError: Cannot set property 'apiVersion' of undefined. Uncaught TypeError: Object [object Object] has no method 'QuestionsByIdAnswers' –  Nathan Osman Jun 15 '10 at 21:55
    
@george - the api had some drama last night. check twitter.com/soapiwatch and twitter.com/soapigen and then download new js files from soapi.info/Services/CodeGeneration.aspx - I suggest that if you want to write code against an evolving beta api that you take advantage of the notification and discovery tools i have provided on soapi.info. You gotta keep up, dude. ;-) –  Sky Sanders Jun 15 '10 at 22:02
    
Also - you will probably the reason you cannot find apiVersion on stats is that there is no member of that name. try api_version. Ok? If you have questions about a member of the api in it's running state look @ soapi.info/Services/Watch.aspx and see if you can figure it out. –  Sky Sanders Jun 15 '10 at 22:08
    
And whatever you copied likely wasn't mine. or wasn't copied verbatim. –  Sky Sanders Jun 15 '10 at 22:10
    
@code: I know. My mobile client went crazy last night too and I had a feeling in the back of my mind that that's why your code wasn't working either. As for copying code, I just copied and pasted what you edited into my question above. Well, I'll get the new versions of the files and see what I can do. –  Nathan Osman Jun 15 '10 at 22:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .