Create a User
curl --request POST \
--url https://identity.sandbox.lerian.net/v1/users \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "john@example.com",
"firstName": "John",
"lastName": "Doe",
"password": "Lerian@123456",
"username": "johndoe",
"groups": [
"admin-group",
"midaz-viewer-group"
]
}
'import requests
url = "https://identity.sandbox.lerian.net/v1/users"
payload = {
"email": "john@example.com",
"firstName": "John",
"lastName": "Doe",
"password": "Lerian@123456",
"username": "johndoe",
"groups": ["admin-group", "midaz-viewer-group"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: 'john@example.com',
firstName: 'John',
lastName: 'Doe',
password: 'Lerian@123456',
username: 'johndoe',
groups: ['admin-group', 'midaz-viewer-group']
})
};
fetch('https://identity.sandbox.lerian.net/v1/users', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://identity.sandbox.lerian.net/v1/users",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email' => 'john@example.com',
'firstName' => 'John',
'lastName' => 'Doe',
'password' => 'Lerian@123456',
'username' => 'johndoe',
'groups' => [
'admin-group',
'midaz-viewer-group'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://identity.sandbox.lerian.net/v1/users"
payload := strings.NewReader("{\n \"email\": \"john@example.com\",\n \"firstName\": \"John\",\n \"lastName\": \"Doe\",\n \"password\": \"Lerian@123456\",\n \"username\": \"johndoe\",\n \"groups\": [\n \"admin-group\",\n \"midaz-viewer-group\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://identity.sandbox.lerian.net/v1/users")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"john@example.com\",\n \"firstName\": \"John\",\n \"lastName\": \"Doe\",\n \"password\": \"Lerian@123456\",\n \"username\": \"johndoe\",\n \"groups\": [\n \"admin-group\",\n \"midaz-viewer-group\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://identity.sandbox.lerian.net/v1/users")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"john@example.com\",\n \"firstName\": \"John\",\n \"lastName\": \"Doe\",\n \"password\": \"Lerian@123456\",\n \"username\": \"johndoe\",\n \"groups\": [\n \"admin-group\",\n \"midaz-viewer-group\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "019c96a0-0c21-71f9-a487-66a1258278a1",
"firstName": "John",
"lastName": "Doe",
"email": "john@example.com",
"username": "johndoe",
"groups": [
"admin-group",
"midaz-viewer-group"
]
}Create a User
Use this endpoint to create a user access and assign it to a permission group in a single step.
POST
/
v1
/
users
Create a User
curl --request POST \
--url https://identity.sandbox.lerian.net/v1/users \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "john@example.com",
"firstName": "John",
"lastName": "Doe",
"password": "Lerian@123456",
"username": "johndoe",
"groups": [
"admin-group",
"midaz-viewer-group"
]
}
'import requests
url = "https://identity.sandbox.lerian.net/v1/users"
payload = {
"email": "john@example.com",
"firstName": "John",
"lastName": "Doe",
"password": "Lerian@123456",
"username": "johndoe",
"groups": ["admin-group", "midaz-viewer-group"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: 'john@example.com',
firstName: 'John',
lastName: 'Doe',
password: 'Lerian@123456',
username: 'johndoe',
groups: ['admin-group', 'midaz-viewer-group']
})
};
fetch('https://identity.sandbox.lerian.net/v1/users', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://identity.sandbox.lerian.net/v1/users",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email' => 'john@example.com',
'firstName' => 'John',
'lastName' => 'Doe',
'password' => 'Lerian@123456',
'username' => 'johndoe',
'groups' => [
'admin-group',
'midaz-viewer-group'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://identity.sandbox.lerian.net/v1/users"
payload := strings.NewReader("{\n \"email\": \"john@example.com\",\n \"firstName\": \"John\",\n \"lastName\": \"Doe\",\n \"password\": \"Lerian@123456\",\n \"username\": \"johndoe\",\n \"groups\": [\n \"admin-group\",\n \"midaz-viewer-group\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://identity.sandbox.lerian.net/v1/users")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"john@example.com\",\n \"firstName\": \"John\",\n \"lastName\": \"Doe\",\n \"password\": \"Lerian@123456\",\n \"username\": \"johndoe\",\n \"groups\": [\n \"admin-group\",\n \"midaz-viewer-group\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://identity.sandbox.lerian.net/v1/users")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"john@example.com\",\n \"firstName\": \"John\",\n \"lastName\": \"Doe\",\n \"password\": \"Lerian@123456\",\n \"username\": \"johndoe\",\n \"groups\": [\n \"admin-group\",\n \"midaz-viewer-group\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "019c96a0-0c21-71f9-a487-66a1258278a1",
"firstName": "John",
"lastName": "Doe",
"email": "john@example.com",
"username": "johndoe",
"groups": [
"admin-group",
"midaz-viewer-group"
]
}Authorizations
The authorization token in the 'Bearer ' format.
Body
application/json
Information about the user.
User's email address.
User's first name.
User's last name.
User's password for authentication.
User's username.
Array of user role groups IDs. Role groups IDs can be retrieved through the List Groups endpoint.
Response
Indicates that the resource was successfully created and the operation was completed as expected.
Was this page helpful?
⌘I

