Invite a User

Invite a user by email

{info} This will trigger an invitation email notification. If the email does not belong to an existing user, a registration link will be send to the emailadres.


Method Uri Auth Role
POST /v1/users Bearer JWT-Token admin

Headers

The API requires a header Accept and Authorization to be submitted with the request:

{
    "Accept": "application/json",
    "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3M..." 
}

Data constraints

{
    "email":      ["required", "email", "unique:users,email"],
    "role":       ["required","exists:roles,name"],
    "firstName":  ["string"],
    "lastName":   ["string"],
    "role":       ["required","exists:roles,name"],
    "groups":     ["array"], // must be an array
    "groups.*":   ["exists:groups,id"] // each item must exist in permissions table
}

Success Responses

Condition : All required data provided is valid and added to the request body.

Code : 201 Created

Error Responses

Condition : If the request body is incorrect or not complete

Code : 422 Unprocessable Entity

Content example :

{
  "message": "De opgegeven informatie bevat fouten.",
  "errors": {
    "email": [
      "The email field is required."
    ]
  }
}

Condition : If the user is not logged in or header data is imcomplete.

Code : 401 Unauthorized

Content example :

{
  "message": "Je moet zijn ingelogd om dit te kunnen doen.",
  "errors": [
    "Unauthenticated."
  ]
}