User Create Token
Utworzenie tokenu do zalogowania się
POST /tenant_user/{tenant_user_id}/token
URL Parameters
Nazwa | Rodzaj | Opcjonalne | Opis |
---|---|---|---|
tenant_user_id | <STRING> |
7 | Identyfikator użytkownika TenantUser |
Response Body
{
"token": <Token>
}
Response Code
Status | Opis |
---|---|
200 | Żądanie zakończone pomyślnie |
400 | Niepoprawne dane |
404 | Nie znaleziono zasobu |
Example
curl -X POST \
$CONPEEK_URL/tenant_user/7/token \
-H 'Authorization: '$CONPEEK_KEY \
-H 'Content-Type: application/json'
import requests
import json
import os
from urllib import parse
url = parse.urljoin(os.environ["CONPEEK_URL"], "/tenant_user/%(tenant_user_id)s/token" % {
"tenant_user_id": "7"
})
headers = {
'Content-Type': "application/json",
'Authorization': os.environ["CONPEEK_KEY"]
}
response = requests.request("POST", url, headers=headers)
print(response.text)
<?php
$curl = curl_init();
$tenant_user_id = "7";
curl_setopt_array($curl, array(
CURLOPT_URL => getenv("CONPEEK_URL")."/tenant_user/$tenant_user_id/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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;
}