Skip to content

Task Management API

my-tien edited this page Sep 27, 2017 · 3 revisions

Task Management API

The task management API allows annotators to connect to a project’s server from within KNOSSOS to download tasks, solve them inside KNOSSOS and submit results. Below is a list of currently available actions. Feel free to contact us on this, we are happy to answer your questions and can implement new API features if desired.

KNOSSOS sends requests, server replies.

Login

  • URL: [hosturl] + "/api/2/login/"
  • Request type: POST
  • Post data:
    <login>
        <username>name</username>
        <password>passwd</password>
        <knossos_version>version</knossos_version>
    </login>
    
  • Reply: Cookie

Get current Session

  • URL: [hosturl] + "api/2/session/"
  • Request type: GET
  • Response:
    • If user hasn’t started any task, yet:
      {
          "username":"bob",
          "first_name": "Bob",
          "last_name": "Tracerman"
      }
      
    • If user has an open task:
      {
          "username": "bob",
          "first_name": "Bob",
          "last_name": "Tracerman",
          "task_category_name": "Synapse Project",
          "task_name": "Region XYZ",
          "task_category_description": "Please skeletonize the synapses from the seed points."
      }
      

Logout

  • URL: [hosturl] + "/api/2/logout/"
  • Request type: GET
  • Reply: Http code

Start New Task

Only available if user has no open task.

  • URL: [hosturl] + "/api/2/new_task/"

  • Request type: POST

  • Post data: The session cookie:

    • Header: "csrfmiddlewaretoken"
    • Body: "W2j4cP8reM4hKZEqf3WlVsxkpJq5PGDXb5adjSL4GDLjweUgvWeZY5mhHIskHFuP"
  • Reply:

    • Content-disposition header: filename="task123.k.zip"
    • task123.k.zip

Submit

  • URL: [hosturl] + "/api/2/submit/"

  • Request type: POST

  • Post data: Multipart message

    • Content disposition header: form_data; filename="task123.k.zip"

    • Parts

      Header Body
      csrfmiddlewaretoken W2j4cP8reM4hKZEqf3WlVsxkpJq5PGDXb5adjSL4GDLjweUgvWeZY5mhHIskHFuP The session cookie
      filename task123.k.zip
      submit_comment Finished 2 synapses around region XYZ
      submit_work_is_final True/False final submits close task as finished
    • task123.k.zip

  • Reply: 200

Load last submit

  • URL: [hosturl] + "/api/2/current_file/"
  • Request type: GET
  • Reply:
    • Content-Disposition header: filename="task123.k.zip"
    • task123.k.zip