Changer le rôle d'un utilisateur
curl --request PUT \
--url http://localhost:3091/v1/api/superadmin/users/{id}/role \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"newRole": "<string>",
"reason": "<string>"
}
'import requests
url = "http://localhost:3091/v1/api/superadmin/users/{id}/role"
payload = {
"newRole": "<string>",
"reason": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({newRole: '<string>', reason: '<string>'})
};
fetch('http://localhost:3091/v1/api/superadmin/users/{id}/role', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3091",
CURLOPT_URL => "http://localhost:3091/v1/api/superadmin/users/{id}/role",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'newRole' => '<string>',
'reason' => '<string>'
]),
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 := "http://localhost:3091/v1/api/superadmin/users/{id}/role"
payload := strings.NewReader("{\n \"newRole\": \"<string>\",\n \"reason\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", 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.put("http://localhost:3091/v1/api/superadmin/users/{id}/role")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"newRole\": \"<string>\",\n \"reason\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3091/v1/api/superadmin/users/{id}/role")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"newRole\": \"<string>\",\n \"reason\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"firstName": "<string>",
"lastName": "<string>",
"username": "<string>",
"email": "<string>",
"phoneNumber": "<string>",
"nationality": "<string>",
"birthDate": "<string>",
"enabled": true,
"banned": true,
"banReason": "<string>",
"bannedAt": "2023-11-07T05:31:56Z",
"roles": [
"<string>"
],
"walletBalance": 123,
"pendingWithdrawalAmount": 123,
"totalEarned": 123,
"totalWithdrawn": 123,
"stripeConnectedAccountId": "<string>",
"stripeAccountComplete": true,
"kycSubmittedAt": "2023-11-07T05:31:56Z",
"kycReviewedAt": "2023-11-07T05:31:56Z",
"totalAnnonces": 123,
"totalReservationsAsSender": 123,
"totalReservationsAsCarrier": 123,
"totalTransactions": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"lastLoginAt": "2023-11-07T05:31:56Z"
}{
"status": 404,
"errorCode": "RESOURCE_NOT_FOUND",
"message": "Ressource non trouvée",
"timestamp": "2023-11-07T05:31:56Z",
"path": "/v1/api/bookings/123",
"debugInfo": "<string>",
"suggestions": [
"<string>"
],
"fieldErrors": [
{
"field": "email",
"message": "must not be blank",
"rejectedValue": {}
}
]
}{
"status": 404,
"errorCode": "RESOURCE_NOT_FOUND",
"message": "Ressource non trouvée",
"timestamp": "2023-11-07T05:31:56Z",
"path": "/v1/api/bookings/123",
"debugInfo": "<string>",
"suggestions": [
"<string>"
],
"fieldErrors": [
{
"field": "email",
"message": "must not be blank",
"rejectedValue": {}
}
]
}{
"status": 404,
"errorCode": "RESOURCE_NOT_FOUND",
"message": "Ressource non trouvée",
"timestamp": "2023-11-07T05:31:56Z",
"path": "/v1/api/bookings/123",
"debugInfo": "<string>",
"suggestions": [
"<string>"
],
"fieldErrors": [
{
"field": "email",
"message": "must not be blank",
"rejectedValue": {}
}
]
}{
"id": 123,
"firstName": "<string>",
"lastName": "<string>",
"username": "<string>",
"email": "<string>",
"phoneNumber": "<string>",
"nationality": "<string>",
"birthDate": "<string>",
"enabled": true,
"banned": true,
"banReason": "<string>",
"bannedAt": "2023-11-07T05:31:56Z",
"roles": [
"<string>"
],
"walletBalance": 123,
"pendingWithdrawalAmount": 123,
"totalEarned": 123,
"totalWithdrawn": 123,
"stripeConnectedAccountId": "<string>",
"stripeAccountComplete": true,
"kycSubmittedAt": "2023-11-07T05:31:56Z",
"kycReviewedAt": "2023-11-07T05:31:56Z",
"totalAnnonces": 123,
"totalReservationsAsSender": 123,
"totalReservationsAsCarrier": 123,
"totalTransactions": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"lastLoginAt": "2023-11-07T05:31:56Z"
}{
"status": 404,
"errorCode": "RESOURCE_NOT_FOUND",
"message": "Ressource non trouvée",
"timestamp": "2023-11-07T05:31:56Z",
"path": "/v1/api/bookings/123",
"debugInfo": "<string>",
"suggestions": [
"<string>"
],
"fieldErrors": [
{
"field": "email",
"message": "must not be blank",
"rejectedValue": {}
}
]
}Gestion utilisateurs
Modifier le rôle d'un utilisateur
PUT
/
v1
/
api
/
superadmin
/
users
/
{id}
/
role
Changer le rôle d'un utilisateur
curl --request PUT \
--url http://localhost:3091/v1/api/superadmin/users/{id}/role \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"newRole": "<string>",
"reason": "<string>"
}
'import requests
url = "http://localhost:3091/v1/api/superadmin/users/{id}/role"
payload = {
"newRole": "<string>",
"reason": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({newRole: '<string>', reason: '<string>'})
};
fetch('http://localhost:3091/v1/api/superadmin/users/{id}/role', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3091",
CURLOPT_URL => "http://localhost:3091/v1/api/superadmin/users/{id}/role",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'newRole' => '<string>',
'reason' => '<string>'
]),
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 := "http://localhost:3091/v1/api/superadmin/users/{id}/role"
payload := strings.NewReader("{\n \"newRole\": \"<string>\",\n \"reason\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", 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.put("http://localhost:3091/v1/api/superadmin/users/{id}/role")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"newRole\": \"<string>\",\n \"reason\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3091/v1/api/superadmin/users/{id}/role")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"newRole\": \"<string>\",\n \"reason\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"firstName": "<string>",
"lastName": "<string>",
"username": "<string>",
"email": "<string>",
"phoneNumber": "<string>",
"nationality": "<string>",
"birthDate": "<string>",
"enabled": true,
"banned": true,
"banReason": "<string>",
"bannedAt": "2023-11-07T05:31:56Z",
"roles": [
"<string>"
],
"walletBalance": 123,
"pendingWithdrawalAmount": 123,
"totalEarned": 123,
"totalWithdrawn": 123,
"stripeConnectedAccountId": "<string>",
"stripeAccountComplete": true,
"kycSubmittedAt": "2023-11-07T05:31:56Z",
"kycReviewedAt": "2023-11-07T05:31:56Z",
"totalAnnonces": 123,
"totalReservationsAsSender": 123,
"totalReservationsAsCarrier": 123,
"totalTransactions": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"lastLoginAt": "2023-11-07T05:31:56Z"
}{
"status": 404,
"errorCode": "RESOURCE_NOT_FOUND",
"message": "Ressource non trouvée",
"timestamp": "2023-11-07T05:31:56Z",
"path": "/v1/api/bookings/123",
"debugInfo": "<string>",
"suggestions": [
"<string>"
],
"fieldErrors": [
{
"field": "email",
"message": "must not be blank",
"rejectedValue": {}
}
]
}{
"status": 404,
"errorCode": "RESOURCE_NOT_FOUND",
"message": "Ressource non trouvée",
"timestamp": "2023-11-07T05:31:56Z",
"path": "/v1/api/bookings/123",
"debugInfo": "<string>",
"suggestions": [
"<string>"
],
"fieldErrors": [
{
"field": "email",
"message": "must not be blank",
"rejectedValue": {}
}
]
}{
"status": 404,
"errorCode": "RESOURCE_NOT_FOUND",
"message": "Ressource non trouvée",
"timestamp": "2023-11-07T05:31:56Z",
"path": "/v1/api/bookings/123",
"debugInfo": "<string>",
"suggestions": [
"<string>"
],
"fieldErrors": [
{
"field": "email",
"message": "must not be blank",
"rejectedValue": {}
}
]
}{
"id": 123,
"firstName": "<string>",
"lastName": "<string>",
"username": "<string>",
"email": "<string>",
"phoneNumber": "<string>",
"nationality": "<string>",
"birthDate": "<string>",
"enabled": true,
"banned": true,
"banReason": "<string>",
"bannedAt": "2023-11-07T05:31:56Z",
"roles": [
"<string>"
],
"walletBalance": 123,
"pendingWithdrawalAmount": 123,
"totalEarned": 123,
"totalWithdrawn": 123,
"stripeConnectedAccountId": "<string>",
"stripeAccountComplete": true,
"kycSubmittedAt": "2023-11-07T05:31:56Z",
"kycReviewedAt": "2023-11-07T05:31:56Z",
"totalAnnonces": 123,
"totalReservationsAsSender": 123,
"totalReservationsAsCarrier": 123,
"totalTransactions": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"lastLoginAt": "2023-11-07T05:31:56Z"
}{
"status": 404,
"errorCode": "RESOURCE_NOT_FOUND",
"message": "Ressource non trouvée",
"timestamp": "2023-11-07T05:31:56Z",
"path": "/v1/api/bookings/123",
"debugInfo": "<string>",
"suggestions": [
"<string>"
],
"fieldErrors": [
{
"field": "email",
"message": "must not be blank",
"rejectedValue": {}
}
]
}Authorizations
JWT access token from POST /v1/api/auth/login
Path Parameters
Response
Role changed
Available options:
PENDING, APPROVED, REJECTED, EXPIRED ⌘I