Create User by Template
Stworzenie użytkownika na podstawie szablonu
POST /user_template/{template_id}/user
URL Parameters
Nazwa | Rodzaj | Opcjonalne | Opis |
---|---|---|---|
template_id | <STRING> |
5f75929af03d6422459f7240 | Identyfikator szablonu użytkownika UserTemplate |
Response Body
{
"data": <TenantUser>
}
Response Code
Status | Opis |
---|---|
200 | Żądanie przyjęte do realizacji |
400 | Niepoprawne dane |
503 | Serwis niedostępny |
Example
curl -X POST \
$CONPEEK_URL/user_template/5f75929af03d6422459f7240/user \
-H 'Authorization: '$CONPEEK_KEY \
-H 'Content-Type: application/json' \
-d '{"data": {
"username": "XYZ",
"password": PASSWORD
}}'
import requests
import json
import os
from urllib import parse
url = parse.urljoin(os.environ["CONPEEK_URL"], "/user_template/%(template_id)s/user" % {
"template_id": "5f75929af03d6422459f7240"
})
payload = {
"data": {
"username": "XYZ",
"password": "PASSWORD"
}
}
headers = {
'Content-Type': "application/json",
'Authorization': os.environ["CONPEEK_KEY"]
}
response = requests.request("POST", url, data=json.dumps(payload), headers=headers)
print(response.text)
<?php
$curl = curl_init();
$payload = array(
"data" => array(
"username" => "XYZ",
"password" => "PASSWORD"
)
);
$template_id = "5b7c389fe8df7b60af688989";
curl_setopt_array($curl, array(
CURLOPT_URL => getenv("CONPEEK_URL")."/user_template/$template_id/user",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_PUTFIELDS => json_encode($payload),
CURLOPT_HTTPHEADER => array(
"Authorization: ".getenv("CONPEEK_KEY"),
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}