Go
package example
import (
context "context"
management "github.com/auth0/go-auth0/management/management"
client "github.com/auth0/go-auth0/management/management/client"
option "github.com/auth0/go-auth0/management/management/option"
)
func do() {
client := client.NewClient(
option.WithToken(
"<token>",
),
)
request := &management.UpdateHookRequestContent{}
client.Hooks.Update(
context.TODO(),
"id",
request,
)
}import { ManagementClient } from "auth0";
async function main() {
const client = new ManagementClient({
token: "<token>",
});
await client.hooks.update("id", {});
}
main();import { ManagementClient } from "auth0";
async function main() {
const client = new ManagementClient({
token: "<token>",
});
await client.hooks.update("id", {});
}
main();curl --request PATCH \
--url https://{tenantDomain}/api/v2/hooks/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"dependencies": {},
"enabled": false,
"name": "my-hook",
"script": "module.exports = function(client, scope, audience, context, cb) cb(null, access_token); };"
}
'import requests
url = "https://{tenantDomain}/api/v2/hooks/{id}"
payload = {
"dependencies": {},
"enabled": False,
"name": "my-hook",
"script": "module.exports = function(client, scope, audience, context, cb) cb(null, access_token); };"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{tenantDomain}/api/v2/hooks/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'dependencies' => [
],
'enabled' => false,
'name' => 'my-hook',
'script' => 'module.exports = function(client, scope, audience, context, cb) cb(null, access_token); };'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.patch("https://{tenantDomain}/api/v2/hooks/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"dependencies\": {},\n \"enabled\": false,\n \"name\": \"my-hook\",\n \"script\": \"module.exports = function(client, scope, audience, context, cb) cb(null, access_token); };\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenantDomain}/api/v2/hooks/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"dependencies\": {},\n \"enabled\": false,\n \"name\": \"my-hook\",\n \"script\": \"module.exports = function(client, scope, audience, context, cb) cb(null, access_token); };\"\n}"
response = http.request(request)
puts response.read_body{
"dependencies": {},
"enabled": true,
"id": "00001",
"name": "hook",
"script": "module.exports = function(client, scope, audience, context, cb) cb(null, access_token); };",
"triggerId": "<string>"
}id を指定して Hooks を部分更新
既存の Hook を更新します。
PATCH
https://{tenantDomain}/api/v2
/
hooks
/
{id}
Go
package example
import (
context "context"
management "github.com/auth0/go-auth0/management/management"
client "github.com/auth0/go-auth0/management/management/client"
option "github.com/auth0/go-auth0/management/management/option"
)
func do() {
client := client.NewClient(
option.WithToken(
"<token>",
),
)
request := &management.UpdateHookRequestContent{}
client.Hooks.Update(
context.TODO(),
"id",
request,
)
}import { ManagementClient } from "auth0";
async function main() {
const client = new ManagementClient({
token: "<token>",
});
await client.hooks.update("id", {});
}
main();import { ManagementClient } from "auth0";
async function main() {
const client = new ManagementClient({
token: "<token>",
});
await client.hooks.update("id", {});
}
main();curl --request PATCH \
--url https://{tenantDomain}/api/v2/hooks/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"dependencies": {},
"enabled": false,
"name": "my-hook",
"script": "module.exports = function(client, scope, audience, context, cb) cb(null, access_token); };"
}
'import requests
url = "https://{tenantDomain}/api/v2/hooks/{id}"
payload = {
"dependencies": {},
"enabled": False,
"name": "my-hook",
"script": "module.exports = function(client, scope, audience, context, cb) cb(null, access_token); };"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{tenantDomain}/api/v2/hooks/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'dependencies' => [
],
'enabled' => false,
'name' => 'my-hook',
'script' => 'module.exports = function(client, scope, audience, context, cb) cb(null, access_token); };'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.patch("https://{tenantDomain}/api/v2/hooks/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"dependencies\": {},\n \"enabled\": false,\n \"name\": \"my-hook\",\n \"script\": \"module.exports = function(client, scope, audience, context, cb) cb(null, access_token); };\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenantDomain}/api/v2/hooks/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"dependencies\": {},\n \"enabled\": false,\n \"name\": \"my-hook\",\n \"script\": \"module.exports = function(client, scope, audience, context, cb) cb(null, access_token); };\"\n}"
response = http.request(request)
puts response.read_body{
"dependencies": {},
"enabled": true,
"id": "00001",
"name": "hook",
"script": "module.exports = function(client, scope, audience, context, cb) cb(null, access_token); };",
"triggerId": "<string>"
}承認
bearerAuthoAuth2ClientCredentials
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
パスパラメータ
更新する Hook の ID。
ボディ
application/jsonapplication/x-www-form-urlencoded
webtaskサーバーで使用される、このHookの依存関係。
Show child attributes
Show child attributes
この Hook を実行するか(true)、無視するか(false)。
この Hook の名前。
Pattern:
^[a-zA-Z0-9]([ \-a-zA-Z0-9]*[a-zA-Z0-9])?$script
string
デフォルト:module.exports = function(client, scope, audience, context, cb) cb(null, access_token); };
この Hook の実行時に実行されるコード。
Minimum string length:
1レスポンス
Hook を正常に作成しました。
webtaskサーバーで使用される、このHookの依存関係。
Show child attributes
Show child attributes
この Hook を実行するか(true)、無視するか(false)。
この Hook の ID。
この Hook の名前。
script
string
デフォルト:module.exports = function(client, scope, audience, context, cb) cb(null, access_token); };
この Hook の実行時に実行されるコード。
トリガー ID
⌘I