SCIM 2.0: Create new user
POST
Authorizationheader
Authorization<token>New user
application/json- body
active?booleanActive is a ptr to prevent the empty value from being interpreted as false.
emails?array<>groups?array<unknown>id?stringmeta?name?schemas?array<string>userName?stringOK
application/json- response
active?booleanActive is a ptr to prevent the empty value from being interpreted as false.
emails?array<>groups?array<unknown>id?stringmeta?name?schemas?array<string>userName?stringThe samples read CODER_URL and CODER_SESSION_TOKEN: set up your environment.
curl -X POST \ "$CODER_URL/scim/v2/Users" \ -H "Authorization: {Authorization}" \ -H "Content-Type: application/json" \ -d '{ "active": true, "emails": [ { "display": "string", "primary": true, "type": "string", "value": "[email protected]" } ], "groups": [ null ]}'const { CODER_URL } = process.env;const url = `${CODER_URL}/scim/v2/Users`;const response = await fetch(url, { method: "POST", headers: { Authorization: "{Authorization}", "Content-Type": "application/json", }, body: JSON.stringify({ active: true, emails: [ { display: "string", primary: true, type: "string", value: "[email protected]", }, ], groups: [null], }),});console.log(response.status, await response.text());import osimport requestsurl = os.environ["CODER_URL"] + "/scim/v2/Users"response = requests.post( url, headers={ "Authorization": "{Authorization}", }, json={ "active": True, "emails": [ { "display": "string", "primary": True, "type": "string", "value": "[email protected]", }, ], "groups": [ None, ], },)print(response.status_code, response.text)package mainimport ( "fmt" "io" "net/http" "os" "strings")func main() { body := strings.NewReader(`{ "active": true, "emails": [ { "display": "string", "primary": true, "type": "string", "value": "[email protected]" } ], "groups": [ null ]}`) url := os.Getenv("CODER_URL") + "/scim/v2/Users" req, err := http.NewRequest(http.MethodPost, url, body) if err != nil { panic(err) } req.Header.Set("Authorization", "{Authorization}") req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() out, err := io.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(resp.Status, string(out))}Example Response200
{ "active": true, "emails": [ { "display": "string", "primary": true, "type": "string", "value": "[email protected]" } ], "groups": [ null ], "id": "string", "meta": { "resourceType": "string" }, "name": { "familyName": "string", "givenName": "string" }, "schemas": [ "string" ], "userName": "string"}