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.EventStreamsCreateRequest{
CreateEventStreamWebHookRequestContent: &management.CreateEventStreamWebHookRequestContent{
Destination: &management.EventStreamWebhookDestination{
Type: management.EventStreamWebhookDestinationTypeEnum(
"webhook",
),
Configuration: &management.EventStreamWebhookConfiguration{
WebhookEndpoint: "webhook_endpoint",
WebhookAuthorization: &management.EventStreamWebhookAuthorizationResponse{
EventStreamWebhookBasicAuth: &management.EventStreamWebhookBasicAuth{
Method: management.EventStreamWebhookBasicAuthMethodEnum(
"basic",
),
Username: "username",
},
},
},
},
},
}
client.EventStreams.Create(
context.TODO(),
request,
)
}import { ManagementClient } from "auth0";
async function main() {
const client = new ManagementClient({
token: "<token>",
});
await client.eventStreams.create({
destination: {
type: "webhook",
configuration: {
webhookEndpoint: "webhook_endpoint",
webhookAuthorization: {
method: "basic",
username: "username",
},
},
},
});
}
main();import { ManagementClient } from "auth0";
async function main() {
const client = new ManagementClient({
token: "<token>",
});
await client.eventStreams.create({
destination: {
type: "webhook",
configuration: {
webhookEndpoint: "webhook_endpoint",
webhookAuthorization: {
method: "basic",
username: "username",
},
},
},
});
}
main();curl --request POST \
--url https://{tenantDomain}/api/v2/event-streams \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"destination": {
"type": "webhook",
"configuration": {
"webhook_endpoint": "<string>",
"webhook_authorization": {
"method": "basic",
"username": "<string>"
}
}
},
"name": "<string>",
"subscriptions": [
{
"event_type": "<string>"
}
]
}
'import requests
url = "https://{tenantDomain}/api/v2/event-streams"
payload = {
"destination": {
"type": "webhook",
"configuration": {
"webhook_endpoint": "<string>",
"webhook_authorization": {
"method": "basic",
"username": "<string>"
}
}
},
"name": "<string>",
"subscriptions": [{ "event_type": "<string>" }]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{tenantDomain}/api/v2/event-streams",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'destination' => [
'type' => 'webhook',
'configuration' => [
'webhook_endpoint' => '<string>',
'webhook_authorization' => [
'method' => 'basic',
'username' => '<string>'
]
]
],
'name' => '<string>',
'subscriptions' => [
[
'event_type' => '<string>'
]
]
]),
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.post("https://{tenantDomain}/api/v2/event-streams")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"destination\": {\n \"type\": \"webhook\",\n \"configuration\": {\n \"webhook_endpoint\": \"<string>\",\n \"webhook_authorization\": {\n \"method\": \"basic\",\n \"username\": \"<string>\"\n }\n }\n },\n \"name\": \"<string>\",\n \"subscriptions\": [\n {\n \"event_type\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenantDomain}/api/v2/event-streams")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"destination\": {\n \"type\": \"webhook\",\n \"configuration\": {\n \"webhook_endpoint\": \"<string>\",\n \"webhook_authorization\": {\n \"method\": \"basic\",\n \"username\": \"<string>\"\n }\n }\n },\n \"name\": \"<string>\",\n \"subscriptions\": [\n {\n \"event_type\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"subscriptions": [
{
"event_type": "<string>"
}
],
"destination": {
"type": "webhook",
"configuration": {
"webhook_endpoint": "<string>",
"webhook_authorization": {
"method": "basic",
"username": "<string>"
}
}
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}Create an event stream
POST
https://{tenantDomain}/api/v2
/
event-streams
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.EventStreamsCreateRequest{
CreateEventStreamWebHookRequestContent: &management.CreateEventStreamWebHookRequestContent{
Destination: &management.EventStreamWebhookDestination{
Type: management.EventStreamWebhookDestinationTypeEnum(
"webhook",
),
Configuration: &management.EventStreamWebhookConfiguration{
WebhookEndpoint: "webhook_endpoint",
WebhookAuthorization: &management.EventStreamWebhookAuthorizationResponse{
EventStreamWebhookBasicAuth: &management.EventStreamWebhookBasicAuth{
Method: management.EventStreamWebhookBasicAuthMethodEnum(
"basic",
),
Username: "username",
},
},
},
},
},
}
client.EventStreams.Create(
context.TODO(),
request,
)
}import { ManagementClient } from "auth0";
async function main() {
const client = new ManagementClient({
token: "<token>",
});
await client.eventStreams.create({
destination: {
type: "webhook",
configuration: {
webhookEndpoint: "webhook_endpoint",
webhookAuthorization: {
method: "basic",
username: "username",
},
},
},
});
}
main();import { ManagementClient } from "auth0";
async function main() {
const client = new ManagementClient({
token: "<token>",
});
await client.eventStreams.create({
destination: {
type: "webhook",
configuration: {
webhookEndpoint: "webhook_endpoint",
webhookAuthorization: {
method: "basic",
username: "username",
},
},
},
});
}
main();curl --request POST \
--url https://{tenantDomain}/api/v2/event-streams \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"destination": {
"type": "webhook",
"configuration": {
"webhook_endpoint": "<string>",
"webhook_authorization": {
"method": "basic",
"username": "<string>"
}
}
},
"name": "<string>",
"subscriptions": [
{
"event_type": "<string>"
}
]
}
'import requests
url = "https://{tenantDomain}/api/v2/event-streams"
payload = {
"destination": {
"type": "webhook",
"configuration": {
"webhook_endpoint": "<string>",
"webhook_authorization": {
"method": "basic",
"username": "<string>"
}
}
},
"name": "<string>",
"subscriptions": [{ "event_type": "<string>" }]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{tenantDomain}/api/v2/event-streams",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'destination' => [
'type' => 'webhook',
'configuration' => [
'webhook_endpoint' => '<string>',
'webhook_authorization' => [
'method' => 'basic',
'username' => '<string>'
]
]
],
'name' => '<string>',
'subscriptions' => [
[
'event_type' => '<string>'
]
]
]),
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.post("https://{tenantDomain}/api/v2/event-streams")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"destination\": {\n \"type\": \"webhook\",\n \"configuration\": {\n \"webhook_endpoint\": \"<string>\",\n \"webhook_authorization\": {\n \"method\": \"basic\",\n \"username\": \"<string>\"\n }\n }\n },\n \"name\": \"<string>\",\n \"subscriptions\": [\n {\n \"event_type\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenantDomain}/api/v2/event-streams")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"destination\": {\n \"type\": \"webhook\",\n \"configuration\": {\n \"webhook_endpoint\": \"<string>\",\n \"webhook_authorization\": {\n \"method\": \"basic\",\n \"username\": \"<string>\"\n }\n }\n },\n \"name\": \"<string>\",\n \"subscriptions\": [\n {\n \"event_type\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"subscriptions": [
{
"event_type": "<string>"
}
],
"destination": {
"type": "webhook",
"configuration": {
"webhook_endpoint": "<string>",
"webhook_authorization": {
"method": "basic",
"username": "<string>"
}
}
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}承認
bearerAuthoAuth2ClientCredentials
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
ボディ
application/jsonapplication/x-www-form-urlencoded
- Option 1
- Option 2
- Option 3
Show child attributes
Show child attributes
Name of the event stream.
Required string length:
1 - 128List of event types subscribed to in this stream.
Minimum array length:
1Show child attributes
Show child attributes
Indicates whether the event stream is actively forwarding events.
利用可能なオプション:
enabled, disabled Maximum string length:
8レスポンス
Event Stream stream created successfully.
- Option 1
- Option 2
- Option 3
Unique identifier for the event stream.
Required string length:
26Name of the event stream.
Required string length:
1 - 128List of event types subscribed to in this stream.
Minimum array length:
1Show child attributes
Show child attributes
Show child attributes
Show child attributes
Indicates whether the event stream is actively forwarding events.
利用可能なオプション:
enabled, disabled Maximum string length:
8Timestamp when the event stream was created.
Timestamp when the event stream was last updated.
⌘I