连接
删除连接
删除连接。该连接不得被任何有效的路由规则引用。
DELETE
/
connections
/
{connection_id}
删除连接
curl --request DELETE \
--url https://api-sandbox.y.uno/v1/connections/{connection_id} \
--header 'PRIVATE-SECRET-KEY: <api-key>' \
--header 'PUBLIC-API-KEY: <api-key>' \
--header 'X-Account-Code: <x-account-code>'import requests
url = "https://api-sandbox.y.uno/v1/connections/{connection_id}"
headers = {
"X-Account-Code": "<x-account-code>",
"PUBLIC-API-KEY": "<api-key>",
"PRIVATE-SECRET-KEY": "<api-key>"
}
response = requests.delete(url, headers=headers)
print(response.text)const options = {
method: 'DELETE',
headers: {
'X-Account-Code': '<x-account-code>',
'PUBLIC-API-KEY': '<api-key>',
'PRIVATE-SECRET-KEY': '<api-key>'
}
};
fetch('https://api-sandbox.y.uno/v1/connections/{connection_id}', 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://api-sandbox.y.uno/v1/connections/{connection_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"PRIVATE-SECRET-KEY: <api-key>",
"PUBLIC-API-KEY: <api-key>",
"X-Account-Code: <x-account-code>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api-sandbox.y.uno/v1/connections/{connection_id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("X-Account-Code", "<x-account-code>")
req.Header.Add("PUBLIC-API-KEY", "<api-key>")
req.Header.Add("PRIVATE-SECRET-KEY", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api-sandbox.y.uno/v1/connections/{connection_id}")
.header("X-Account-Code", "<x-account-code>")
.header("PUBLIC-API-KEY", "<api-key>")
.header("PRIVATE-SECRET-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.y.uno/v1/connections/{connection_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["X-Account-Code"] = '<x-account-code>'
request["PUBLIC-API-KEY"] = '<api-key>'
request["PRIVATE-SECRET-KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"type": "auth_error",
"code": "NOT_AUTHENTICATED",
"message": "Not authenticated"
}{
"type": "not_found",
"code": "CONNECTION_NOT_FOUND",
"message": "Connection '...' was not found"
}{
"type": "conflict",
"code": "CONNECTION_IN_USE",
"message": "Connection '...' is still referenced by an active routing rule"
}删除您之前创建的连接。成功时返回
204 No Content。
已知问题:返回
204 后,检索该连接时其状态仍显示为 ACTIVE。此调用不会改变检索返回的状态。仍被有效路由规则引用的连接无法删除:请求会失败并返回
409 CONNECTION_IN_USE。请先将其从您的路由中解除,然后重试。路径参数
创建连接 返回的 id。必须属于您的 API 密钥所作用的账户。
标头
响应
返回204 No Content,响应体为空。
curl -X DELETE 'https://api.y.uno/v1/connections/f1a3c4d5-7b8e-4a2c-9d1e-3f4a5b6c7d8e' \
-H 'public-api-key: <YOUR_PUBLIC_KEY>' \
-H 'private-secret-key: <YOUR_SECRET_KEY>' \
-H 'X-Account-Code: a1b2c3d4-e5f6-7890-abcd-ef1234567890'
{
"type": "conflict",
"code": "CONNECTION_IN_USE",
"message": "Connection 'f1a3c4d5-7b8e-4a2c-9d1e-3f4a5b6c7d8e' is still referenced by an active routing rule",
"details": { "connection_id": "f1a3c4d5-7b8e-4a2c-9d1e-3f4a5b6c7d8e" }
}
{
"type": "not_found",
"code": "CONNECTION_NOT_FOUND",
"message": "Connection '...' was not found",
"details": { "connection_id": "..." }
}
错误
| HTTP | code |
|---|---|
401 | NOT_AUTHENTICATEDAPI 密钥缺失或无效。 |
404 | CONNECTION_NOT_FOUND未知的 connection_id,或该 id 属于其他账户。 |
409 | CONNECTION_IN_USE该连接仍被有效的路由规则引用。 |
此页面对您有帮助吗?
⌘I
删除连接
curl --request DELETE \
--url https://api-sandbox.y.uno/v1/connections/{connection_id} \
--header 'PRIVATE-SECRET-KEY: <api-key>' \
--header 'PUBLIC-API-KEY: <api-key>' \
--header 'X-Account-Code: <x-account-code>'import requests
url = "https://api-sandbox.y.uno/v1/connections/{connection_id}"
headers = {
"X-Account-Code": "<x-account-code>",
"PUBLIC-API-KEY": "<api-key>",
"PRIVATE-SECRET-KEY": "<api-key>"
}
response = requests.delete(url, headers=headers)
print(response.text)const options = {
method: 'DELETE',
headers: {
'X-Account-Code': '<x-account-code>',
'PUBLIC-API-KEY': '<api-key>',
'PRIVATE-SECRET-KEY': '<api-key>'
}
};
fetch('https://api-sandbox.y.uno/v1/connections/{connection_id}', 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://api-sandbox.y.uno/v1/connections/{connection_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"PRIVATE-SECRET-KEY: <api-key>",
"PUBLIC-API-KEY: <api-key>",
"X-Account-Code: <x-account-code>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api-sandbox.y.uno/v1/connections/{connection_id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("X-Account-Code", "<x-account-code>")
req.Header.Add("PUBLIC-API-KEY", "<api-key>")
req.Header.Add("PRIVATE-SECRET-KEY", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api-sandbox.y.uno/v1/connections/{connection_id}")
.header("X-Account-Code", "<x-account-code>")
.header("PUBLIC-API-KEY", "<api-key>")
.header("PRIVATE-SECRET-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.y.uno/v1/connections/{connection_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["X-Account-Code"] = '<x-account-code>'
request["PUBLIC-API-KEY"] = '<api-key>'
request["PRIVATE-SECRET-KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"type": "auth_error",
"code": "NOT_AUTHENTICATED",
"message": "Not authenticated"
}{
"type": "not_found",
"code": "CONNECTION_NOT_FOUND",
"message": "Connection '...' was not found"
}{
"type": "conflict",
"code": "CONNECTION_IN_USE",
"message": "Connection '...' is still referenced by an active routing rule"
}