一括ユーザーインポート
ユーザーデータを一括してAuth0にインポートするには、ユーザーインポートジョブ作成エンドポイントを使用します。一括インポートは、ユーザーを既存のデータベースやサービスからAuth0に移行するのに便利です。
前提条件
ユーザーインポートジョブを実行する前に、以下を行います。
データベース接続をユーザーのインポートに構成して、少なくとも1つのアプリケーションに有効化します。
パスワードをインポートする場合には、対応しているアルゴリズムの1つを使ってパスワードがハッシュ化されていることを確認します。ユーザーのパスワードが非対応のアルゴリズムでハッシュ化されている場合には、一括インポート後に初回のログインでユーザーがパスワードをリセットする必要があります。
MFAの登録をインポートする場合には、対応している
email
、phone
またはtotp
のタイプであることを確認します。ジョブエンドポイントの要求に、Management APIトークンを取得します。
ユーザーのJSONファイルを作成する
Auth0にインポートしたいユーザーデータを含むJSONファイルを作成します。ユーザーデータをJSONファイルにエクスポートする方法は、既存のユーザーデータベースによって異なります。Management APIのエンドポイントはJSONファイルを期待します。そのため、fs.readFileSync
ではなく、fs.createReadStream
を使用する必要があります。エンドポイントは、JSONファイルではなく、パイプで連結された読み出しストリームを期待します。
JSONファイルのスキーマと例については、「一括インポートのデータベーススキーマと例」をお読みください。
一括ユーザーインポートを要求する
一括ユーザーインポートジョブを始めるには、POST
要求を一括ユーザーインポートジョブ作成エンドポイントに対して行います。必ず、MGMT_API_ACCESS_TOKEN
、USERS_IMPORT_FILE.json
、CONNECTION_ID
、およびEXTERNAL_ID
のプレースホルダーの値をそれぞれManagement APIのアクセストークン、ユーザーのJSONファイル、データベース接続IDと外部IDに置き換えます。
curl --request POST \
--url 'https://{yourDomain}/api/v2/jobs/users-imports' \
--header 'authorization: Bearer MGMT_API_ACCESS_TOKEN' \
--form users=@USERS_IMPORT_FILE.json \
--form connection_id=CONNECTION_ID \
--form external_id=EXTERNAL_ID
Was this helpful?
var client = new RestClient("https://{yourDomain}/api/v2/jobs/users-imports");
var request = new RestRequest(Method.POST);
request.AddHeader("authorization", "Bearer MGMT_API_ACCESS_TOKEN");
request.AddHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001");
request.AddParameter("multipart/form-data; boundary=---011000010111000001101001", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"users\"; filename=\"USERS_IMPORT_FILE.json\"\r\nContent-Type: text/json\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"connection_id\"\r\n\r\nCONNECTION_ID\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"external_id\"\r\n\r\nEXTERNAL_ID\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Was this helpful?
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://{yourDomain}/api/v2/jobs/users-imports"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"users\"; filename=\"USERS_IMPORT_FILE.json\"\r\nContent-Type: text/json\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"connection_id\"\r\n\r\nCONNECTION_ID\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"external_id\"\r\n\r\nEXTERNAL_ID\r\n-----011000010111000001101001--\r\n")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "Bearer MGMT_API_ACCESS_TOKEN")
req.Header.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Was this helpful?
HttpResponse<String> response = Unirest.post("https://{yourDomain}/api/v2/jobs/users-imports")
.header("authorization", "Bearer MGMT_API_ACCESS_TOKEN")
.header("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"users\"; filename=\"USERS_IMPORT_FILE.json\"\r\nContent-Type: text/json\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"connection_id\"\r\n\r\nCONNECTION_ID\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"external_id\"\r\n\r\nEXTERNAL_ID\r\n-----011000010111000001101001--\r\n")
.asString();
Was this helpful?
var axios = require("axios").default;
var options = {
method: 'POST',
url: 'https://{yourDomain}/api/v2/jobs/users-imports',
headers: {
authorization: 'Bearer MGMT_API_ACCESS_TOKEN',
'content-type': 'multipart/form-data; boundary=---011000010111000001101001'
},
data: '-----011000010111000001101001\r\nContent-Disposition: form-data; name="users"; filename="USERS_IMPORT_FILE.json"\r\nContent-Type: text/json\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name="connection_id"\r\n\r\nCONNECTION_ID\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name="external_id"\r\n\r\nEXTERNAL_ID\r\n-----011000010111000001101001--\r\n'
};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
Was this helpful?
#import <Foundation/Foundation.h>
NSDictionary *headers = @{ @"authorization": @"Bearer MGMT_API_ACCESS_TOKEN",
@"content-type": @"multipart/form-data; boundary=---011000010111000001101001" };
NSArray *parameters = @[ @{ @"name": @"users", @"fileName": @"USERS_IMPORT_FILE.json", @"contentType": @"text/json" },
@{ @"name": @"connection_id", @"value": @"CONNECTION_ID" },
@{ @"name": @"external_id", @"value": @"EXTERNAL_ID" } ];
NSString *boundary = @"---011000010111000001101001";
NSError *error;
NSMutableString *body = [NSMutableString string];
for (NSDictionary *param in parameters) {
[body appendFormat:@"--%@\r\n", boundary];
if (param[@"fileName"]) {
[body appendFormat:@"Content-Disposition:form-data; name=\"%@\"; filename=\"%@\"\r\n", param[@"name"], param[@"fileName"]];
[body appendFormat:@"Content-Type: %@\r\n\r\n", param[@"contentType"]];
[body appendFormat:@"%@", [NSString stringWithContentsOfFile:param[@"fileName"] encoding:NSUTF8StringEncoding error:&error]];
if (error) {
NSLog(@"%@", error);
}
} else {
[body appendFormat:@"Content-Disposition:form-data; name=\"%@\"\r\n\r\n", param[@"name"]];
[body appendFormat:@"%@", param[@"value"]];
}
}
[body appendFormat:@"\r\n--%@--\r\n", boundary];
NSData *postData = [body dataUsingEncoding:NSUTF8StringEncoding];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://{yourDomain}/api/v2/jobs/users-imports"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
Was this helpful?
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{yourDomain}/api/v2/jobs/users-imports",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"users\"; filename=\"USERS_IMPORT_FILE.json\"\r\nContent-Type: text/json\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"connection_id\"\r\n\r\nCONNECTION_ID\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"external_id\"\r\n\r\nEXTERNAL_ID\r\n-----011000010111000001101001--\r\n",
CURLOPT_HTTPHEADER => [
"authorization: Bearer MGMT_API_ACCESS_TOKEN",
"content-type: multipart/form-data; boundary=---011000010111000001101001"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Was this helpful?
import http.client
conn = http.client.HTTPSConnection("")
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"users\"; filename=\"USERS_IMPORT_FILE.json\"\r\nContent-Type: text/json\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"connection_id\"\r\n\r\nCONNECTION_ID\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"external_id\"\r\n\r\nEXTERNAL_ID\r\n-----011000010111000001101001--\r\n"
headers = {
'authorization': "Bearer MGMT_API_ACCESS_TOKEN",
'content-type': "multipart/form-data; boundary=---011000010111000001101001"
}
conn.request("POST", "/{yourDomain}/api/v2/jobs/users-imports", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Was this helpful?
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://{yourDomain}/api/v2/jobs/users-imports")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["authorization"] = 'Bearer MGMT_API_ACCESS_TOKEN'
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"users\"; filename=\"USERS_IMPORT_FILE.json\"\r\nContent-Type: text/json\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"connection_id\"\r\n\r\nCONNECTION_ID\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"external_id\"\r\n\r\nEXTERNAL_ID\r\n-----011000010111000001101001--\r\n"
response = http.request(request)
puts response.read_body
Was this helpful?
import Foundation
let headers = [
"authorization": "Bearer MGMT_API_ACCESS_TOKEN",
"content-type": "multipart/form-data; boundary=---011000010111000001101001"
]
let parameters = [
[
"name": "users",
"fileName": "USERS_IMPORT_FILE.json",
"contentType": "text/json"
],
[
"name": "connection_id",
"value": "CONNECTION_ID"
],
[
"name": "external_id",
"value": "EXTERNAL_ID"
]
]
let boundary = "---011000010111000001101001"
var body = ""
var error: NSError? = nil
for param in parameters {
let paramName = param["name"]!
body += "--\(boundary)\r\n"
body += "Content-Disposition:form-data; name=\"\(paramName)\""
if let filename = param["fileName"] {
let contentType = param["content-type"]!
let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
if (error != nil) {
print(error)
}
body += "; filename=\"\(filename)\"\r\n"
body += "Content-Type: \(contentType)\r\n\r\n"
body += fileContent
} else if let paramValue = param["value"] {
body += "\r\n\r\n\(paramValue)"
}
}
let request = NSMutableURLRequest(url: NSURL(string: "https://{yourDomain}/api/v2/jobs/users-imports")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
Was this helpful?
パラメーター | 説明 |
---|---|
users |
インポートするユーザーを含むJSON形式のファイルです。 |
connection_id |
ユーザーが投入される接続のIDです。IDはGET /api/v2/connectionsを使って取得することができます。 |
upsert |
ブール値で、デフォルトはfalse です。false では、メールアドレス、ユーザーID、電話番号、またはユーザー名が一致する既存のユーザーの場合、エラーになります。trueでは、メールアドレスが一致する既存のユーザーは更新されますが、更新されるのはアップサートできる属性のみです。インポートでアップサート可能なユーザープロファイルのフィールドについては、「ユーザープロファイルの構造:ユーザープロファイル属性」を参照してください。注意:インポートファイルに重複したユーザーが存在する場合はエラーになります。その場合、Auth0は投入や更新を行いません。 |
external_id |
任意のユーザー定義の文字列で、複数のジョブを関連付けるのに使うことができます。ジョブステータス応答の一部として返されます。 |
send_completion_email |
ブール値で、デフォルトはtrue です。true では、インポートジョブが終了すると、すべてのテナント所有者に完了メールを送信します。メールを送信したくない場合には、このパラメーターをfalse に設定する必要があります。 |
要求に成功すると、以下のような応答を受け取ります。
{
"status": "pending",
"type": "users_import",
"created_at": "",
"id": "job_abc123",
"connection_id": "CONNECTION_ID",
"upsert": false,
"external_id": "EXTERNAL_ID",
"send_completion_email": true
}
Was this helpful?
返されたエンティティはインポートジョブを表します。
ユーザーインポートジョブが完了すると、send_completion_email
がtrue
に設定されている場合には、ジョブの成功または失敗がテナント管理者に通知されます。ジョブ失敗のメールでは、ユーザーのインポートでユーザーのJSONファイルが解析に失敗したことを管理者に知らせる場合もあります。
複数のインポートジョブを同時に実行する
ユーザーインポートジョブ作成エンドポイントでは、同時に実行可能なインポートジョブが2つまでに制限されています。2つのジョブが保留中の場合に追加のジョブを要求すると、429 Too Many Requests
(要求が多すぎます)応答が返されます。
{
"statusCode": 429,
"error": "Too Many Requests",
"message": "There are 2 active import users jobs, please wait until some of them are finished and try again
}
Was this helpful?
ジョブステータスを確認する
ジョブのステータスを確認するには、GET
要求をジョブ取得エンドポイントに対して行います。必ず、MGMT_API_ACCESS_TOKEN
およびJOB_ID
のプレースホルダーの値をそれぞれManagement APIのアクセストークンとユーザーインポートジョブIDに置き換えます。
curl --request GET \
--url 'https://{yourDomain}/api/v2/jobs/JOB_ID' \
--header 'authorization: Bearer MGMT_API_ACCESS_TOKEN' \
--header 'content-type: application/json'
Was this helpful?
var client = new RestClient("https://{yourDomain}/api/v2/jobs/JOB_ID");
var request = new RestRequest(Method.GET);
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "Bearer MGMT_API_ACCESS_TOKEN");
IRestResponse response = client.Execute(request);
Was this helpful?
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://{yourDomain}/api/v2/jobs/JOB_ID"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("content-type", "application/json")
req.Header.Add("authorization", "Bearer MGMT_API_ACCESS_TOKEN")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Was this helpful?
HttpResponse<String> response = Unirest.get("https://{yourDomain}/api/v2/jobs/JOB_ID")
.header("content-type", "application/json")
.header("authorization", "Bearer MGMT_API_ACCESS_TOKEN")
.asString();
Was this helpful?
var axios = require("axios").default;
var options = {
method: 'GET',
url: 'https://{yourDomain}/api/v2/jobs/JOB_ID',
headers: {
'content-type': 'application/json',
authorization: 'Bearer MGMT_API_ACCESS_TOKEN'
}
};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
Was this helpful?
#import <Foundation/Foundation.h>
NSDictionary *headers = @{ @"content-type": @"application/json",
@"authorization": @"Bearer MGMT_API_ACCESS_TOKEN" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://{yourDomain}/api/v2/jobs/JOB_ID"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
Was this helpful?
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{yourDomain}/api/v2/jobs/JOB_ID",
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 MGMT_API_ACCESS_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;
}
Was this helpful?
import http.client
conn = http.client.HTTPSConnection("")
headers = {
'content-type': "application/json",
'authorization': "Bearer MGMT_API_ACCESS_TOKEN"
}
conn.request("GET", "/{yourDomain}/api/v2/jobs/JOB_ID", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Was this helpful?
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://{yourDomain}/api/v2/jobs/JOB_ID")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Bearer MGMT_API_ACCESS_TOKEN'
response = http.request(request)
puts response.read_body
Was this helpful?
import Foundation
let headers = [
"content-type": "application/json",
"authorization": "Bearer MGMT_API_ACCESS_TOKEN"
]
let request = NSMutableURLRequest(url: NSURL(string: "https://{yourDomain}/api/v2/jobs/JOB_ID")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
Was this helpful?
ユーザーインポートジョブのステータスに応じて、以下のような応答の1つを受け取ります。
保留中
{
"status": "pending",
"type": "users_import",
"created_at": "",
"id": "job_abc123",
"connection_id": "CONNECTION_ID",
"external_id": "EXTERNAL_ID"
}
Was this helpful?
完了
ジョブが完了すると、ジョブステータス応答には、成功、失敗、挿入、および更新レコードの総計が含めれます。
{
"status": "completed",
"type": "users_import",
"created_at": "",
"id": "job_abc123",
"connection_id": "CONNECTION_ID",
"external_id": "EXTERNAL_ID",
"summary": {
"failed": 0,
"updated": 0,
"inserted": 1,
"total": 1
}
}
Was this helpful?
失敗
ジョブ内にエラーがある場合には、失敗が返されます。ただし、無効なメールなどの無効なユーザー情報では、ジョブが全体として失敗しないことに注意してください。
{
"status": "failed",
"type": "users_import",
"created_at": "",
"id": "job_abc123",
"connection_id": "CONNECTION_ID",
"external_id": "EXTERNAL_ID",
}
Was this helpful?
失敗エントリの詳細については、以下で「失敗エントリを取得する」を参照してください。
ジョブのタイムアウト
すべてのユーザーインポートジョブは、2時間が経過するとタイムアウトします。ジョブがこの時間制限内に完了しない場合は、失敗としてマークされます。
また、ジョブ関連のデータはすべて24時間後に自動削除され、アクセスできなくなります。そのため、何らかのストレージメカニズムを使ってジョブ結果を保管することを強くお勧めします。
ログエントリを取得する
ユーザーインポートジョブにエラーがある場合には、GET
要求をジョブエラー詳細取得エンドポイントに行って、エラー詳細を取得することができます。必ず、MGMT_API_ACCESS_TOKEN
およびJOB_ID
のプレースホルダーの値をそれぞれManagement APIのアクセストークンとユーザーインポートジョブIDに置き換えます。
curl --request GET \
--url 'https://{yourDomain}/api/v2/jobs/JOB_ID/errors' \
--header 'authorization: Bearer MGMT_API_ACCESS_TOKEN' \
--header 'content-type: application/json'
Was this helpful?
var client = new RestClient("https://{yourDomain}/api/v2/jobs/JOB_ID/errors");
var request = new RestRequest(Method.GET);
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "Bearer MGMT_API_ACCESS_TOKEN");
IRestResponse response = client.Execute(request);
Was this helpful?
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://{yourDomain}/api/v2/jobs/JOB_ID/errors"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("content-type", "application/json")
req.Header.Add("authorization", "Bearer MGMT_API_ACCESS_TOKEN")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Was this helpful?
HttpResponse<String> response = Unirest.get("https://{yourDomain}/api/v2/jobs/JOB_ID/errors")
.header("content-type", "application/json")
.header("authorization", "Bearer MGMT_API_ACCESS_TOKEN")
.asString();
Was this helpful?
var axios = require("axios").default;
var options = {
method: 'GET',
url: 'https://{yourDomain}/api/v2/jobs/JOB_ID/errors',
headers: {
'content-type': 'application/json',
authorization: 'Bearer MGMT_API_ACCESS_TOKEN'
}
};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
Was this helpful?
#import <Foundation/Foundation.h>
NSDictionary *headers = @{ @"content-type": @"application/json",
@"authorization": @"Bearer MGMT_API_ACCESS_TOKEN" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://{yourDomain}/api/v2/jobs/JOB_ID/errors"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
Was this helpful?
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{yourDomain}/api/v2/jobs/JOB_ID/errors",
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 MGMT_API_ACCESS_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;
}
Was this helpful?
import http.client
conn = http.client.HTTPSConnection("")
headers = {
'content-type': "application/json",
'authorization': "Bearer MGMT_API_ACCESS_TOKEN"
}
conn.request("GET", "/{yourDomain}/api/v2/jobs/JOB_ID/errors", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Was this helpful?
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://{yourDomain}/api/v2/jobs/JOB_ID/errors")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Bearer MGMT_API_ACCESS_TOKEN'
response = http.request(request)
puts response.read_body
Was this helpful?
import Foundation
let headers = [
"content-type": "application/json",
"authorization": "Bearer MGMT_API_ACCESS_TOKEN"
]
let request = NSMutableURLRequest(url: NSURL(string: "https://{yourDomain}/api/v2/jobs/JOB_ID/errors")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
Was this helpful?
要求に成功すると、以下のような応答を受け取ります。hash.value
などの機密フィールドは応答内でマスクされます。
[
{
"user": {
"email": "test@test.io",
"user_id": "7af4c65cb0ac6e162f081822422a9dde",
"custom_password_hash": {
"algorithm": "ldap",
"hash": {
"value": "*****"
}
}
},
"errors": [
{
"code": "...",
"message": "...",
"path": "..."
}
]
}
]
Was this helpful?
それぞれのエラーオブジェクトには、エラーコードとエラー詳細を説明するメッセージが含まれます。以下のようなエラーコードがあります。
ANY_OF_MISSING
ARRAY_LENGTH_LONG
ARRAY_LENGTH_SHORT
CONFLICT
CONFLICT_EMAIL
CONFLICT_USERNAME
CONNECTION_NOT_FOUND
DUPLICATED_USER
ENUM_MISMATCH
FORMAT
INVALID_TYPE
MAX_LENGTH
MAXIMUM
MFA_FACTORS_FAILED
MIN_LENGTH
MINIMUM
NOT_PASSED
OBJECT_REQUIRED
PATTERN