Passer au contenu principal
PUT
https://{tenantDomain}/api/v2
/
guardian
/
factors
/
sms
/
providers
/
twilio
Go
package example

import (
    context "context"

    client "github.com/auth0/go-auth0/management/management/client"
    factors "github.com/auth0/go-auth0/management/management/guardian/factors"
    option "github.com/auth0/go-auth0/management/management/option"
)

func do() {
    client := client.NewClient(
        option.WithToken(
            "<token>",
        ),
    )
    request := &factors.SetGuardianFactorsProviderSmsTwilioRequestContent{}
    client.Guardian.Factors.Sms.SetTwilioProvider(
        context.TODO(),
        request,
    )
}
import { ManagementClient } from "auth0";

async function main() {
const client = new ManagementClient({
token: "<token>",
});
await client.guardian.factors.sms.setTwilioProvider({});
}
main();
import { ManagementClient } from "auth0";

async function main() {
const client = new ManagementClient({
token: "<token>",
});
await client.guardian.factors.sms.setTwilioProvider({});
}
main();
curl --request PUT \
--url https://{tenantDomain}/api/v2/guardian/factors/sms/providers/twilio \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"from": "+1223323",
"messaging_service_sid": "5dEkAiHLPCuQ1uJj4qNXcAnERFAL6cpq",
"auth_token": "zw5Ku6z2sxhd0ZVXto5SDHX6KPDByJPU",
"sid": "wywA2BH4VqTpfywiDuyDAYZL3xQjoO40"
}
'
import requests

url = "https://{tenantDomain}/api/v2/guardian/factors/sms/providers/twilio"

payload = {
"from": "+1223323",
"messaging_service_sid": "5dEkAiHLPCuQ1uJj4qNXcAnERFAL6cpq",
"auth_token": "zw5Ku6z2sxhd0ZVXto5SDHX6KPDByJPU",
"sid": "wywA2BH4VqTpfywiDuyDAYZL3xQjoO40"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://{tenantDomain}/api/v2/guardian/factors/sms/providers/twilio",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'from' => '+1223323',
'messaging_service_sid' => '5dEkAiHLPCuQ1uJj4qNXcAnERFAL6cpq',
'auth_token' => 'zw5Ku6z2sxhd0ZVXto5SDHX6KPDByJPU',
'sid' => 'wywA2BH4VqTpfywiDuyDAYZL3xQjoO40'
]),
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.put("https://{tenantDomain}/api/v2/guardian/factors/sms/providers/twilio")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from\": \"+1223323\",\n \"messaging_service_sid\": \"5dEkAiHLPCuQ1uJj4qNXcAnERFAL6cpq\",\n \"auth_token\": \"zw5Ku6z2sxhd0ZVXto5SDHX6KPDByJPU\",\n \"sid\": \"wywA2BH4VqTpfywiDuyDAYZL3xQjoO40\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://{tenantDomain}/api/v2/guardian/factors/sms/providers/twilio")

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

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"from\": \"+1223323\",\n \"messaging_service_sid\": \"5dEkAiHLPCuQ1uJj4qNXcAnERFAL6cpq\",\n \"auth_token\": \"zw5Ku6z2sxhd0ZVXto5SDHX6KPDByJPU\",\n \"sid\": \"wywA2BH4VqTpfywiDuyDAYZL3xQjoO40\"\n}"

response = http.request(request)
puts response.read_body
{
  "from": "+1223323",
  "messaging_service_sid": "5dEkAiHLPCuQ1uJj4qNXcAnERFAL6cpq",
  "auth_token": "zw5Ku6z2sxhd0ZVXto5SDHX6KPDByJPU",
  "sid": "wywA2BH4VqTpfywiDuyDAYZL3xQjoO40"
}

Autorisations

Authorization
string
header
requis

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

Corps

from
string | null
défaut:+1223323

From number

Maximum string length: 64
messaging_service_sid
string | null
défaut:5dEkAiHLPCuQ1uJj4qNXcAnERFAL6cpq

Copilot SID

Required string length: 1 - 1000
auth_token
string | null
défaut:zw5Ku6z2sxhd0ZVXto5SDHX6KPDByJPU

Twilio Authentication token

Required string length: 1 - 1000
sid
string | null
défaut:wywA2BH4VqTpfywiDuyDAYZL3xQjoO40

Twilio SID

Required string length: 1 - 1000

Réponse

Twilio SMS configuration successfully updated.

from
string | null
défaut:+1223323

From number

Maximum string length: 64
messaging_service_sid
string | null
défaut:5dEkAiHLPCuQ1uJj4qNXcAnERFAL6cpq

Copilot SID

Required string length: 1 - 1000
auth_token
string | null
défaut:zw5Ku6z2sxhd0ZVXto5SDHX6KPDByJPU

Twilio Authentication token

Required string length: 1 - 1000
sid
string | null
défaut:wywA2BH4VqTpfywiDuyDAYZL3xQjoO40

Twilio SID

Required string length: 1 - 1000