Passer au contenu principal
GET
https://{tenantDomain}/api/v2
/
hooks
Go
package example

import (
    client "github.com/auth0/go-auth0/management/client"
    option "github.com/auth0/go-auth0/management/option"
    context "context"
    management "github.com/auth0/go-auth0/management"
)

func do() () {
    client := client.NewClient(
        option.WithToken(
            "<token>",
        ),
    )
    client.Hooks.List(
        context.TODO(),
        &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(),
        },
    )
}
[
  {
    "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.

Pattern: ^((id)|(name)|(script)|(dependencies)|(enabled)|(triggerId))(,((id)|(name)|(script)|(dependencies)|(enabled)|(triggerId)))*$
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.