"PATCH /openapi/v1/user/:userId" method

April 19, 2024

ID 242756

Make changes to user data. Moving a company employee to a different training group.

Request

Header:

  • Authorization – the company's API token.

Parameter:

  • userId - a string – Identification code of the specific user being moved to a different group.

    It must satisfy the following criteria:

    • 24 characters in length
    • only lowercase letters

Example of a request:

/openapi/v1/user/1ab2457896abcc1234567891

Body

Format – JSON.

  • groupId – a string – ID of the group to which the company employee will be moved.

    It corresponds to the ID of the "/openapi/v1/groups" method.

    The ID must satisfy the following criteria:

    • 24 characters in length
    • only lowercase letters
  • fullName – a string – The employee's full name.
  • shortName – a string – The employee's short name.
  • email – a string – The employee's email address.

Example of the body of a request:

{

"groupId": "1ab2457896abcc1234567891",

fullName : "Marvin John Mims"

shortName : "Marvin Mims"

email : "mims@mail.com"

}

Response

JSON containing an array of data about each user.

  • userId – a string – the identification code assigned to the user.
  • currentGroup – an object – an array of data about the current user group.

    In the following format:

    {

    id,name

    }

    where:

    • id – a string – the identification key of the current group.
    • name – a string – the name of the current group.
  • previousGroup – an object – an array of data about the previous user group.

    In the following format:

    {

    id,name

    }

    where:

    • id – identifier key of the previous group.
    • name – the name of the previous group.
  • currentFullName – a string – The employee's current full name.

    The parameter is generated only if fullName is indicated in the source JSON.

  • previousFullName – a string – The employee's previous full name.

    The parameter is generated only if fullName is indicated in the source JSON.

  • currentShortName – a string – The employee's current short name.

    The parameter is generated only if shortName is indicated in the source JSON.

  • currentShortName – a string – The employee's previous short name.

    The parameter is generated only if shortName is indicated in the source JSON.

  • currentEmail – a string – The employee's current email address.

    The parameter is generated only if email is indicated in the source JSON.

  • previousEmail – a string – The employee's previous email address.

    The parameter is generated only if email is indicated in the source JSON.

    Example of a response:

    {

    userId : "1ab2457896abcc1234567891",

    "currentGroup" : {id" : "60e050803050c0704080a0e6", "name" : "Rischio ridotto"},

    "previousGroup" : {id" : "61e151813151c1714181a1e6", "name" : "Rischio elevato"},

    "currentFullName" : "Marvin John Mims",

    "previousFullName" : "Marvin Jon Mims",

    "currentShortName" : "Marvin Mims",

    "previousShortName" : "Marvin",

    "currentEmail" : "mims@mail.com",

    "previousEmail" : "johnmims@mail.com"

    }

Possible errors:

  • 200success – The operation succeeded.
  • 400bad request – Something is wrong with the request. The client should not repeat the request without making changes.
  • 400 – user-email-already-exists-in-company – This email address is already being used at the company.
  • 401 - common-unauthorized - There was an authentication error.
  • 402PAYMENT_REQUIRED – The license is not active.
  • 403 – forbidden – The token does not have the right to use this method.
  • 404 – User not found – An incorrect email address was passed.
  • 404 – Group not found – An incorrect group ID was passed. 
  • 409 – User status not supported for this operation – The request cannot be executed; the user's status does not allow the operation to be performed.
  • 409 – User's education plan is being calculated – The request cannot be executed because the training plan is being calculated.
  • 409cannot-join-group – The employee cannot be moved to the group.
  • 500internal-server-error – there was an internal server error.

Did you find this article helpful?
What can we do better?
Thank you for your feedback! You're helping us improve.
Thank you for your feedback! You're helping us improve.