core_users_create
POST/api/v3//core/users/
User Viewset
Request
- application/json
Body
required
Possible values: non-empty
and <= 150 characters
User's display name.
Designates whether this user should be treated as active. Unselect this instead of deleting accounts.
Possible values: <= 254 characters
attributes
object
Possible values: non-empty
Possible values: [internal
, external
, service_account
, internal_service_account
]
Responses
- 201
- 400
- 403
- application/json
- Schema
- Example (from schema)
Schema
Possible values: <= 150 characters
User's display name.
Designates whether this user should be treated as active. Unselect this instead of deleting accounts.
groups_obj
object[]
nullable
required
Possible values: <= 254 characters
User's avatar, either a http/https URL or a data URI
attributes
object
Possible values: [internal
, external
, service_account
, internal_service_account
]
{
"pk": 0,
"username": "string",
"name": "string",
"is_active": true,
"last_login": "2024-07-29T15:51:28.071Z",
"is_superuser": true,
"groups": [
"3fa85f64-5717-4562-b3fc-2c963f66afa6"
],
"groups_obj": [
{
"pk": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"num_pk": 0,
"name": "string",
"is_superuser": true,
"parent": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"parent_name": "string",
"attributes": {}
}
],
"email": "[email protected]",
"avatar": "string",
"attributes": {},
"uid": "string",
"path": "string",
"type": "internal",
"uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
- application/json
- Schema
- Example (from schema)
Schema
Validation Error
{
"non_field_errors": [
"string"
],
"code": "string"
}
- application/json
- Schema
- Example (from schema)
Schema
{
"detail": "string",
"code": "string"
}
Authorization: http
name: authentiktype: httpscheme: bearer
- csharp
- curl
- dart
- go
- http
- java
- javascript
- kotlin
- c
- nodejs
- objective-c
- ocaml
- php
- powershell
- python
- r
- ruby
- rust
- shell
- swift
- HTTPCLIENT
- RESTSHARP
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "/api/v3/core/users/");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <TOKEN>");
var content = new StringContent("{\n \"username\": \"string\",\n \"name\": \"string\",\n \"is_active\": true,\n \"last_login\": \"2024-07-29T15:51:28.071Z\",\n \"groups\": [\n \"3fa85f64-5717-4562-b3fc-2c963f66afa6\"\n ],\n \"email\": \"[email protected]\",\n \"attributes\": {},\n \"path\": \"string\",\n \"type\": \"internal\"\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());