Skip to content

Doubtfire API

API: Tasks

tasks : Operations about tasks This markdown document provides detailed documentation for the “task” API endpoints including their URLs, methods, parameters, responses, and example requests using curl.

This “tasks” API has the following operations.

  • GET /api/tasks/{task_id}/similarities/{id}/viewer_url
  • GET /api/tasks/{task_id}/similarities/{id}/contents/{idx}
  • PUT /api/tasks/{task_id}/similarities/{id}
  • GET /api/tasks/{task_id}/similarities
  • DELETE /api/tasks/{id}/pin
  • POST /api/tasks/{id}/pin
  • GET /api/tasks

GET: Retrieve Viewer URL for Similarity

GET /api/tasks/{task_id}/similarities/{id}/viewer_url

  • URL: /api/tasks/{task_id}/similarities/{id}/viewer_url

  • Method: GET

  • Parameters:

    ParameterDescriptionParameter TypeData TypeMandatory
    task_idTask IDpathintegerYes
    idSimilarity IDpathintegerYes
    UsernameUser usernameheaderstringYes
    Auth_TokenAuthentication tokenheaderstringYes
  • Response: 200 OK

  • Example Request:

    Terminal window
    curl -X GET --header 'Accept: application/json' --header 'Username: admin' --header 'Auth_Token: rrK8BdRfxof9RrJGuk5n'
    'http://localhost:3000/api/tasks/1/similarities/1/viewer_url'
  • Response Body:

    {
    "viewer_url": "http://example.com/viewer/123"
    }

GET: Retrieve Similarity Contents

GET /api/tasks/{task_id}/similarities/{id}/contents/{idx}

  • URL: /api/tasks/{task_id}/similarities/{id}/contents/{idx}

  • Method: GET

  • Parameters:

    ParameterDescriptionParameter TypeData TypeMandatory
    task_idTask IDpathintegerYes
    idSimilarity IDpathintegerYes
    idxIndex of part to downloadpathintegerYes
    as_attachmentDownload file as attachment (optional)querybooleanNo
    UsernameUser usernameheaderstringYes
    Auth_TokenAuthentication tokenheaderstringYes
  • Response: 200 OK

  • Example Request:

    Terminal window
    curl -X GET --header 'Accept: application/json' --header 'Username: admin' --header 'Auth_Token: rrK8BdRfxof9RrJGuk5n'
    'http://localhost:3000/api/tasks/1/similarities/1/contents/0?as_attachment=true'
  • Response Body: This endpoint returns the similarity contents as a file. The response does not have a JSON body.


PUT: Update Task Similarity

PUT /api/tasks/{task_id}/similarities/{id}

  • URL: /api/tasks/{task_id}/similarities/{id}

  • Method: PUT

  • Parameters:

    ParameterDescriptionParameter TypeData TypeMandatory
    task_idTask IDpathintegerYes
    idSimilarity IDpathintegerYes
    flaggedWhether or not to flag the similaritybodybooleanYes
    UsernameUser usernameheaderstringYes
    Auth_TokenAuthentication tokenheaderstringYes
  • Response: 200 OK

  • Example Request:

    Terminal window
    curl -X PUT --header 'Content-Type: application/json' --header 'Username: admin' --header 'Auth_Token: rrK8BdRfxof9RrJGuk5n'
    -d '{"flagged": true}' 'http://localhost:3000/api/tasks/1/similarities/1'
  • Response Body:

    {
    "id": 1,
    "task_id": 1,
    "flagged": true,
    "similarity_details": {
    "type": "MOSS",
    "pct": 85
    }
    }

GET: Get Task Similarities

GET /api/tasks/{task_id}/similarities

  • URL: /api/tasks/{task_id}/similarities

  • Method: GET

  • Parameters:

    ParameterDescriptionParameter TypeData TypeMandatory
    task_idTask IDpathintegerYes
    UsernameUser usernameheaderstringYes
    Auth_TokenAuthentication tokenheaderstringYes
  • Response: 200 OK

  • Example Request:

    Terminal window
    curl -X GET --header 'Accept: application/json' --header 'Username: admin' --header 'Auth_Token: rrK8BdRfxof9RrJGuk5n'
    'http://localhost:3000/api/tasks/1/similarities'
  • Response Body:

    [
    {
    "id": 1,
    "task_id": 1,
    "similarity_details": {
    "type": "MOSS",
    "pct": 85
    }
    },
    {
    "id": 2,
    "task_id": 1,
    "similarity_details": {
    "type": "Turnitin",
    "pct": 90
    }
    }
    ]

DELETE: Unpin a Task

DELETE /api/tasks/{id}/pin

  • URL: /api/tasks/{id}/pin

  • Method: DELETE

  • Parameters:

    ParameterDescriptionParameter TypeData TypeMandatory
    idTask IDpathintegerYes
    UsernameUser usernameheaderstringYes
    Auth_TokenAuthentication tokenheaderstringYes
  • Response: 204

  • Example Request:

    Terminal window
    curl -X DELETE --header 'Username: admin' --header 'Auth_Token: rrK8BdRfxof9RrJGuk5n'
    'http://localhost:3000/api/tasks/1/pin'
  • Response Body: Task unpinned


POST: Pin a Task

POST /api/tasks/{id}/pin

  • URL: /api/tasks/{id}/pin

  • Method: POST

  • Parameters:

    ParameterDescriptionParameter TypeData TypeMandatory
    idTask IDpathintegerYes
    UsernameUser usernameheaderstringYes
    Auth_TokenAuthentication tokenheaderstringYes
  • Response: 201

  • Example Request:

    Terminal window
    curl -X POST --header 'Content-Type: application/json' --header 'Username: admin' --header 'Auth_Token: rrK8BdRfxof9RrJGuk5n'
    'http://localhost:3000/api/tasks/1/pin'
  • Response Body:

    {
    "message": "Task successfully pinned"
    }

GET: Retrieve User’s Tasks

GET /api/tasks

  • URL: /api/tasks

  • Method: GET

  • Parameters:

    ParameterDescriptionParameter TypeData TypeMandatory
    unit_idUnit ID to fetch the task details forqueryintegerYes
    UsernameUser usernameheaderstringYes
    Auth_TokenAuthentication tokenheaderstringYes
  • Response: 200 OK

  • Example Request:

    Terminal window
    curl -X GET --header 'Accept: application/json' --header 'Username: admin' --header 'Auth_Token: rrK8BdRfxof9RrJGuk5n'
    'http://localhost:3000/api/tasks?unit_id=1'
  • Response Body:

    [
    {
    "id": 1,
    "task_definition_id": 1,
    "status": "completed",
    "tutorial_id": 1,
    "tutorial_stream_id": 1
    },
    {
    "id": 2,
    "task_definition_id": 2,
    "status": "in_progress",
    "tutorial_id": 2,
    "tutorial_stream_id": 2
    }
    ]