Browse Community Interaction

beta · api · 0.1.0

Restrict or restore a Community Comment

PUT /api/v1/community/comments/{commentId}/moderation

Capability Domain: Community Interaction

Authentication

projectCredential (moderation:write)

Scope: moderation:write

Parameters and request body

  • X-Correlation-ID — header, optional
    X-Correlation-ID schema
    {
        "type": "string",
        "format": "uuid"
    }
  • commentId — path, required
    commentId schema
    {
        "type": "string",
        "format": "uuid"
    }

Request schema

application/json

application/json request schema
{
    "type": "object",
    "additionalProperties": false,
    "required": [
        "resource_type",
        "resource_id",
        "state",
        "reason"
    ],
    "properties": {
        "resource_type": {
            "type": "string",
            "maxLength": 120,
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]*$"
        },
        "resource_id": {
            "type": "string",
            "maxLength": 255
        },
        "state": {
            "type": "string",
            "enum": [
                "visible",
                "restricted"
            ]
        },
        "reason": {
            "type": [
                "string",
                "null"
            ],
            "enum": [
                "spam",
                "harassment",
                "hate",
                "violence",
                "sexual_content",
                null
            ]
        }
    }
}

application/json request example

application/json request example
{
    "resource_type": "article",
    "resource_id": "article-42",
    "state": "restricted",
    "reason": "spam"
}

Responses and errors

StatusDescription
200Current reversible moderation state
401Invalid or revoked Project Credential
403Project Credential lacks the required scope
422Request violates the public contract

200 schema

200 response schema
{
    "type": "object",
    "required": [
        "data"
    ],
    "properties": {
        "data": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "comment_id",
                "state",
                "reason"
            ],
            "properties": {
                "comment_id": {
                    "type": "string",
                    "format": "uuid"
                },
                "state": {
                    "type": "string",
                    "enum": [
                        "visible",
                        "restricted"
                    ]
                },
                "reason": {
                    "type": [
                        "string",
                        "null"
                    ],
                    "enum": [
                        "spam",
                        "harassment",
                        "hate",
                        "violence",
                        "sexual_content",
                        null
                    ]
                }
            }
        }
    }
}

401 schema

401 response schema
{
    "type": "object",
    "required": [
        "error"
    ],
    "properties": {
        "error": {
            "type": "object",
            "required": [
                "code",
                "message",
                "retryable",
                "correlation_id",
                "details"
            ],
            "properties": {
                "code": {
                    "type": "string"
                },
                "message": {
                    "type": "string"
                },
                "retryable": {
                    "type": "boolean"
                },
                "correlation_id": {
                    "type": "string",
                    "format": "uuid"
                },
                "details": {
                    "type": "object"
                }
            }
        }
    }
}

403 schema

403 response schema
{
    "type": "object",
    "required": [
        "error"
    ],
    "properties": {
        "error": {
            "type": "object",
            "required": [
                "code",
                "message",
                "retryable",
                "correlation_id",
                "details"
            ],
            "properties": {
                "code": {
                    "type": "string"
                },
                "message": {
                    "type": "string"
                },
                "retryable": {
                    "type": "boolean"
                },
                "correlation_id": {
                    "type": "string",
                    "format": "uuid"
                },
                "details": {
                    "type": "object"
                }
            }
        }
    }
}

422 schema

422 response schema
{
    "type": "object",
    "required": [
        "error"
    ],
    "properties": {
        "error": {
            "type": "object",
            "required": [
                "code",
                "message",
                "retryable",
                "correlation_id",
                "details"
            ],
            "properties": {
                "code": {
                    "type": "string"
                },
                "message": {
                    "type": "string"
                },
                "retryable": {
                    "type": "boolean"
                },
                "correlation_id": {
                    "type": "string",
                    "format": "uuid"
                },
                "details": {
                    "type": "object"
                }
            }
        }
    }
}

200 example

200 response example
{
    "data": {
        "comment_id": "51000000-0000-4000-8000-000000000001",
        "state": "restricted",
        "reason": "spam"
    }
}

Idempotency

PUT stores the requested moderation state; identical retries do not rewrite the Comment or state timestamp.