5

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.

10
  • 1
    I was planning on playing with the soapi.js library in the next few days anyway, so this is some added incentive ;) Commented Jun 12, 2010 at 7:59
  • Sounds like a challenge to me! I will begin planning something. Commented Jun 12, 2010 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 Commented Jun 14, 2010 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. Commented Jun 14, 2010 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. Commented Jun 14, 2010 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. Commented Jun 14, 2010 at 22:26
  • @code: Deleted the comments now. Commented Jun 15, 2010 at 7:06
  • please don't tag things [library] unless they are actually library entries. This is a contest of some sort. Commented Aug 15, 2010 at 6:15
  • @code: Congrats on the "Most Entries" prize - you deserved it! Commented Aug 15, 2010 at 19:07
  • @geo - same to you. Commented Aug 15, 2010 at 19:14

3 Answers 3

6
+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!

15
  • 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) Commented Jun 16, 2010 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. Commented Jun 16, 2010 at 3:13
  • ahhh, i did not consider that. looks like i have to pick. good catch Commented Jun 16, 2010 at 3:28
  • no worries. i will cut the check @ 0:0:0 mountain time. Commented Jun 20, 2010 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! ;-) Commented Jun 21, 2010 at 3:33
  • @code: Sorry, got to this late - I'll write one now. Update: There, wrote one. Commented Jun 21, 2010 at 6:21
  • @code: In addition, did you see this page that I also made with Soapi.js? Vote for it here. Commented Jun 21, 2010 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. Commented Jun 21, 2010 at 7:21
  • @code: Ya, he's right. Commented Jun 21, 2010 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 Commented Jun 21, 2010 at 8:09
  • @code: Actually it was on the blog :) Commented Jun 21, 2010 at 8:10
  • @code: Uhm... according to the question above, I get a mention on Soapi.info? Commented Jun 21, 2010 at 20:47
  • i have not had a chance to push changes to the site. i have to sleep sometime. it is coming in tonight's push. Commented Jun 22, 2010 at 1:31
  • 1
    @Geo - your soapi apps are linked from soapi.info. thanks for participating and good work. Commented Jun 26, 2010 at 0:49
  • @code: No problem. Thanks for keeping up to date with the new API version number changes. Commented Jun 26, 2010 at 0:50
1

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).

6
  • Hey, the rest of us haven't given up on the monitor either :) Commented Jun 14, 2010 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. Commented Jun 14, 2010 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. Commented Jun 14, 2010 at 10:12
  • Writing a blocking jsonp call seems like it shouldn't even be possible :) Commented Jun 14, 2010 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" ;) Commented Jun 14, 2010 at 22:20
  • Can someone -1 this just so that it sits at the bottom of the list and doesn't get the bounty Commented Jun 16, 2010 at 5:32
1

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);
});
23
  • 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 Commented Jun 15, 2010 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) Commented Jun 15, 2010 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 Commented Jun 15, 2010 at 0:44
  • @code: I changed my code to QuestionsByIdAnswers already. It still doesn't work. Commented Jun 15, 2010 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. Commented Jun 15, 2010 at 0:47
  • @george - this is what you are looking for. Commented Jun 15, 2010 at 1:22
  • @code: This? What is "this?" Commented Jun 15, 2010 at 1:35
  • what? you want me to write your code and then post it in comments? ;-) work with me dude. Commented Jun 15, 2010 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. Commented Jun 15, 2010 at 1:47
  • Never mind. I didn't see that you edited my answer :) Commented Jun 15, 2010 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' Commented Jun 15, 2010 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. ;-) Commented Jun 15, 2010 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. Commented Jun 15, 2010 at 22:08
  • And whatever you copied likely wasn't mine. or wasn't copied verbatim. Commented Jun 15, 2010 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. Commented Jun 15, 2010 at 22:24

You must log in to answer this question.

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