본문 바로가기
WIKI 기술 지식 베이스

멤버 역할 업데이트

원문 보기 위키 갱신

조직 멤버의 역할을 바꾸는 API예요. 조직의 admin 또는 owner만 이 작업을 할 수 있어요.

출처: 문서

본문

조직 멤버의 역할을 업데이트해요. 조직의 admin 또는 owner만 이 작업을 수행할 수 있어요.

curl -L -X PATCH https://api.turso.tech/v1/organizations/{organizationSlug}/members/{username} \
  -H 'Authorization: Bearer ***' \
  -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.

더 알아보기 (Learn more)