メインコンテンツへスキップ
GET
https://{tenantDomain}/api/v2
/
rules
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.ListRulesRequestParameters{
        Page: management.Int(
            1,
        ),
        PerPage: management.Int(
            1,
        ),
        IncludeTotals: management.Bool(
            true,
        ),
        Enabled: management.Bool(
            true,
        ),
        Fields: management.String(
            "fields",
        ),
        IncludeFields: management.Bool(
            true,
        ),
    }
    client.Rules.List(
        context.TODO(),
        request,
    )
}
[
  {
    "enabled": true,
    "id": "con_0000000000000001",
    "name": "rule_1",
    "order": 1,
    "script": "function (user, context, callback) {\n  callback(null, user, context);\n}",
    "stage": "login_success"
  }
]

承認

Authorization
string
header
必須

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

クエリパラメータ

page
integer

返される結果のページインデックス。最初のページは 0 です。

必須範囲: x >= 0
per_page
integer

1 ページあたりの結果数。

必須範囲: 0 <= x <= 100
include_totals
boolean

合計結果数を含むオブジェクト内に結果を返すか(true)、結果の配列を直接返すか(false、既定値)を指定します。

enabled
boolean

Rule が有効(true)か無効(false)かで絞り込むためのオプションのフィルターです。

fields
string

結果に含める、または除外するフィールドのカンマ区切りリストです(include_fields に指定した値に応じます)。すべてのフィールドを取得するには空のままにします。

include_fields
boolean

指定したフィールドを含める(true)か除外する(false)かを指定します。

レスポンス

Rules を正常に取得しました。

enabled
boolean
デフォルト:true

Rule が有効(true)か、無効(false)かを示します。

id
string
デフォルト:con_0000000000000001

この Rule の ID。

name
string
デフォルト:rule_1

この Rule の名前。

order
number
デフォルト:1

この Rule をほかの Rules と比較してどの順序で実行するかを示します。値が小さい Rule ほど先に実行されます。

script
string
デフォルト:function (user, context, callback) { callback(null, user, context); }

この Rule の実行時に実行される code。

stage
string
デフォルト:login_success

このRuleの実行ステージ。login_successlogin_failurepre_authorize のいずれかを指定できます。