github.com/phrase/openapi@v0.0.0-20240514140800-49e8a106740e/paths/webhooks/create.yaml (about)

     1  ---
     2  summary: Create a webhook
     3  description: Create a new webhook.
     4  operationId: webhook/create
     5  tags:
     6  - Webhooks
     7  parameters:
     8  - "$ref": "../../parameters.yaml#/X-PhraseApp-OTP"
     9  - "$ref": "../../parameters.yaml#/project_id"
    10  responses:
    11    '201':
    12      description: Created
    13      content:
    14        application/json:
    15          schema:
    16            "$ref": "../../schemas/webhook.yaml#/webhook"
    17      headers:
    18        X-Rate-Limit-Limit:
    19          "$ref": "../../headers.yaml#/X-Rate-Limit-Limit"
    20        X-Rate-Limit-Remaining:
    21          "$ref": "../../headers.yaml#/X-Rate-Limit-Remaining"
    22        X-Rate-Limit-Reset:
    23          "$ref": "../../headers.yaml#/X-Rate-Limit-Reset"
    24    '400':
    25      "$ref": "../../responses.yaml#/400"
    26    '404':
    27      "$ref": "../../responses.yaml#/404"
    28    '429':
    29      "$ref": "../../responses.yaml#/429"
    30  x-code-samples:
    31  - lang: Curl
    32    source: |-
    33      curl "https://api.phrase.com/v2/projects/:project_id/webhooks" \
    34        -u USERNAME_OR_ACCESS_TOKEN \
    35        -X POST \
    36        -d '{"callback_url":"http://example.com/hooks/phraseapp-notifications","description":"My webhook for chat notifications","events":"locales:create,translations:update"}' \
    37        -H 'Content-Type: application/json'
    38  - lang: CLI v2
    39    source: |-
    40      phrase webhooks create \
    41      --project_id <project_id> \
    42      --data '{"callback_url": "http://example.com/hooks/phraseapp-notifications", "description": "My webhook for chat notifications", "events": "locales:create,translations:update"}' \
    43      --access_token <token>
    44  requestBody:
    45    required: true
    46    content:
    47      application/json:
    48        schema:
    49          type: object
    50          title: webhook/create/parameters
    51          required:
    52            - callback_url
    53          properties:
    54            callback_url:
    55              description: Callback URL to send requests to
    56              type: string
    57              example: http://example.com/hooks/phraseapp-notifications
    58            secret:
    59              description: Webhook secret used to calculate signature. If empty, the default project secret will be used.
    60              type: string
    61              example: secr3t
    62            description:
    63              description: Webhook description
    64              type: string
    65              example: My webhook for chat notifications
    66            events:
    67              description: List of event names to trigger the webhook (separated by comma)
    68              type: string
    69              example: locales:create,translations:update
    70            active:
    71              description: Whether webhook is active or inactive
    72              type: boolean
    73              example:
    74            include_branches:
    75              description: If enabled, webhook will also be triggered for events from branches of the project specified.
    76              type: boolean
    77              example:
    78  x-cli-version: '2.5'