Gateway Api - Create Or Update
将 API 添加到指定的网关。
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}?api-version=2022-08-01
URI 参数
名称 | 在 | 必需 | 类型 | 说明 |
---|---|---|---|---|
api
|
path | True |
string minLength: 1maxLength: 80 |
API 标识符。 当前 API 管理服务实例中必须是唯一的。 |
gateway
|
path | True |
string minLength: 1maxLength: 80 |
网关实体标识符。 当前 API 管理服务实例中必须是唯一的。 不得具有值“managed” |
resource
|
path | True |
string minLength: 1maxLength: 90 |
资源组的名称。 名称不区分大小写。 |
service
|
path | True |
string minLength: 1maxLength: 50 pattern: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$ |
API 管理服务的名称。 |
subscription
|
path | True |
string minLength: 1 |
目标订阅的 ID。 |
api-version
|
query | True |
string minLength: 1 |
用于此作的 API 版本。 |
请求正文
名称 | 类型 | 说明 |
---|---|---|
properties.provisioningState |
预配状态。 |
响应
名称 | 类型 | 说明 |
---|---|---|
200 OK |
指定的 API 已添加到网关。 |
|
201 Created |
API 已成功添加到网关。 |
|
Other Status Codes |
描述作失败的原因的错误响应。 |
安全性
azure_auth
Azure Active Directory OAuth2 Flow。
类型:
oauth2
流向:
implicit
授权 URL:
https://login.microsoftonline.com/common/oauth2/authorize
作用域
名称 | 说明 |
---|---|
user_impersonation | 模拟用户帐户 |
示例
ApiManagementCreateGatewayApi
示例请求
示例响应
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/gateways/gw1/apis/echo-api",
"type": "Microsoft.ApiManagement/service/gateways/apis",
"name": "echo-api",
"properties": {
"displayName": "EchoApi",
"apiRevision": "1",
"serviceUrl": "https://contoso.com/apis/echo",
"path": "",
"protocols": [
"http",
"https"
],
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"isCurrent": true
}
}
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/gateways/gw1/apis/echo-api",
"type": "Microsoft.ApiManagement/service/gateways/apis",
"name": "echo-api",
"properties": {
"displayName": "EchoApi",
"apiRevision": "1",
"serviceUrl": "https://contoso.com/apis/echo",
"path": "",
"protocols": [
"http",
"https"
],
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"isCurrent": true
}
}
定义
名称 | 说明 |
---|---|
Api |
API 联系信息 |
Api |
API 详细信息。 |
Api |
API 许可证信息 |
Api |
API 的类型。 |
Api |
API 版本集包含一组与 API 版本相关的常见配置 |
Association |
关联实体详细信息。 |
Authentication |
API 身份验证设置。 |
bearer |
如何将令牌发送到服务器。 |
Error |
错误字段协定。 |
Error |
错误响应。 |
OAuth2Authentication |
API OAuth2 身份验证设置详细信息。 |
Open |
API OAuth2 身份验证设置详细信息。 |
Protocol |
描述可以调用此 API 中的作的协议。 |
Provisioning |
预配状态。 |
Subscription |
订阅密钥参数名称详细信息。 |
versioning |
一个值,该值确定 API 版本标识符将位于 HTTP 请求中的位置。 |
ApiContactInformation
API 联系信息
名称 | 类型 | 说明 |
---|---|---|
string |
联系人/组织的电子邮件地址。 必须采用电子邮件地址格式 |
|
name |
string |
联系人/组织的标识名称 |
url |
string |
指向联系信息的 URL。 必须采用 URL 格式 |
ApiContract
API 详细信息。
名称 | 类型 | 说明 |
---|---|---|
id |
string |
资源的完全限定资源 ID。 Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} |
name |
string |
资源的名称 |
properties.apiRevision |
string minLength: 1maxLength: 100 |
描述 API 的修订。 如果未提供任何值,则会创建默认修订版 1 |
properties.apiRevisionDescription |
string maxLength: 256 |
API 修订的说明。 |
properties.apiVersion |
string maxLength: 100 |
指示 API 的版本标识符(如果 API 已进行版本控制) |
properties.apiVersionDescription |
string maxLength: 256 |
API 版本的说明。 |
properties.apiVersionSet |
版本集详细信息 |
|
properties.apiVersionSetId |
string |
相关 ApiVersionSet 的资源标识符。 |
properties.authenticationSettings |
此 API 中包含的身份验证设置的集合。 |
|
properties.contact |
API 的联系信息。 |
|
properties.description |
string |
API 的说明。 可能包括 HTML 格式标记。 |
properties.displayName |
string minLength: 1maxLength: 300 |
API 名称。 长度必须为 1 到 300 个字符。 |
properties.isCurrent |
boolean |
指示 API 修订是否为当前 API 修订版。 |
properties.isOnline |
boolean |
指示是否可通过网关访问 API 修订。 |
properties.license |
API 的许可证信息。 |
|
properties.path |
string minLength: 0maxLength: 400 |
相对 URL 唯一标识此 API 及其所有资源路径在 API 管理服务实例中。 它追加到服务实例创建期间指定的 API 终结点基 URL,以形成此 API 的公共 URL。 |
properties.protocols |
Protocol[] |
描述可以调用此 API 中的作的协议。 |
properties.serviceUrl |
string minLength: 0maxLength: 2000 |
实现此 API 的后端服务的绝对 URL。 长度不能超过 2000 个字符。 |
properties.sourceApiId |
string |
源 API 的 API 标识符。 |
properties.subscriptionKeyParameterNames |
提供 API 的协议。 |
|
properties.subscriptionRequired |
boolean |
指定访问 API 是否需要 API 或产品订阅。 |
properties.termsOfServiceUrl |
string |
API 服务条款的 URL。 必须采用 URL 格式。 |
properties.type |
API 的类型。 |
|
type |
string |
资源的类型。 例如“Microsoft.Compute/virtualMachines”或“Microsoft.Storage/storageAccounts” |
ApiLicenseInformation
API 许可证信息
名称 | 类型 | 说明 |
---|---|---|
name |
string |
用于 API 的许可证名称 |
url |
string |
用于 API 的许可证的 URL。 必须采用 URL 格式 |
ApiType
API 的类型。
值 | 说明 |
---|---|
graphql | |
http | |
soap | |
websocket |
ApiVersionSetContractDetails
API 版本集包含一组与 API 版本相关的常见配置
名称 | 类型 | 说明 |
---|---|---|
description |
string |
API 版本集的说明。 |
id |
string |
现有 API 版本集的标识符。 省略此值以创建新的版本集。 |
name |
string |
API 版本集的显示名称。 |
versionHeaderName |
string |
如果 versioningScheme 设置为 |
versionQueryName |
string |
如果 versioningScheme 设置为 |
versioningScheme |
一个值,该值确定 API 版本标识符将位于 HTTP 请求中的位置。 |
AssociationContract
关联实体详细信息。
名称 | 类型 | 说明 |
---|---|---|
id |
string |
资源的完全限定资源 ID。 Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} |
name |
string |
资源的名称 |
properties.provisioningState |
预配状态。 |
|
type |
string |
资源的类型。 例如“Microsoft.Compute/virtualMachines”或“Microsoft.Storage/storageAccounts” |
AuthenticationSettingsContract
API 身份验证设置。
名称 | 类型 | 说明 |
---|---|---|
oAuth2 |
OAuth2 身份验证设置 |
|
oAuth2AuthenticationSettings |
包含在此 API 中的 OAuth2 身份验证设置的集合。 |
|
openid |
OpenID Connect 身份验证设置 |
|
openidAuthenticationSettings |
此 API 中包含的 Open ID Connect 身份验证设置的集合。 |
bearerTokenSendingMethods
如何将令牌发送到服务器。
值 | 说明 |
---|---|
authorizationHeader |
使用持有者架构在授权标头中传输访问令牌 |
query |
访问令牌将作为查询参数传输。 |
ErrorFieldContract
错误字段协定。
名称 | 类型 | 说明 |
---|---|---|
code |
string |
属性级别错误代码。 |
message |
string |
属性级错误的人工可读表示形式。 |
target |
string |
属性名称。 |
ErrorResponse
错误响应。
名称 | 类型 | 说明 |
---|---|---|
error.code |
string |
服务定义的错误代码。 此代码充当响应中指定的 HTTP 错误代码的子状态。 |
error.details |
请求中发送的无效字段列表(如果出现验证错误)。 |
|
error.message |
string |
错误的人工可读表示形式。 |
OAuth2AuthenticationSettingsContract
API OAuth2 身份验证设置详细信息。
名称 | 类型 | 说明 |
---|---|---|
authorizationServerId |
string |
OAuth 授权服务器标识符。 |
scope |
string |
作范围。 |
OpenIdAuthenticationSettingsContract
API OAuth2 身份验证设置详细信息。
名称 | 类型 | 说明 |
---|---|---|
bearerTokenSendingMethods |
如何将令牌发送到服务器。 |
|
openidProviderId |
string |
OAuth 授权服务器标识符。 |
Protocol
描述可以调用此 API 中的作的协议。
值 | 说明 |
---|---|
http | |
https | |
ws | |
wss |
ProvisioningState
预配状态。
值 | 说明 |
---|---|
created |
SubscriptionKeyParameterNamesContract
订阅密钥参数名称详细信息。
名称 | 类型 | 说明 |
---|---|---|
header |
string |
订阅密钥标头名称。 |
query |
string |
订阅密钥查询字符串参数名称。 |
versioningScheme
一个值,该值确定 API 版本标识符将位于 HTTP 请求中的位置。
值 | 说明 |
---|---|
Header |
API 版本在 HTTP 标头中传递。 |
Query |
API 版本在查询参数中传递。 |
Segment |
API 版本在路径段中传递。 |