Skip to content

Update Resource

Update resource properties and permissions.

Endpoint

/api/v1/projects/{project_id}/resources/{resource_id}

Method

PUT

Path Parameters

ParameterTypeRequiredDescription
project_idstringYesUnique ID of the project
resource_idstringYesUnique ID of the resource

Headers

HeaderRequiredDescription
Content-TypeYesapplication/json
AuthorizationYesBearer access token: Bearer <access_token>

Request Body

FieldTypeRequiredDescription
namestringYesResource name (max 50 chars)
codestringYesResource code (max 50 chars)
descriptionstringNoDescription (max 200 chars)
permissionsarray of objectsNoList of permissions (name, code, description)

Required Permission

resources:update

Examples

curl --request PUT \
  --url https://auth.roled.id/api/v1/projects/2JUSLUee46xG6iEwG8JwPc/resources/2JUUyotLU97ZghzqwrqE6o \
  --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJo...' \
  --header 'Content-Type: application/json' \
  --data '{
    "name": "Products",
    "code": "products",
    "description": "Product catalog with inventory and publishing features",
    "permissions": [
      {
        "name": "Create",
        "code": "create",
        "description": "Create a new product"
      },
      {
        "name": "Read",
        "code": "read",
        "description": "List and view products"
      },
      {
        "name": "Update",
        "code": "update",
        "description": "Edit an existing product"
      },
      {
        "name": "Delete",
        "code": "delete",
        "description": "Remove a product"
      },
      {
        "name": "Publish",
        "code": "publish",
        "description": "Publish a product listing"
      }
    ]
  }'

Error Codes

CodeHTTP StatusDescription
invalid_params400Missing or invalid request params, headers, or body
invalid_authorization_token401Missing or invalid authorization token
insufficient_permission403Insufficient permission
project_not_found404Project not found
resource_not_found404Resource not found
resource_code_already_used409Resource with the same code already exists
system_error500Internal server error