Skip to content
Sean Mooney edited this page Jul 11, 2013 · 31 revisions

API Documentation

API format

URL construction

base url collections: /{version}/{resource} /v0/tasks
base url item: /{version}/{resource}/{id} /v0/tasks/1
related resources url collection: /{version}/{resource}/{id}{relatedResource} /v0/tasks/1/tags
related resources url item: /{version}/{resource}/{id}{relatedResource}/{id} /v0/tasks/1/tags/5 (currently not used)
resource functions: /{version}/{resource}/{function}/{arg1}/{arg2}... /v0/languages/getByCode/en
Max segments: 5 (version + 4)

request and response format

To specify a response/request format append one of the following supported extensions to the url.

  • .json /v0/tasks/1.json
  • .xml /v0/tasks.xml
  • .php
  • .html
  • .proto(currently returns json, not implemented yet) unrecongnised format default to json. if a format extention is not present json will be used.

Nameing

nouns => Resources (users)
verbs => methods (search)
resourse use plural names
all urls start with a version number /v0 , /v1 ,...

http verbs

use http verbs for diffrent behaviour

Optional args (currently mostly not implemented)

limit the number of results to return
offset the offset into the result set
feilds the feilds to return form the result data
filter values for feilds that must match in the result set
method alternative mechanism to specify the http method type for client that do not support the 4 main types
Suppress_Error suppresses http error codes and instead return error in body.
Dispatcher::registerNamed(HttpMethodEnum::GET, '/v0/tasks/:id/claimed/', function ($id,$format=".json"){

        $data=null;
        $dao = new TaskDao();
        if(isset ($_GET['userID'])&& is_numeric($_GET['userID'])) {
            $data=$dao->hasUserClaimedTask($_GET['userID'], $id);
        }else{
            $data=$dao->taskIsClaimed($id);
        }
   
       Dispatcher::sendResponce(null,$data, null, $format);
    },'getTaskVersion');

Resource urls

Users

get /v0/users returns all users(currently not implemented)

get /v0/users/{id} returns user for id. delete /v0/users/{id} deletes the specified user account.
put /v0/users/{id}/ updates user{id} post body:{user}. new

get /v0/users/{uuid}/registered returns newly registered user with matching {uuid} (deprecated) post /v0/users/{id}/finishRegistration activates user {id}'s account (deprecated)

get /v0/users/{0}/verified checks if the user has verified their email return 1/0

get /v0/users/{id}/orgs returns the orgs user {id} is a member of.
delete /v0/users/leaveOrg/{id}/{orgid}/ removes user {id} form org {orgid}

get /v0/users/{id}/tasks returns the user {id} tasks.
post /v0/users/{id}/tasks claims a task for user {id}. post body:{task}
delete /v0/users/{id}/tasks/{taskid} unclaims task {taskid} for user {id}.

get /v0/users/subscribedToTask/{id}/{taskID}/ checks if user {id} is tracking task {taskid} return 1/0

get /v0/users/subscribedToProject/{id}/{projectID}/ checks if user {id} is tracking project {projectID} return 1/0

get /v0/users/:id/taskStreamNotification retruns taskStreamNotifcation interval for user {id} put /v0/users/:id/taskStreamNotification updates taskStreamNotifcation interval for user {id} delete /v0/users/:id/taskStreamNotification disables taskStreamNotifcation for user {id}

get /v0/users/{id}/top_tasks returns the top tasks for user {id}.

get /v0/users/{id}/tags returns the tags for user {id}.
post /v0/users/{id}/tags subscribes a user{id} for a task. postData:{task} new
put /v0/users/{id}/tags/{tagId} subscribes a user{id} for task {tasid}. new
delete /v0/users/{id}/tags/{tagId} unsubscribes a user{id} for task {tasid}. new

get /v0/users/{id}/tracked_task returns the tasks user {id} is tracking. new
post /v0/users/{id}/tracked_tasks adds a tracked task for user{id} postData:{task} new
put /v0/users/{id}/tracked_tasks/{taskID} adds task {taskID} as a tracked task for user{id}. new
delete /v0/users/{id}/tracked_tasks/{taskID} remoeves task {taskID} as a tracked task for user{id}. new

get /v0/users/{id}/archived_tasks dispalys archived task for a user. newish

get /v0/users/getByEmail/{email} get a user by there email address. newish

get /v0/users/{id}/passwordResetRequest checks if user {id} has a password reset request. new
get /v0/users/:id/passwordResetRequest/time retruns when the reset was requested post /v0/users/{id}/passwordResetRequest creates a password reset request for user {id}. new

get /v0/users/{id}/badges returns the badges for user {id}
post /v0/users/{id}/badges adds a bade to user{id} postData:{badge} new
put /v0/users/{id}/badges/{badgeID} adds badge {badgeID} to user{id}. new
delete /v0/users/{id}/badges/{badgeID} removes badge {badgeID} to user{id}. new

get /v0/users/{id}/projects returns user {id}'s tracked projects put /v0/users/{id}/projects/{pID} tracks project {pID} for user {id} delete /v0/users/{id}/projects/{pID} untracks project {pID} for user {id}

get /v0/users/{id}/personalInfo retruns user {id}'s personal info post /v0/users/{id}/personalInfo creates user {id}'s personal info post body:UserPersonalInfo (deprecated) put /v0/users/{id}/personalInfo creates or updates user {id}'s personal info put body:UserPersonalInfo

get /v0/users/{id}/secondaryLanguages returns user {id}'s secondary languages as list of {Locale} post /v0/users/{id}/secondaryLanguages add a new secondary languages to user {id}, Post Body {Locale}

delete /v0/users/removeSecondaryLanguage/{userId}/{languageCode}/{countryCode}/ deletes user {id}'s seconday langue matching {languageCode}-{countryCode}

Projects

GET /v0/projects get all projects
POST /v0/projects Update Project specified in post data. post data {project}
PUT /v0/projects Insert a new project. post data {project}
GET /v0/projects/{id} Returns project with id = {id}
PUT /v0/projects/archiveProject/{projectId}/user/{userId}/ Archives project {projectId} as user {userId}

post /v0/projects/{id}/calculateDeadlines calulate dedlines for each task belonging to project {id} (deprecated)

get /v0/projects/buildGraph/{id}/ returns the computed workflow graph for project {id}

get /v0/projects/{id}/tags returns all tags for project {id}

get /v0/projects/{id}/reviews returns all review for project {id}

get /v0/projects/{id}/tasks returns all task for project {id}

get /v0/projects/{id}/info returns the file info for project {id}

get /v0/projects/{id}/file returns the file for project {id}

put /v0/projects/{id}/file/{filename}/{userId}/ creates file {filename} for project {id} as user {userId} put body : file contents

get /v0/projects/{id}/archivedTasks retruns all tasks for a archived project {id} (deprecated)

delete /v0/projects/:id/deleteTags deletes all tags for project {id} (deprecated)

Archived Projects

GET /v0/archivedProjects Get all archived projects
GET /v0/archivedProjects/{id} Get archived project with id = {id}

Tasks

get /v0/task returns all tasks
post /v0/task creates a new task and returns the task. postData:{task}

get /v0/tasks/{id} returns task for {id}.
delete /v0/tasks/{id} deletes task {id}.

get /v0/tasks/{id}/tags returns the tags for task {id}.
put /v0/tasks/{id}/tags updates the tags for task {id}. postBody{task}

get /v0/tasks/{id}/status returns the status message for task {id} .

get /v0/tasks/{id}/file returns the file for task{id}. optionally specify version={version}

put /v0/tasks/{id}/file/{filename}/{userId}/ creates file {filename} for task {id} as user {userID}. optionally specify version={version} Put Body: file contents

put /v0/tasks/uploadOutputFile/{id}/{userId}/ updates the output file for task {id} and updates the input files of all task that depend on task {id} Put Body: file contents

get /v0/tasks/{id}/version returns the latest version for task {id} .

get '/v0/tasks/{id}/info retruns the file info for task {id}.

get /v0/tasks/{id}/claimed checks if task {id} has been claimed. returns 1/0

get /v0/tasks/{id}/timeClaimed returns the time task {id} was claimed

get /v0/tasks/{id}/user returns the user who claimed task {id}

get /v0/tasks/top_tasks returns the default task stream. optionally specify limit={limit} default 10. new

put /v0/tasks/archiveTask/{id}/ archives task {id}.

post /v0/tasks/addTarget/{languageCode}/{countryCode}/ duplicates a task for a given language pair. postData{task}
note that currently you need the language id not code.

get /v0/tasks/{id}/claimed/ returns task claim status. optional userID={userID}.

get /v0/tasks/{id}/prerequisites returns task {id}'s prerequisite tasks
put /v0/tasks/{id}/prerequisites/{preReqId}/ add task {preReqId} as a prerequisite to task {id}
delete /v0/tasks/{id}/prerequisites/{preReqId}/ removes task {preReqId} as a prerequisite to task {id}

get /v0/tasks/{id}/review returns the reviews for task {id} post /v0/tasks/review creates a task review Post Body: {TaskReview} (deprecated)

put /v0/tasks/:id/orgFeedback sends feedback to org which created task {id} PutBody {OrgFeedback} (deprecated)

put /v0/tasks/:id/userFeedback sends feedback to user who claimed task{id} PutBody {UserFeedback} (deprecated)

Tags

get /v0/tags returns all tags
post /v0/tags creates a new tag Post Body: {Tag}

get /v0/tags/{id} returns tag for {id}. put /v0/tags/{id} updates tag {id}. delete /v0/tags/{id} deletes tag {id}.

get /v0/tags/getByLabel/{label}/ gets a tag by its text value {lable}

get /v0/tags/search/{name}/ returns all tags containing {name}

get /v0/tags/{id}/tasks returns tasks with tag {id}.

get /v0/tags/topTags returns the top tags. optionally specify limit={limit} default 10. new

Badges

get /v0/badges returns all badges
post /v0/badges creates a new badge post body: {Badge}

get /v0/badges/{id} returns badge for {id}.
put /v0/badges/{id} updates badge {id}.
delete /v0/badges/{id} removes badge {id}.

get /v0/badges/:id/users returns users with badge {id}.

Orgs

get /v0/orgs returns all orgs
post /v0/orgs creates an org Post Body: {Org}

get /v0/orgs/{id} returns org for {id}.
put /v0/orgs/{id} updates org {id} Put Body {Org}. delete /v0/orgs/{id} deletes org {id}.

get /v0/orgs/isMember/{orgID}/{id}/ checks if user {id} is a member of org {orgID} returns 1/0

get /v0/orgs/getByName/{name}/ returns the org with name = {name}.

get /v0/orgs/searchByName/{name}/ returns all orgs whose name contains {name}

get /v0/orgs/{id}/projects retruns all project created by organisation {id}

get /v0/orgs/{id}/archivedProjects retruns all archived project created by organisation {id}

get /v0/orgs/{id}/archivedProjects/{projectID}/ returns archived project {projectID} created by organisation {id}

get /v0/orgs/{id}/archivedProjects/{projectID}/tasks returns all tasks for archived project {projectID} created by organisation {id}

get /v0/orgs/:id/badges returns organisation badges for org {id}.

get /v0/orgs/:id/members returns organisation {id}'s members.

get /v0/orgs/{id}/requests returns requests for membership of organisation {id}.
post /v0/orgs/{id}/requests/{uid}/ create a new membership request for user {uid} to org{id} put /v0/orgs/{id}/requests/{uid}/ accepted membership request for user {uid} to org{id} delete /v0/orgs/{id}/requests/{uid}/ rejects membership request for user {uid} to org{id}

Login

get /v0/login returns a Login template
post /v0/login logs in. returns {user} on success or error message on failure. postData:{Login template}

Password Reset

get /v0/password_reset returns a passwordReset template
post /v0/password_reset changes a password.postData:{passwordReset template} returns [result and message]
get /v0/password_reset/{unique key} returns a password resetRequest by {unique key}

Register

get /v0/register returns a register template
post /v0/register register a new user. returns {user} on sucess or error message on failure. postData:{Register template}

Languages

get /v0/languages returns a all languages
get /v0/languages/{id} returns a language by id
get /v0/languages/getByCode/{code} returns a language by its language code get /v0/languages/getActiveLanguages returns all languages with claimable task.

Countries

get /v0/countries returns a all countries
get /v0/countries/{id} returns a country by id
get /v0/countries/getByCode/{code} returns a country by its country code