Create user API Sample

  • 17 April 2024
  • 4 replies
  • 28 views

Hello,

I'm currently trying to create an user using the api... but it is not working....

I get a 200 response and it returns an array of users.

I'll paste the body here... can you identify a possible problem?

 

Sorry in advance, but I really need help :)

Post  /manage/v1/user/
Auth token from the auth request using password grant type

body:

{

    "userid": "jack.sparrow@mail.com",

    "email": "jack.sparrow@mail.com",

    "password": "BestPirate1.",

    "firstname": "Jack",

    "lastname": "Sparrow",

    "force_change": 0,

    "level": 6,

    "language": "english",

    "expiration": null,

    "email_validation_status": 0,

    "valid": 1,

    "date_format": "en",

    "timezone": 0,

    "manager": {

        "1": null

    },

    "send_notification_email": 1,

    "can_manage_subordinates": false,

    "select_orgchart": {

        "1": 1

    },

    "additional_fields": {

        "1": 0,

        "3": 0,

        "4": 0,

        "5": 0,

        "6": 0,

        "8": "Captain",

        "9": 0,

        "10": 0,

        "11": 0,

        "12": 0,

        "13": 0,

        "15": 0,

        "17": null,

        "18": "Black Pearl",

        "19": "40",

        "20": "45",

        "21": 0

    },

    "employees": {}

}

response 200 with an array of users

 

Can you see any issue?

Do you have a sample that you know it works that I can borrow?


4 replies

Userlevel 7
Badge +3

hey - slightly confused as the response sounds right, I took yours and just got rid of a bunch of the specific local instance related settings 9like additional fields, since we don’t have the same ones) to just check and it worked as expected:

This is what I used, that being said, I did not see anything wrong with your full set as long as all the specific things related to your instance are correct.

{
"userid": "testing18451",
"email": "jack.sparrow2@mail.com",
"password": "BestPirate1.",
"firstname": "Jack",
"lastname": "Sparrow",
"force_change": 0,
"level": 6,
"language": "english",
"expiration": null,
"email_validation_status": 0,
"valid": 1,
"date_format": "en",
"timezone": 0
}

 

@Bfarkas I figured what was happening:

My SSO was not well configured, meaning that for me to create users, i needed to use the “register” endpoint.

After changing the settings, the create endpoint works.

Fun fact: the list of users that the request returns is a list of users pending for approval!

If you have the same problem, try to use the “register” endpoint first before changing your SSO settings (it’s probably being used on a 3rd party software that you don´t know)!

Userlevel 7
Badge +3

Ah, well that makes sense.

Reply