User: Assign

A user can be assigned assessments with POST user/assign.

Basic request

POST https://{APIDOMAIN}/api-v1/user/assign

Base parameters

user_uuid: Required; must be a valid user UUID associated with a member-user for your organisation
auto_reserve: This flag stands in as a purchase confirmation, and is required if auto_assign is being requested. Value must be 1
auto_assign: Optional; if passed, must be a valid JSON object with the structure shown below. See Auto-assignment parameters
group_uuid: Optional; if passed, joins the user to the specified group. Must be a valid group UUID (any UUID of a previously-created group within your org) – see Groups

Example 1

Structure of the auto_assign object for revenue share contracts:

[
  {
    "country": "US",
    "assessment_each_price": 13.75,
    "total_extras_price": 0,
    "data": [
        {
            "key": "AI",
            "target": "self"
        }, 
        { 
            "key": "TA", 
            "target": "a32b8a23-5a35-4400-8d22-67233ebfd660" 
        }
    ]
  }
]

Example 2

Structure of the auto_assign object for all other contracts:

[
 { "key":"AI", 
   "target":"a32b8a23-5a35-4400-8d22-67233ebfd660"
 },
 { "key":"SK",
   "target":"95a643eb-6f52-4e78-9e7f-f151dff8fde2"
 },
 { "key":"TA",
   "target":"66a1fab1-2a24-4460-8036-7fb2e8925129"
 } 
]

Typical response

{
    "message": "Assignment created",
    "data": {
        "user_uuid": "f540be02-5939-4f72-81c3-108588382ecc",
        "assignments": {
            "uuid": "c032857d-861b-4478-8503-f502809405b9",
            "denomination_country": "US",
            "assessments": [
                {
                    "assessment_key": "SK",
                    "assessment_uuid": "6208604e-34f6-4e41-a745-97fd20346c13",
                    "assessment_context": "we",
                    "target_type": "group",
                    "target_uuid": "d439be2e-112f-452f-8d0d-4af43e16a811"
                }
            ]
        },
        "member_of": {
            "name": "University of Woolloomooloo",
            "type": "Institution",
            "uuid": "d439be2e-112f-452f-8d0d-4af43e16a811"
        }
    }
}