Set User Role
Admin
This endpoint allows an administrator to set a user's subscription tier.
Set User Role Request Body - Contains the user ID and the new tier ID.
tier_idinteger
Range
1 <= value
user_idstring
Response Body
curl -X POST "https://andamio-api-308006323670.us-central1.run.app/api/v1/admin/set-user-role" \
-H "Content-Type: application/json" \
-d '{
"tier_id": 2,
"user_id": "123e4567-e89b-12d3-a456-426614174000"
}'
const body = JSON.stringify({
"tier_id": 2,
"user_id": "123e4567-e89b-12d3-a456-426614174000"
})
fetch("https://andamio-api-308006323670.us-central1.run.app/api/v1/admin/set-user-role", {
body
})
package main
import (
"fmt"
"net/http"
"io/ioutil"
"strings"
)
func main() {
url := "https://andamio-api-308006323670.us-central1.run.app/api/v1/admin/set-user-role"
body := strings.NewReader(`{
"tier_id": 2,
"user_id": "123e4567-e89b-12d3-a456-426614174000"
}`)
req, _ := http.NewRequest("POST", url, body)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
import requests
url = "https://andamio-api-308006323670.us-central1.run.app/api/v1/admin/set-user-role"
body = {
"tier_id": 2,
"user_id": "123e4567-e89b-12d3-a456-426614174000"
}
response = requests.request("POST", url, json = body, headers = {
"Content-Type": "application/json"
})
print(response.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import java.time.Duration;
import java.net.http.HttpRequest.BodyPublishers;
var body = BodyPublishers.ofString("""{
"tier_id": 2,
"user_id": "123e4567-e89b-12d3-a456-426614174000"
}""");
HttpClient client = HttpClient.newBuilder()
.connectTimeout(Duration.ofSeconds(10))
.build();
HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()
.uri(URI.create("https://andamio-api-308006323670.us-central1.run.app/api/v1/admin/set-user-role"))
.header("Content-Type", "application/json")
.POST(body)
.build();
try {
HttpResponse<String> response = client.send(requestBuilder.build(), BodyHandlers.ofString());
System.out.println("Status code: " + response.statusCode());
System.out.println("Response body: " + response.body());
} catch (Exception e) {
e.printStackTrace();
}
using System;
using System.Net.Http;
using System.Text;
var body = new StringContent("""
{
"tier_id": 2,
"user_id": "123e4567-e89b-12d3-a456-426614174000"
}
""", Encoding.UTF8, "application/json");
var client = new HttpClient();
var response = await client.PostAsync("https://andamio-api-308006323670.us-central1.run.app/api/v1/admin/set-user-role", body);
var responseBody = await response.Content.ReadAsStringAsync();
{
"message": "User role updated successfully.",
"tier_id": 2,
"user_id": "123e4567-e89b-12d3-a456-426614174000"
}
{
"details": "string",
"message": "Bad Request: Invalid input.",
"statusCode": 400
}
{
"details": "string",
"message": "Unauthorized: Invalid or missing credentials.",
"statusCode": 401
}
{
"details": "string",
"message": "Forbidden: Insufficient permissions or tier access.",
"statusCode": 403
}
{
"details": "string",
"message": "Not Found: The requested resource could not be found.",
"statusCode": 404
}
{
"details": "string",
"message": "Unprocessable Entity: Invalid request structure or data.",
"statusCode": 422
}
{
"details": "string",
"message": "Too Many Requests: Rate limit or quota exceeded.",
"statusCode": 429
}
{
"details": "string",
"message": "Internal Server Error: An unexpected error occurred.",
"statusCode": 500
}