create a simple UI for calling 2 APIs in order to create a webhook. below are the CURLs for the two APIs which must be called in sequence. The first API (oauth/token) will return an object with a property "access_token" which must be provided to the second API. The second API needs to take the token from the first response, then also provide a URI, Label, and Created By. The UI generated should include fields for providing: "Client ID, Client Secret, Label, Revalidate URI, and Created By.
curl -X POST 'https://auth.sitecorecloud.io/oauth/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=[client id]' \
--data-urlencode 'client_secret=[client secret]' \
--data-urlencode 'audience=https://api.sitecorecloud.io' \
--data-urlencode 'grant_type=client_credentials'
curl -X POST 'https://edge.sitecorecloud.io/api/admin/v1/webhooks' \
--header 'Authorization: Bearer [token]' \
--header 'Content-Type: application/json' \
--data-raw '{
"label": "[label]",
"uri": "[URI to revalidate endpoint]",
"method": "POST",
"createdBy": "[implementation team]",
"executionMode": "OnUpdate"
}'
Loading...
great, now i also want a way to list the current webhooks, which i also have an API for:
curl -X GET 'https://edge.sitecorecloud.io/api/admin/v1/webhooks' \
--header 'Authorization: Bearer [token]' \
--header 'Content-Type: application/json'
for each webhook listed there should be a delete button which uses this API:
curl -X DELETE 'https://edge.sitecorecloud.io/api/admin/v1/webhooks/66118a1f-2c1c-4c37-b9db-4f63cde1da26' \--header 'Authorization: Bearer [token]' \
--header 'Content-Type: application/json'
Loading...
im hitting a cors issue when i attempt to auth
Access to fetch at 'https://auth.sitecorecloud.io/oauth/token' from origin 'https://kzmn7ir5wijicnd69j73.lite.vusercontent.net' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.