Turso Cloud API 参考 接口资源 成员管理
更新成员角色
更新组织成员的角色。只有组织管理员或所有者可以执行此操作。
PATCH
https://api.turso.tech/v1/organizations/{organizationSlug}/members/{username} curl -L -X PATCH https://api.turso.tech/v1/organizations/{organizationSlug}/members/{username} \
-H 'Authorization: Bearer TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"role": "member"
}'
OpenAPI
openapi: 3.0.1
info:
title: Turso Platform API
description: API description here
license:
name: MIT
version: 0.1.0
servers:
- url: https://api.turso.tech
description: Turso's Platform API
security: []
paths:
/v1/organizations/{organizationSlug}/members/{username}:
patch:
summary: Update Member Role
description: >-
Update the role of an organization member. Only organization admins or
owners can perform this action.
operationId: updateMemberRole
parameters:
- $ref: '#/components/parameters/organizationSlug'
- $ref: '#/components/parameters/username'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
role:
type: string
enum:
- admin
- member
- viewer
description: The new role to assign to the member.
required:
- role
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: object
properties:
member:
type: object
properties:
username:
type: string
description: The username of the updated member.
email:
type: string
description: The email of the updated member.
role:
type: string
description: The new role of the updated member.
enum:
- admin
- member
- viewer
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
error:
type: string
description: The error message
example: invalid role
'403':
description: Forbidden
content:
application/json:
schema:
type: object
properties:
error:
type: string
description: The error message
example: updating member roles is only allowed for admin or owner
'404':
description: Not Found
content:
application/json:
schema:
type: object
properties:
error:
type: string
description: The error message
example: could not find user [username]
components:
parameters:
organizationSlug:
in: path
name: organizationSlug
required: true
schema:
type: string
description: The slug of the organization or user account.
username:
name: username
in: path
required: true
schema:
type: string
description: The username of a Turso user or organization member.
同步自官方 Turso 文档仓库 (
tursodatabase/turso-docs
· MIT 开源协议)
查看官方原文 ↗