Passer au contenu principal
GET
https://{tenantDomain}/api/v2
/
hooks
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.ListHooksRequestParameters{
        Page: management.Int(
            1,
        ),
        PerPage: management.Int(
            1,
        ),
        IncludeTotals: management.Bool(
            true,
        ),
        Enabled: management.Bool(
            true,
        ),
        Fields: management.String(
            "fields",
        ),
        TriggerId: management.HookTriggerIdEnumCredentialsExchange.Ptr(),
    }
    client.Hooks.List(
        context.TODO(),
        request,
    )
}
import { ManagementClient } from "auth0";

async function main() {
const client = new ManagementClient({
token: "<token>",
});
await client.hooks.list({
page: 1,
perPage: 1,
includeTotals: true,
enabled: true,
fields: "fields",
triggerId: "credentials-exchange",
});
}
main();
import { ManagementClient } from "auth0";

async function main() {
const client = new ManagementClient({
token: "<token>",
});
await client.hooks.list({
page: 1,
perPage: 1,
includeTotals: true,
enabled: true,
fields: "fields",
triggerId: "credentials-exchange",
});
}
main();
curl --request GET \
--url https://{tenantDomain}/api/v2/hooks \
--header 'Authorization: Bearer <token>'
import requests

url = "https://{tenantDomain}/api/v2/hooks"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://{tenantDomain}/api/v2/hooks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
HttpResponse<String> response = Unirest.get("https://{tenantDomain}/api/v2/hooks")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://{tenantDomain}/api/v2/hooks")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
[
  {
    "triggerId": "<string>",
    "id": "00001",
    "name": "hook",
    "enabled": true,
    "script": "module.exports = function(client, scope, audience, context, cb) cb(null, access_token); };",
    "dependencies": {}
  }
]

Autorisations

Authorization
string
header
requis

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Paramètres de requête

page
integer

Page index of the results to return. First page is 0.

Plage requise: x >= 0
per_page
integer

Number of results per page.

Plage requise: 0 <= x <= 100
include_totals
boolean

Return results inside an object that contains the total result count (true) or as a direct array of results (false, default).

enabled
boolean

Optional filter on whether a hook is enabled (true) or disabled (false).

fields
string

Comma-separated list of fields to include in the result. Leave empty to retrieve all fields.

triggerId
enum<string>

Retrieves hooks that match the trigger

Options disponibles:
credentials-exchange,
pre-user-registration,
post-user-registration,
post-change-password,
send-phone-message

Réponse

Hooks successfully retrieved.

triggerId
string

Trigger ID

id
string
défaut:00001

ID of this hook.

name
string
défaut:hook

Name of this hook.

enabled
boolean
défaut:true

Whether this hook will be executed (true) or ignored (false).

script
string
défaut:module.exports = function(client, scope, audience, context, cb) cb(null, access_token); };

Code to be executed when this hook runs.

dependencies
object

Dependencies of this hook used by webtask server.