Endpoints - Create
建立新的服務端點
POST https://dev.azure.com/{organization}/_apis/serviceendpoint/endpoints?api-version=7.1
URI 參數
| 名稱 | 位於 | 必要 | 類型 | Description |
|---|---|---|---|---|
|
organization
|
path | True |
string |
Azure DevOps 組織的名稱。 |
|
api-version
|
query | True |
string |
要使用的 API 版本。 這應該設定為 『7.1』 以使用此版本的 API。 |
要求本文
| 名稱 | 類型 | Description |
|---|---|---|
| administratorsGroup |
這是已被取代的欄位。 |
|
| authorization |
取得或設定與端點通訊的授權數據。 |
|
| createdBy |
取得或設定建立服務端點之用戶的識別參考。 |
|
| data |
object |
|
| description |
string |
取得或設定端點的描述。 |
| groupScopeId |
string (uuid) |
這是已被取代的欄位。 |
| id |
string (uuid) |
取得或設定這個端點的標識碼。 |
| isReady |
boolean |
EndPoint 狀態指標 |
| isShared |
boolean |
指出服務端點是否與其他項目共用。 |
| name |
string |
取得或設定端點的易記名稱。 |
| operationStatus |
建立/刪除端點時發生錯誤訊息 |
|
| owner |
string |
端點的擁有者支援的值為 “library”、“agentcloud” |
| readersGroup |
取得或設定服務端點讀取器群組的識別參考。 |
|
| serviceEndpointProjectReferences |
共用服務端點的所有其他項目參考。 |
|
| type |
string |
取得或設定端點的類型。 |
| url |
string |
取得或設定端點的 URL。 |
回應
| 名稱 | 類型 | Description |
|---|---|---|
| 200 OK |
成功作業 |
安全性
oauth2
類型:
oauth2
Flow:
accessCode
授權 URL:
https://app.vssps.visualstudio.com/oauth2/authorize&response_type=Assertion
權杖 URL:
https://app.vssps.visualstudio.com/oauth2/token?client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer
範圍
| 名稱 | Description |
|---|---|
| vso.serviceendpoint_manage | 授與讀取、查詢及管理服務端點的能力。 |
範例
| Create Azure RM service endpoint |
| Create service endpoint |
Create Azure RM service endpoint
範例要求
POST https://dev.azure.com/{organization}/_apis/serviceendpoint/endpoints?api-version=7.1
{
"data": {
"subscriptionId": "1272a66f-e2e8-4e88-ab43-487409186c3f",
"subscriptionName": "subscriptionName",
"environment": "AzureCloud",
"scopeLevel": "Subscription",
"creationMode": "Manual"
},
"name": "MyNewARMServiceEndpoint",
"type": "AzureRM",
"url": "https://management.azure.com/",
"authorization": {
"parameters": {
"tenantid": "1272a66f-e2e8-4e88-ab43-487409186c3f",
"serviceprincipalid": "1272a66f-e2e8-4e88-ab43-487409186c3f",
"authenticationType": "spnKey",
"serviceprincipalkey": "SomePassword"
},
"scheme": "ServicePrincipal"
},
"isShared": false,
"isReady": true,
"serviceEndpointProjectReferences": [
{
"projectReference": {
"id": "c7e5f0b3-71fa-4429-9fb3-3321963a7c06",
"name": "TestProject"
},
"name": "MyNewARMServiceEndpoint"
}
]
}
範例回覆
{
"data": {
"subscriptionId": "1272a66f-e2e8-4e88-ab43-487409186c3f",
"subscriptionName": "subscriptionName",
"environment": "AzureCloud",
"scopeLevel": "Subscription",
"creationMode": "Manual"
},
"id": "1dfdea68-9549-409e-abee-c5da69cfec5f",
"name": "MyNewARMServiceEndpoint",
"type": "AzureRM",
"url": "https://management.azure.com/",
"createdBy": {
"displayName": "Chuck Reinhart",
"url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/e18a1f0a-b112-67fd-a9e0-e3bb081da49e",
"_links": {
"avatar": {
"href": "https://dev.azure.com/fabrikam/_apis/GraphProfile/MemberAvatars/msa.ZTE4YTFmMGEtYjExMi03N2ZkLWE5ZTAtZTNiYjA4MWRhNDll"
}
},
"id": "e18a1f0a-b112-67fd-a9e0-e3bb081da49e",
"uniqueName": "anpuri@outlook-int.com",
"imageUrl": "https://dev.azure.com/fabrikam/_apis/GraphProfile/MemberAvatars/msa.ZTE4YTFmMGEtYjExMi03N2ZkLWE5ZTAtZTNiYjA4MWRhNDll",
"descriptor": "msa.ZTE4YTFmMGEtYjExMi03N2ZkLWE5ZTAtZTNiYjA4MWRhNDll"
},
"authorization": {
"parameters": {
"tenantid": "1272a66f-e2e8-4e88-ab43-487409186c3f",
"serviceprincipalid": "1272a66f-e2e8-4e88-ab43-487409186c3f",
"authenticationType": "spnKey",
"serviceprincipalkey": null
},
"scheme": "ServicePrincipal"
},
"isShared": false,
"isReady": true,
"owner": "library",
"serviceEndpointProjectReferences": [
{
"projectReference": {
"id": "c7e5f0b3-71fa-4429-9fb3-3321963a7c06",
"name": "TestProject"
},
"name": "MyNewARMServiceEndpoint"
}
]
}
Create service endpoint
範例要求
POST https://dev.azure.com/{organization}/_apis/serviceendpoint/endpoints?api-version=7.1
{
"data": {},
"name": "MyNewServiceEndpoint",
"type": "Generic",
"url": "https://myserver",
"authorization": {
"parameters": {
"username": "myusername",
"password": "mysecretpassword"
},
"scheme": "UsernamePassword"
},
"isShared": false,
"isReady": true,
"serviceEndpointProjectReferences": [
{
"projectReference": {
"id": "c7e5f0b3-71fa-4429-9fb3-3321963a7c06",
"name": "TestProject"
},
"name": "MyNewServiceEndpoint"
}
]
}
範例回覆
{
"data": {},
"id": "5e47a0d8-c745-44f8-8f93-784f18ff31c4",
"name": "MyNewServiceEndpoint",
"type": "Generic",
"url": "https://myserver",
"createdBy": {
"displayName": "Chuck Reinhart",
"url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/e18a1f0a-b112-67fd-a9e0-e3bb081da49e",
"_links": {
"avatar": {
"href": "https://dev.azure.com/fabrikam/_apis/GraphProfile/MemberAvatars/msa.ZTE4YTFmMGEtYjExMi03N2ZkLWE5ZTAtZTNiYjA4MWRhNDll"
}
},
"id": "4adb1680-0eac-6149-b5ee-fc8b4f6ca227",
"uniqueName": "fabfiber@outlook.com",
"imageUrl": "https://dev.azure.com/fabrikam/_apis/GraphProfile/MemberAvatars/msa.ZTE4YTFmMGEtYjExMi03N2ZkLWE5ZTAtZTNiYjA4MWRhNDll",
"descriptor": "msa.ZTE4YTFmMGEtYjExMi03N2ZkLWE5ZTAtZTNiYjA4MWRhNDll"
},
"authorization": {
"parameters": {
"username": "myusername",
"password": null
},
"scheme": "UsernamePassword"
},
"isShared": false,
"isReady": true,
"owner": "library",
"serviceEndpointProjectReferences": [
{
"projectReference": {
"id": "c7e5f0b3-71fa-4429-9fb3-3321963a7c06",
"name": "TestProject"
},
"name": "MyNewServiceEndpoint"
}
]
}
定義
| 名稱 | Description |
|---|---|
|
Endpoint |
表示用於服務端點的授權。 |
|
Identity |
|
| JObject |
表示 JSON 物件。 |
| JToken |
表示抽象 JSON 令牌。 |
|
Project |
|
|
Reference |
表示 REST 參考連結集合的類別。 |
|
Service |
表示協調流程作業可使用的端點。 |
|
Service |
EndpointAuthorization
表示用於服務端點的授權。
| 名稱 | 類型 | Description |
|---|---|---|
| parameters |
object |
取得或設定所選授權配置的參數。 |
| scheme |
string |
取得或設定用於服務端點驗證的配置。 |
IdentityRef
| 名稱 | 類型 | Description |
|---|---|---|
| _links |
此欄位包含圖表主旨的相關零或更多有趣連結。 您可以叫用這些連結,以取得此圖表主題的其他關聯性或更詳細的資訊。 |
|
| descriptor |
string |
描述元是在系統執行時參考圖表主旨的主要方式。 此欄位會唯一識別帳戶和組織之間的相同圖表主題。 |
| directoryAlias |
string |
已淘汰 - 查詢 IdentityRef “_links” 字典中參考的 Graph 使用者,即可擷取 |
| displayName |
string |
這是圖形主體的非唯一顯示名稱。 若要變更此欄位,您必須在來源提供者中變更其值。 |
| id |
string |
|
| imageUrl |
string |
已淘汰 - 可在 IdentityRef “_links” 字典的 “avatar” 專案中取得 |
| inactive |
boolean |
已淘汰 - 可藉由查詢 GraphUser “_links” 字典的 “membershipState” 專案中參考的 Graph 成員資格狀態來擷取 |
| isAadIdentity |
boolean |
已淘汰 - 可以從描述元的主體類型推斷 (Descriptor.IsAadUserType/Descriptor.IsAadGroupType) |
| isContainer |
boolean |
已淘汰 - 可以從描述元的主體類型推斷 (Descriptor.IsGroupType) |
| isDeletedInOrigin |
boolean |
|
| profileUrl |
string |
已淘汰 - 未在 ToIdentityRef 的大部分預先存在實作中使用 |
| uniqueName |
string |
已淘汰 - 請改用 Domain+PrincipalName |
| url |
string |
此 URL 是此圖表主體來源資源的完整路由。 |
JObject
表示 JSON 物件。
| 名稱 | 類型 | Description |
|---|---|---|
| item |
表示抽象 JSON 令牌。 |
|
| type |
string (JTokenType) |
取得這個 JToken 的節點類型。 |
JToken
表示抽象 JSON 令牌。
| 名稱 | 類型 | Description |
|---|---|---|
| first |
取得此令牌的第一個子令牌。 |
|
| hasValues |
boolean |
取得值,指出這個令牌是否具有子令牌。 |
| item |
表示抽象 JSON 令牌。 |
|
| last |
取得此令牌的最後一個子令牌。 |
|
| next |
取得這個節點的下一個同層級令牌。 |
|
| parent |
string (JContainer) |
取得或設定父代。 |
| path |
string |
取得 JSON 令牌的路徑。 |
| previous |
取得這個節點的上一個同層級令牌。 |
|
| root |
取得這個 JToken 的根 JToken。 |
|
| type |
string (JTokenType) |
取得這個 JToken 的節點類型。 |
ProjectReference
| 名稱 | 類型 | Description |
|---|---|---|
| id |
string (uuid) |
|
| name |
string |
ReferenceLinks
表示 REST 參考連結集合的類別。
| 名稱 | 類型 | Description |
|---|---|---|
| links |
object |
連結的只讀檢視。 因為參考連結是只讀的,所以我們只想要將其公開為只讀。 |
ServiceEndpoint
表示協調流程作業可使用的端點。
| 名稱 | 類型 | Description |
|---|---|---|
| administratorsGroup |
這是已被取代的欄位。 |
|
| authorization |
取得或設定與端點通訊的授權數據。 |
|
| createdBy |
取得或設定建立服務端點之用戶的識別參考。 |
|
| data |
object |
|
| description |
string |
取得或設定端點的描述。 |
| groupScopeId |
string (uuid) |
這是已被取代的欄位。 |
| id |
string (uuid) |
取得或設定這個端點的標識碼。 |
| isReady |
boolean |
EndPoint 狀態指標 |
| isShared |
boolean |
指出服務端點是否與其他項目共用。 |
| name |
string |
取得或設定端點的易記名稱。 |
| operationStatus |
建立/刪除端點時發生錯誤訊息 |
|
| owner |
string |
端點的擁有者支援的值為 “library”、“agentcloud” |
| readersGroup |
取得或設定服務端點讀取器群組的識別參考。 |
|
| serviceEndpointProjectReferences |
共用服務端點的所有其他項目參考。 |
|
| type |
string |
取得或設定端點的類型。 |
| url |
string |
取得或設定端點的 URL。 |
ServiceEndpointProjectReference
| 名稱 | 類型 | Description |
|---|---|---|
| description |
string |
取得或設定服務端點的描述。 |
| name |
string |
取得或設定服務端點的名稱。 |
| projectReference |
取得或設定服務端點的項目參考。 |