Skip to content
Niu DocsNiu 牛元文档
Dashboard控制台

Save current member appearance preference

Generated from the checked-in source. Do not edit this reference by hand.

PUT /api/v1/auth/preferences

Current authenticated member only; the target member is derived from authentication, never supplied by the caller. Requires an operator/member session with Read permission; installation bearer credentials are rejected. Browser member-cookie sessions are also supported by the existing authentication middleware. All responses carry Cache-Control: no-store. When password authentication is configured, cookie/browser writes require a valid Origin and cookie-request checks; bearer writes validate Origin when supplied. Saves one of system, light or dark. This endpoint has no revision precondition; subsequent accepted writes replace the saved mode. Route body limit is 1024 bytes; rejected bodies are mapped to JSON invalid-request errors.

Operation: updateMemberPreferences.

Use the credential and permission scope described above. Each object below is an alternative; schemes within one object are required together.

JSON
[
{
"bearerAuth": []
}
]

Set NIU_ORIGIN to your installation origin (without /v1). Replace path, query and header placeholders with the required values. Query examples use curl 7.87 or newer to encode values with --url-query. Use the credential scope described above; a bearer token must have the authority required by this operation.

Shell
curl --fail-with-body -X PUT "$NIU_ORIGIN/api/v1/auth/preferences" \
-H "Authorization: Bearer $NIU_BEARER_TOKEN" \
-H 'Content-Type: application/json' \
--data @request.json

No path, query, or header parameters are declared.

Required.

JSON
{
"type": "object",
"additionalProperties": false,
"required": [
"color_mode"
],
"properties": {
"color_mode": {
"type": "string",
"enum": [
"system",
"light",
"dark"
]
}
}
}

Current saved member data.

Response headers:

JSON
{
"Cache-Control": {
"schema": {
"type": "string",
"const": "no-store"
}
}
}

Content type: application/json.

JSON
{
"type": "object",
"required": [
"data"
],
"properties": {
"data": {
"type": "object",
"required": [
"color_mode"
],
"properties": {
"color_mode": {
"type": "string",
"enum": [
"system",
"light",
"dark"
]
}
}
}
}
}

Invalid JSON, unknown fields or invalid input.

Missing, invalid or revoked member authentication.

Read permission required; installation credentials cannot access member data, or a write failed origin/cookie checks.

Durable storage unavailable.

Current authenticated member only; the target member is derived from authentication, never supplied by the caller. Requires an operator/member session with Read permission; installation bearer credentials are rejected. Browser member-cookie sessions are also supported by the existing authentication middleware. All responses carry Cache-Control: no-store. When password authentication is configured, cookie/browser writes require a valid Origin and cookie-request checks; bearer writes validate Origin when supplied. Saves one of system, light or dark. This endpoint has no revision precondition; subsequent accepted writes replace the saved mode. Route body limit is 1024 bytes; rejected bodies are mapped to JSON invalid-request errors.

Supported scope: implemented