API – Create a checklist task
To create a task for the checklist, send PUT request to URI
https://your-domain.davintoo.com/api/rest.php/tasks
- The body of the request must contain a JSON object with the parameters of the task.
- The request must contain the following headings Content-Type: application/json;charset=UTF-8 и Authorization: Bearer xxxxxx.
Request example:
curl -X PUT 'https://your-domain.davintoo.com/api/rest.php/tasks' --data-raw '{"type":"check-list","element_id":197,"title":"Mentor's evaluation of the newcomer","description":"","tags":["стажування"],"threshold":85,"has_exact_time":"true","time_start":"","time_finish":"","date_range":["2022-05-13", "2022-05-20"],"date_start":"2022-05-13","date_finish":"2022-05-20","not_block_after_expiration":true,"allow_comments":true,"reminder_enabled":true,"evaluate_type":"evaluates-tutor"}'
-H 'Authorization: Bearer xxxxxx'
-H 'Content-Type: application/json;charset=UTF-8'
Field | Parameter description |
---|---|
type | Task type |
element_id | checklist id |
title | Task title |
description | Task description |
tags | Tags |
threshold | Completion threshold, in % |
date_start | Task start date |
date_finish | Task completion date |
not_block_after_expiration | Do not close access after the deadline |
allow_comments | Allow commenting |
reminder_enabled | Enable reminders |
evaluate_type | Evaluation mode (evaluates-tutor - tutor evaluation, self_esteem - self-esteem) |
Answer
In case of successful request (HTTP response code - 200), there will be reply in JSON format with information about created task.
In case of error (HTTP response code - 400) it returns JSON object with error information:
{"title":{"required":"Field cannot be empty"}}
Additional settings for the checklist task
Selection of the questionnaire assignment mode
After creating the task for the checklist, you need to select the questionnaire assignment mode. To do this, you need to send a PUT request to the URI https://your-domain.davintoo.com/api/rest.php/task-check-list-settings/{taskId}, where the body of the request should contain a JSON object with the assign_mode parameter (manually - Manually, organization_structure_chiefs - Manager according to the organizational structure).
Request example:
curl -X PUT 'https://your-domain.davintoo.com/api/rest.php/task-check-list-settings/34423' --data-raw '{"assign_mode":"organization_structure_chiefs"}'
-H 'Authorization: Bearer xxxxxx'
-H 'Content-Type: application/json;charset=UTF-8'
Enabling the option "Show checklist evaluation results to assessed users"
If a task with a checklist is evaluated by a tutor and the option "Show checklist evaluation results to assessed users" must be enabled it is necessary to send PUT request to URI
https://your-domain.davintoo.com/api/rest.php/task-check-list-settings/{{taskId}}, where in the body of the request should be JSON object show_result_to_user
Request example:
curl -X PUT 'https://your-domain.davintoo.com/api/rest.php/task-check-list-settings/34423' --data-raw '{"show_result_to_user":true}'
-H 'Authorization: Bearer xxxxxx'
-H 'Content-Type: application/json;charset=UTF-8'