Movatterモバイル変換


[0]ホーム

URL:


Dev guideRecipesAPI ReferenceChangelog
Dev guideRecipesUser GuidesNuGetDev CommunityOptimizely AcademySubmit a ticketLog InCross-platform products
Dev guide
All
Pages
Start typing to search…

Manage webhooks

How to register, get, or delete webhooks in Optimizely Graph.

Optimizely Graph provides endpoints to manage your webhooks for a specific account.

📘

Note

See theAPI Reference for information on managing webhooks.

🚧

Important

Authentication required, use eitherBasic orHMAC authentication.

Register a webhook with notification filters

  1. Use a REST client tool, for example,Postman orInsomnia.
  2. Send a POST request with the URL:https://cg.optimizely.com/api/webhooks.
  3. UseBasic orHMAC authentication within the request.
  4. Prepare the request body.
{  "disabled": false,  "request" : {    "url" : <your_webhook_url>,    "method": "post"  },  "topic": ["{subject}.{action}"],  "filters": [     {       [field]: { [operator]: {value} }     }   ]}
  • disabled – Boolean. Set to true to disable the webhook.
  • request – Object. Represents the HTTP request to the webhook, including method (GET, POST, and so on), headers, query parameters, and body.
  • topic – Array of strings. Filters events bysubject andaction. Use an asterisk (*) as a wildcard.
    • Available values forsubject andaction.
      • doc – For updating events involving only a single content.
        • updated – For updating the event involving.
      • bulk – For updating events involving multiple content in one request.
        • completed – All contents in bulk are processed.
      • * – Update both event types,doc andbulk.
        • If you are not sure, use* for thesubject.
    • Examples
      • Filter all eventstopics: ["*.*"]
      • Filter all 'doc' eventstopics: ["doc.*"]
      • Filter all 'updated' eventstopics: ["*.updated"]
      • Filter 'doc updated' eventstopics: ["doc.updated"]
      • Filter 'doc updated' or 'bulk completed' eventstopics: ["doc.updated", "bulk.completed"]
    • (Optional) Filters property – An object containing key-value pairs, where each key is a filter name, and the value is an array of filter objects. Filters help you receive specific notifications.
      • The names of the fields in the filter will match the field names in Optimizely Graph query.
      • Webhooks only Support two operations for filter conditions:eq andin.
        • eq: compares equal to a value.
           {   "filters": [     {       "status": { "eq": "Published" }     }   ] }
          in: the field value is one of the values in the array.
            {   "filters": [     {       "status": { "in": ["Published","Draft"] }     }   ] }
      • Examples:
        • If the field to filter is a nested field, "." is used to separate the levels.
          {  "filters": [    {      "ContentLink.GuidValue": { "eq": "2e49372f-7795-4ab4-a2b0-bc4d4884d8d4" }    }  ]}

        • Filters docs that have 'Published' status.
           {   "filters": [     { "status": { "eq": "Published" } }   ], }
        • If the array of filter objects contains more than one object, the condition to receive a notification is an OR condition.
          • Filters docs that have 'Published' or 'Draft' status.
            {   "filters": [     { "status": { "eq": "Published" } },     { "status": { "eq": "Draft" } }   ],}
        • If a single object contains more than one condition, the condition to receive a notification is an AND condition.
          • Filters docs that have 'Published' status and ID '123'.
            {         "filters": [           { "status": { "eq": "Published" },             "id": { "eq": "123" }}       ]       }
        • Filters docs that have custom fields like 'siteId' (for example, with multiple sites).
          📘

          Note

          Custom fields are case-sensitive.

           {   "filters": [     {       "siteId": { "eq": "site_id" }     }   ] }
        • Filters docs that have custom fields like page name and 'Published' status (assume that the page name is not changed).
          {  "filters": [    {      "Name": { "eq": "Alloy Plan" },      "status": { "eq": "Published" }    }  ]}
  • Registering webhook examples
    • Filters docs that have 'Published' status.
       {   "request" : {      "url" : <your_webhook_url>,      "method": "post"   },   "topic": ["*.*"],   "filters": [     { "status": { "eq": "Published" } }   ], }
    • Filters docs that have 'Published' status andid'123'.
       {   "request" : {      "url" : <your_webhook_url>,      "method": "post"   },   "topic": ["*.*"],    "filters": [     {       "status": { "eq": "Published" },       "id": { "eq": "123" }     }   ] }
    • Filters docs that have ' 7c2af0d1-6059-4622-97f8-e9b108f23293' GuidValue.
      {   "request" : {      "url" : <your_webhook_url>,      "method": "post"   },   "topic": ["*.*"],   "filters": [     "ContentLink.GuidValue": { "eq": "7c2af0d1-6059-4622-97f8-e9b108f23293" }   ],}
    • Filters docs that have 'Published' or 'Draft' status.
      {   "request" : {      "url" : <your_webhook_url>,      "method": "post"   },   "topic": ["*.*"],   "filters": [     "status": { "in": ["Published","Draft"] }   ],}

Registered webhooks

  1. Use the REST client tool.
  2. Send a GET request with the URL:https://cg.optimizely.com/api/webhooks.
  3. UseBasic orHMAC authentication within the request.

Example response:

[  {    "id": <guid>,    "disabled": false,    "request" : {      "url" : <your_webhook_url>,      "method": "post"    },    "filters": [      {        "status": { "eq": "Published" }      }    ],    "preset": "legacy"  }]

Delete a registered webhook

  1. Use a REST client tool to list all webhooks and get the ID of the webhook you want to delete.
  2. Send a DELETE request with the URL:https://cg.optimizely.com/api/webhooks/{id} (ID of registered webhook).
  3. UseBasic orHMAC authentication within the request.

Updated 2 months ago



[8]ページ先頭

©2009-2025 Movatter.jp