设置数据连接
Creates or updates a Data Connection on a title.
Allowed entity token types: title
Error codes
This operation may return the following PlayFab errors:
| Error | Code |
|---|---|
| BillingInformationRequired | 1266 |
| EventSinkConnectionInvalid | 15000 |
| EventSinkConnectionUnauthorized | 15001 |
| EventSinkDatabaseNotFound | 15011 |
| EventSinkInsufficientRoleAssignment | 15013 |
| EventSinkLimitExceeded | 15003 |
| EventSinkRegionInvalid | 15002 |
| EventSinkSasTokenInvalid | 15004 |
| EventSinkSasTokenPermissionInvalid | 15007 |
| EventSinkSecretInvalid | 15008 |
| EventSinkTenantIdInvalid | 15015 |
| EventSinkTitleUnauthorized | 15012 |
| ServiceUnavailable | 1123 |
POST
/
Event
/
SetDataConnection
Set Data Connection
curl --request POST \
--url https://{titleId}.playfabapi.com/Event/SetDataConnection \
--header 'Content-Type: application/json' \
--header 'X-EntityToken: <api-key>' \
--data '
{
"Name": "MyDataConnection",
"Type": "AzureDataExplorer",
"IsActive": true,
"ConnectionSettings": {
"AzureDataExplorerSettings": {
"ClusterUri": "https://myadxcluster.kusto.windows.net",
"Database": "MyDatabase",
"Table": "MyTable"
}
}
}
'import requests
url = "https://{titleId}.playfabapi.com/Event/SetDataConnection"
payload = {
"Name": "MyDataConnection",
"Type": "AzureDataExplorer",
"IsActive": True,
"ConnectionSettings": { "AzureDataExplorerSettings": {
"ClusterUri": "https://myadxcluster.kusto.windows.net",
"Database": "MyDatabase",
"Table": "MyTable"
} }
}
headers = {
"X-EntityToken": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-EntityToken': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
Name: 'MyDataConnection',
Type: 'AzureDataExplorer',
IsActive: true,
ConnectionSettings: {
AzureDataExplorerSettings: {
ClusterUri: 'https://myadxcluster.kusto.windows.net',
Database: 'MyDatabase',
Table: 'MyTable'
}
}
})
};
fetch('https://{titleId}.playfabapi.com/Event/SetDataConnection', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{titleId}.playfabapi.com/Event/SetDataConnection",
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([
'Name' => 'MyDataConnection',
'Type' => 'AzureDataExplorer',
'IsActive' => true,
'ConnectionSettings' => [
'AzureDataExplorerSettings' => [
'ClusterUri' => 'https://myadxcluster.kusto.windows.net',
'Database' => 'MyDatabase',
'Table' => 'MyTable'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-EntityToken: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{titleId}.playfabapi.com/Event/SetDataConnection"
payload := strings.NewReader("{\n \"Name\": \"MyDataConnection\",\n \"Type\": \"AzureDataExplorer\",\n \"IsActive\": true,\n \"ConnectionSettings\": {\n \"AzureDataExplorerSettings\": {\n \"ClusterUri\": \"https://myadxcluster.kusto.windows.net\",\n \"Database\": \"MyDatabase\",\n \"Table\": \"MyTable\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-EntityToken", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{titleId}.playfabapi.com/Event/SetDataConnection")
.header("X-EntityToken", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"Name\": \"MyDataConnection\",\n \"Type\": \"AzureDataExplorer\",\n \"IsActive\": true,\n \"ConnectionSettings\": {\n \"AzureDataExplorerSettings\": {\n \"ClusterUri\": \"https://myadxcluster.kusto.windows.net\",\n \"Database\": \"MyDatabase\",\n \"Table\": \"MyTable\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{titleId}.playfabapi.com/Event/SetDataConnection")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-EntityToken"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"Name\": \"MyDataConnection\",\n \"Type\": \"AzureDataExplorer\",\n \"IsActive\": true,\n \"ConnectionSettings\": {\n \"AzureDataExplorerSettings\": {\n \"ClusterUri\": \"https://myadxcluster.kusto.windows.net\",\n \"Database\": \"MyDatabase\",\n \"Table\": \"MyTable\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"status": "OK",
"data": {
"DataConnection": {
"Name": "MyDataConnection",
"Type": "AzureDataExplorer",
"IsActive": true,
"ConnectionSettings": {
"AzureDataExplorerSettings": {
"ClusterUri": "https://myadxcluster.kusto.windows.net",
"Database": "MyDatabase",
"Table": "MyTable"
}
},
"Status": {}
}
}
}{
"code": 123,
"errorCode": 123,
"status": "<string>",
"error": "<string>",
"errorMessage": "<string>",
"errorDetails": {}
}授权
This API requires an Entity Session Token, available from the Entity GetEntityToken method.
请求体
application/json
Settings of the data connection.
Show child attributes
Show child attributes
Whether or not the connection is currently active.
The name of the data connection to update or create.
The type of data connection.
可用选项:
AzureBlobStorage, AzureDataExplorer, FabricKQL The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).
响应
The Http status code. If X-ReportErrorAsSuccess header is set to true, this will report the actual http error code.
The Http status code as a string.
Show child attributes
Show child attributes
示例:
{
"DataConnection": {
"Name": "MyDataConnection",
"Type": "AzureDataExplorer",
"IsActive": true,
"ConnectionSettings": {
"AzureDataExplorerSettings": {
"ClusterUri": "https://myadxcluster.kusto.windows.net",
"Database": "MyDatabase",
"Table": "MyTable"
}
},
"Status": {}
}
}
最后修改于 2026年10月6日
此页面对您有帮助吗?
⌘I
Set Data Connection
curl --request POST \
--url https://{titleId}.playfabapi.com/Event/SetDataConnection \
--header 'Content-Type: application/json' \
--header 'X-EntityToken: <api-key>' \
--data '
{
"Name": "MyDataConnection",
"Type": "AzureDataExplorer",
"IsActive": true,
"ConnectionSettings": {
"AzureDataExplorerSettings": {
"ClusterUri": "https://myadxcluster.kusto.windows.net",
"Database": "MyDatabase",
"Table": "MyTable"
}
}
}
'import requests
url = "https://{titleId}.playfabapi.com/Event/SetDataConnection"
payload = {
"Name": "MyDataConnection",
"Type": "AzureDataExplorer",
"IsActive": True,
"ConnectionSettings": { "AzureDataExplorerSettings": {
"ClusterUri": "https://myadxcluster.kusto.windows.net",
"Database": "MyDatabase",
"Table": "MyTable"
} }
}
headers = {
"X-EntityToken": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-EntityToken': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
Name: 'MyDataConnection',
Type: 'AzureDataExplorer',
IsActive: true,
ConnectionSettings: {
AzureDataExplorerSettings: {
ClusterUri: 'https://myadxcluster.kusto.windows.net',
Database: 'MyDatabase',
Table: 'MyTable'
}
}
})
};
fetch('https://{titleId}.playfabapi.com/Event/SetDataConnection', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{titleId}.playfabapi.com/Event/SetDataConnection",
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([
'Name' => 'MyDataConnection',
'Type' => 'AzureDataExplorer',
'IsActive' => true,
'ConnectionSettings' => [
'AzureDataExplorerSettings' => [
'ClusterUri' => 'https://myadxcluster.kusto.windows.net',
'Database' => 'MyDatabase',
'Table' => 'MyTable'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-EntityToken: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{titleId}.playfabapi.com/Event/SetDataConnection"
payload := strings.NewReader("{\n \"Name\": \"MyDataConnection\",\n \"Type\": \"AzureDataExplorer\",\n \"IsActive\": true,\n \"ConnectionSettings\": {\n \"AzureDataExplorerSettings\": {\n \"ClusterUri\": \"https://myadxcluster.kusto.windows.net\",\n \"Database\": \"MyDatabase\",\n \"Table\": \"MyTable\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-EntityToken", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{titleId}.playfabapi.com/Event/SetDataConnection")
.header("X-EntityToken", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"Name\": \"MyDataConnection\",\n \"Type\": \"AzureDataExplorer\",\n \"IsActive\": true,\n \"ConnectionSettings\": {\n \"AzureDataExplorerSettings\": {\n \"ClusterUri\": \"https://myadxcluster.kusto.windows.net\",\n \"Database\": \"MyDatabase\",\n \"Table\": \"MyTable\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{titleId}.playfabapi.com/Event/SetDataConnection")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-EntityToken"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"Name\": \"MyDataConnection\",\n \"Type\": \"AzureDataExplorer\",\n \"IsActive\": true,\n \"ConnectionSettings\": {\n \"AzureDataExplorerSettings\": {\n \"ClusterUri\": \"https://myadxcluster.kusto.windows.net\",\n \"Database\": \"MyDatabase\",\n \"Table\": \"MyTable\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"status": "OK",
"data": {
"DataConnection": {
"Name": "MyDataConnection",
"Type": "AzureDataExplorer",
"IsActive": true,
"ConnectionSettings": {
"AzureDataExplorerSettings": {
"ClusterUri": "https://myadxcluster.kusto.windows.net",
"Database": "MyDatabase",
"Table": "MyTable"
}
},
"Status": {}
}
}
}{
"code": 123,
"errorCode": 123,
"status": "<string>",
"error": "<string>",
"errorMessage": "<string>",
"errorDetails": {}
}