Skip to main content

Create a new extra

POST 

/admin/extras

[Requires Coach or Connector Access]

Create a new extra field. Allowed extraGroups are 'PARTICIPANT', 'PARTICIPANT_INFERENCE' and 'PARTICIPANT_SYMPTOMS'

The extraDataType is the data type of the extra value. Allowed extraTypes are 'B' (boolean), 'S' (string), 'N' (number), 'T' (datetime) and 'J' (JSON)

If isLog is true, the history of the extra value will be maintained as a log otherwise it will be overwritten by a new value. If isHidden is true, the extra field will not be exposed to user. If isReadOnly is true, the value is not editable

If script is provided, the script will be executed when the extra values in a group are saved. The script should be a valid javascript code.

i.e) /participants/{user_id}/extras/{extra_group} endpoint will trigger the script execution.

(function() {
var total = 0.0;
// extraValues is read from the 'extraValues' from the request parameters
for (var i = 0; i < extraValues.length; i++) {
var extra = extraValues[i];
if (extra.value !== "") {
total += parseFloat(extra.value);
}
}
// returns the score to populate 'SCORE' extra field or the one the script belongs to
return total * (extras.length / extraValues.length);
})();

Request

Responses

Created

Response Headers
    Access-Control-Allow-Headers
    Access-Control-Allow-Methods
    Access-Control-Allow-Origin
    Cache-Control
    Content-Type