PATCH /v2/users/:id
Update a user
PUT /v2/users/:id
Update a user
live_help Notes
Advanced tutor
settings Params
| Param name | Description |
|---|---|
| id |
required
. Must be String
The requested id |
| user | optional , nil allowed . Must be a Hash |
| user[login] |
optional
, nil allowed
. Must be String
The login. Default to . Must be unique. |
| user[email] |
optional
. Must be String
The email. Default to . Must be unique. |
| user[first_name] |
optional
. Must be String
The first name. |
| user[last_name] |
optional
. Must be String
The last name. |
| user[usual_first_name] |
optional
. Must be String
The usual first name. Maximum length is 42. |
| user[password] |
optional
, nil allowed
. Must be String
The password. |
| user[pool_year] |
optional
. Must be String
The pool year. |
| user[pool_month] |
optional
. Must be String
The pool month. |
| user[kind] |
optional
. Must be one of: admin, student, external.
The kind. |
| user[status] |
optional
, nil allowed
. Must be String
The status. |
| user[image] |
optional
, nil allowed
. Must be File
The image. Allow blank length is true. Allow nil length is true. Minimum length is 3072. Maximum length is 1048576. |
| user[campus_id] |
optional
, nil allowed
. Must be String
The campus id. |
| user[cursus_id] |
optional
, nil allowed
. Must be String
The cursus id. |
| user[email_stop] |
optional
, nil allowed
. Must be one of: true, false.
Is it email stop ? Default to false. |
| user[skip_welcome_mail] |
optional
, nil allowed
. Must be String
The skip welcome mail. |
| user[user_candidature_attributes] |
optional
, nil allowed
. Must be an Array of nested elements
The user candidature attributes. |
| user[user_candidature_attributes][id] |
optional
, nil allowed
. Must be Fixnum
The id. |
| user[user_candidature_attributes][user_id] |
optional
, nil allowed
. Must be Fixnum
The user id. |
| user[user_candidature_attributes][birth_date] |
optional
, nil allowed
. Must be Fixnum
The birth date. Must be at least 13 years ago. must be at most 99 years ago. |
| user[user_candidature_attributes][gender] |
optional
, nil allowed
. Must be one of: male, female, other.
The gender. |
| user[user_candidature_attributes][zip_code] |
optional
, nil allowed
. Must be String
The zip code. |
| user[user_candidature_attributes][country] |
optional
, nil allowed
. Must be String
The country. |
| user[user_candidature_attributes][phone_country_code] |
optional
, nil allowed
. Must be one of: AD, AE, AF, AG, AI, AL, AM, AN, AO, AQ, AR, AS, AT, AU, AW, AX, AZ, BA, BB, BD, BE, BF, BG, BH, BI, BJ, BL, BM, BN, BO, BQ, BR, BS, BT, BV, BW, BY, BZ, CA, CC, CD, CF, CG, CH, CI, CK, CL, CM, CN, CO, CR, CU, CV, CW, CX, CY, CZ, DE, DJ, DK, DM, DO, DZ, EC, EE, EG, EH, ER, ES, ET, FI, FJ, FK, FM, FO, FR, GA, GB, GD, GE, GF, GG, GH, GI, GL, GM, GN, GP, GQ, GR, GS, GT, GU, GW, GY, HK, HM, HN, HR, HT, HU, ID, IE, IL, IM, IN, IO, IQ, IR, IS, IT, JE, JM, JO, JP, KE, KG, KH, KI, KM, KN, KP, KR, KW, KY, KZ, LA, LB, LC, LI, LK, LR, LS, LT, LU, LV, LY, MA, MC, MD, ME, MF, MG, MH, MK, ML, MM, MN, MO, MP, MQ, MR, MS, MT, MU, MV, MW, MX, MY, MZ, NA, NC, NE, NF, NG, NI, NL, NO, NP, NR, NU, NZ, OM, PA, PE, PF, PG, PH, PK, PL, PM, PN, PR, PS, PT, PW, PY, QA, RE, RO, RS, RU, RW, SA, SB, SC, SD, SE, SG, SH, SI, SJ, SK, SL, SM, SN, SO, SR, SS, ST, SV, SX, SY, SZ, TC, TD, TF, TG, TH, TJ, TK, TL, TM, TN, TO, TR, TT, TV, TW, TZ, UA, UG, UM, US, UY, UZ, VA, VC, VE, VG, VI, VN, VU, WF, WS, XK, YE, YT, ZA, ZM, ZW, .
The phone country code. |
| user[user_candidature_attributes][birth_city] |
optional
, nil allowed
. Must be String
The birth city. |
| user[user_candidature_attributes][birth_country] |
optional
, nil allowed
. Must be String
The birth country. |
| user[user_candidature_attributes][postal_street] |
optional
, nil allowed
. Must be String
The postal street. |
| user[user_candidature_attributes][postal_complement] |
optional
, nil allowed
. Must be String
The postal complement. |
| user[user_candidature_attributes][postal_city] |
optional
, nil allowed
. Must be String
The postal city. |
| user[user_candidature_attributes][postal_zip_code] |
optional
, nil allowed
. Must be String
The postal zip code. |
| user[user_candidature_attributes][postal_country] |
optional
, nil allowed
. Must be String
The postal country. |
| user[user_candidature_attributes][contact_affiliation] |
optional
, nil allowed
. Must be String
The contact affiliation. |
| user[user_candidature_attributes][contact_last_name] |
optional
, nil allowed
. Must be String
The contact last name. |
| user[user_candidature_attributes][contact_first_name] |
optional
, nil allowed
. Must be String
The contact first name. |
| user[user_candidature_attributes][contact_phone1] |
optional
, nil allowed
. Must be String
The contact phone1. |
| user[user_candidature_attributes][contact_phone2] |
optional
, nil allowed
. Must be String
The contact phone2. |
| user[user_candidature_attributes][max_level_memory] |
optional
, nil allowed
. Must be Fixnum
The max level memory. |
| user[user_candidature_attributes][max_level_logic] |
optional
, nil allowed
. Must be Fixnum
The max level logic. |
| user[user_candidature_attributes][other_information] |
optional
, nil allowed
. Must be String
The other information. |
| user[user_candidature_attributes][language] |
optional
, nil allowed
. Must be String
The language. |
| user[user_candidature_attributes][meeting_date] |
optional
, nil allowed
. Must be DateTime
The meeting date. |
| user[user_candidature_attributes][piscine_date] |
optional
, nil allowed
. Must be String
The piscine date. |
| user[user_candidature_attributes][email] |
optional
, nil allowed
. Must be String
The email. |
| user[user_candidature_attributes][pin] |
optional
, nil allowed
. Must be String
The pin. |
| user[user_candidature_attributes][phone] |
optional
, nil allowed
. Must be String
The phone. |
| user[cursus_users_attributes] |
optional
, nil allowed
. Must be an Array of nested elements
The cursus users attributes. |
| user[cursus_users_attributes][id] |
optional
, nil allowed
. Must be Fixnum
The id. |
| user[cursus_users_attributes][cursus_id] |
optional
. Must be Fixnum
The cursus id. Must be unique in the scope of a given user. |
| user[cursus_users_attributes][end_at] |
optional
, nil allowed
. Must be Fixnum
The end at… . |
| user[cursus_users_attributes][begin_at] |
optional
. Must be Fixnum
The begin at… |
| user[cursus_users_attributes][_destroy] |
optional
, nil allowed
. Must be String
The destroy. |
| user[languages_users_attributes] |
optional
, nil allowed
. Must be an Array of nested elements
The languages users attributes. |
| user[languages_users_attributes][id] |
optional
, nil allowed
. Must be Fixnum
The id. |
| user[languages_users_attributes][language_id] |
optional
. Must be Fixnum
The language id. |
| user[languages_users_attributes][position] |
optional
, nil allowed
. Must be Fixnum
The position. |
| user[languages_users_attributes][_destroy] |
optional
, nil allowed
. Must be String
The destroy. |
Examples
PUT /v2/users/2
{
"user": {
"campus_id": "1",
"email": "[email protected]",
"first_name": "Anakin",
"kind": "student",
"last_name": "Skywalker",
"password": "totoroTOTOROOO",
"pool_month": "september",
"pool_year": "2017",
"status": "admis"
}
}
204
curl -X PUT -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"user":{"campus_id":"1","email":"[email protected]","first_name":"Anakin","kind":"student","last_name":"Skywalker","password":"totoroTOTOROOO","pool_month":"september","pool_year":"2017","status":"admis"}}' "https://api.intra.42.fr/v2/users/2"
require "oauth2"
UID = "Your application uid"
SECRET = "Your application secret"
client = OAuth2::Client.new(UID, SECRET, site: "https://api.intra.42.fr")
token = client.client_credentials.get_token
params = {user: {campus_id: "1", email: "[email protected]", first_name: "Anakin", kind: "student", last_name: "Skywalker", password: "totoroTOTOROOO", pool_month: "september", pool_year: "2017", status: "admis"}}
response = token.put("/v2/users/2", params: params)
response.status
# => 204
response.parsed
# =>