CrowdflowerJS is a library for the crowdflower API wrapped up in javascript. The official Crowdflower API description can be found here. jQuery is required for this library to work. After the library is loaded the API is accessible via $.crowdflower.
This project is part of Web Information Systems group.
- Jasper Oosterman (main developer)
- Alessandro Bozzon (project conceptualization)
- Adding and specifying gold data is not yet implemented.
- Ordering/paying of jobs is not tested yet.
- Uploading data is not yet supported from all accepted types
This projects is a Javascript wrapper for web APIs exposed by CrowdFlower. Since Javascript does not allow to do cross domain requests a local proxy is required to function. A servlet that forwards the parameters and data written to the proxy and returns the response data and status is enough.
All API requests are asynchronous meaning that results (or errors) should be handled using standard .done(), .fail() and .always().
(1) Load the crowdflower.jquery.js library
<script type="text/javascript" src="../jquery.min.js"></script>
<script type="text/javascript" src="../crowdflower.jquery.js"></script>
(2) Setup the credentials and proxy
var proxyURL = <url>;
var key = <key>;
$.crowdflower.key(key).proxyURL(proxyURL);
Now all the API functions are accessible in an intuitive way. (3a) Get all the jobs
$.crowdflower.jobs.read().done(function(jobs) {
//if there are jobs available
if (jobs && jobs.length > 0) {
for ( var i = 0; i < jobs.length; i++) {
//process each job
}
}
});
(3b) Delete a job
$.crowdflower.job(job_id).remove().done(function() {
alert("Job " + job_id + " successfully deleted.")
});
The following table lists the namespace where functions can be found. CRUD operations are supported following the naming scheme CrowdFlower specifies in the API. The "C" is found in plural namespaces (jobs, judgments etc.) and the "RUD" are in the singular namespaces (job, judgement etc.).
Namespace | Comments |
---|---|
$.crowdflower | Global functions for managing default handlers, credentials, and proxy. |
$.crowdflower.jobs | List and create jobs |
$.crowdflower.job | Read, update, delete a job. Delete method is named remove. |
$.crowdflower.job.units | List and create units |
$.crowdflower.job.unit | Read, update, delete a unit. Delete method is named destroy |
$.crowdflower.job.judgments | Create judgment. |
$.crowdflower.job.judgment | Read, update, delete a judgment. Delete method is named remove |
$.crowdflower.job.orders | Create orders |
$.crowdflower.job.order | Read orders |
For known errors see jCrowdFlower.
Delft University of Technology
[Faculty] Electrical Engineering, Computer Science and Mathematics
[Department] Software and Computing Technology
[Group] Web Information Systems
[Contact] [email protected]