POST · Modérer

People : Modérer. Paramètres, accès et exemples de réponse.

Rédigé par Red Blue

Mis à jour le

People

POST /api/v1/people/moderation

operationId : people_moderation

Accès

Permission

Consentements OAuth

OAuth : délégation d’un équipier pour l’API

product.update

api:connect, people:write

KHONY_ORIGIN est l’origine HTTPS de votre application Khony, sans chemin final. Remplacez les identifiants de l’exemple par ceux de vos ressources autorisées. Les données de réponse ci-dessous illustrent le format ; elles ne sont pas le résultat d’un appel à votre organisation.

Champs du corps JSON

Nom

Emplacement

Requis

Type et contraintes

productId

JSON

Oui

string

request

JSON

Oui

object

idempotencyKey

JSON

Oui

string ; uuid

Variantes de la requête

Sélecteur

Valeur

Autres champs requis dans request

request.type

"block_email"

email, blockMessages, blockFeedback

request.type

"block_contact"

contactId, expectedRevision, blocked

request.type

"delete_block"

blockId, expectedRevision

Choisissez une variante et respectez son schéma complet : les contraintes des champs optionnels et les unions imbriquées restent applicables.

Exemple de requête

Shell
curl --request POST "$KHONY_ORIGIN/api/v1/people/moderation" \
  --header "Authorization: Bearer $KHONY_ACCESS_TOKEN" \
  --header 'X-Khony-Confirmation: 0198f886-9f71-7000-8000-000000000011' \
  --header 'Idempotency-Key: 0198f886-9f71-7000-8000-000000000010' \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "productId": "product_01k3w8d7vhe008000000000001",
  "idempotencyKey": "0198f886-9f71-7000-8000-000000000010",
  "request": {
    "type": "block_contact",
    "contactId": "contact_01k3w8d7vhe008000000000002",
    "expectedRevision": "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
    "blocked": true,
    "capability": "feedback",
    "reason": "Repeated spam"
  }
}'
Shell

Réponse de succès · HTTP 200

JSON
{
  "data": {
    "blocked": true
  }
}
JSON
Schéma complet du corps JSON
JSON
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "productId": {
      "type": "string",
      "pattern": "^product_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
    },
    "request": {
      "oneOf": [
        {
          "$ref": "#/$defs/__schema0"
        },
        {
          "$ref": "#/$defs/__schema1"
        },
        {
          "$ref": "#/$defs/__schema3"
        }
      ]
    },
    "idempotencyKey": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    }
  },
  "required": [
    "productId",
    "request",
    "idempotencyKey"
  ],
  "additionalProperties": false,
  "$defs": {
    "__schema0": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "const": "block_email"
        },
        "email": {
          "type": "string",
          "maxLength": 320,
          "format": "email",
          "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
        },
        "reason": {
          "type": "string",
          "maxLength": 500
        },
        "blockMessages": {
          "type": "boolean"
        },
        "blockFeedback": {
          "type": "boolean"
        }
      },
      "required": [
        "type",
        "email",
        "blockMessages",
        "blockFeedback"
      ],
      "additionalProperties": false
    },
    "__schema1": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "const": "block_contact"
        },
        "contactId": {
          "type": "string",
          "pattern": "^contact_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
        },
        "expectedRevision": {
          "$ref": "#/$defs/__schema2"
        },
        "blocked": {
          "type": "boolean"
        },
        "capability": {
          "type": "string",
          "enum": [
            "messages",
            "feedback"
          ]
        },
        "reason": {
          "type": "string",
          "maxLength": 500
        },
        "blockMessages": {
          "type": "boolean"
        },
        "blockFeedback": {
          "type": "boolean"
        }
      },
      "required": [
        "type",
        "contactId",
        "expectedRevision",
        "blocked"
      ],
      "additionalProperties": false
    },
    "__schema2": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    },
    "__schema3": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "const": "delete_block"
        },
        "blockId": {
          "type": "string",
          "pattern": "^contact_block_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
        },
        "expectedRevision": {
          "$ref": "#/$defs/__schema2"
        }
      },
      "required": [
        "type",
        "blockId",
        "expectedRevision"
      ],
      "additionalProperties": false
    }
  }
}
JSON
Schéma complet de la réponse
JSON
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "data": {
      "$ref": "#/$defs/__schema0"
    }
  },
  "required": [
    "data"
  ],
  "additionalProperties": false,
  "$defs": {
    "__schema0": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "number"
        },
        {
          "type": "boolean"
        },
        {
          "type": "null"
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/__schema0"
          }
        },
        {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "$ref": "#/$defs/__schema0"
          }
        }
      ]
    }
  }
}
JSON

Refus et reprise

Les statuts documentés pour cette opération sont 400, 401, 402, 403, 404, 409, 428, 429, 500, 503. Identifiez la cause avec error.code et, lorsqu’il est présent, error.reason. Une réponse 409 peut demander une relecture de révision ou signaler une commande incompatible ; une réponse 428 demande une confirmation humaine. Ne rejouez une écriture que selon son contrat.

Notes du contrat
JSON
{
  "description": "Current administrator API OAuth people:write. Requires human confirmation verified by the shared runtime; no client boolean grants confirmation. Select block_email/block_contact/delete_block with stable idempotencyKey. Contact and block targets require current opaque revisions. Native per-product moderation lock and actor audit are preserved. Capability updates preserve the other blocking capability. Read moderation and blocks before changing state."
}
JSON