你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Apis - Update

Updates the specified API of the API Management service instance.

PATCH https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}?api-version=2021-08-01

URI Parameters

Name In Required Type Description
apiId
path True

string

API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number.

Regex pattern: ^[^*#&+:<>?]+$

resourceGroupName
path True

string

The name of the resource group.

serviceName
path True

string

The name of the API Management service.

Regex pattern: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$

subscriptionId
path True

string

Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.

api-version
query True

string

Version of the API to be used with the client request.

Request Header

Name Required Type Description
If-Match True

string

ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update.

Request Body

Name Type Description
properties.apiRevision

string

Describes the revision of the API. If no value is provided, default revision 1 is created

properties.apiRevisionDescription

string

Description of the API Revision.

properties.apiVersion

string

Indicates the version identifier of the API if the API is versioned

properties.apiVersionDescription

string

Description of the API Version.

properties.apiVersionSetId

string

A resource identifier for the related ApiVersionSet.

properties.authenticationSettings

AuthenticationSettingsContract

Collection of authentication settings included into this API.

properties.contact

ApiContactInformation

Contact information for the API.

properties.description

string

Description of the API. May include HTML formatting tags.

properties.displayName

string

API name.

properties.isCurrent

boolean

Indicates if API revision is current api revision.

properties.license

ApiLicenseInformation

License information for the API.

properties.path

string

Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API.

properties.protocols

Protocol[]

Describes on which protocols the operations in this API can be invoked.

properties.serviceUrl

string

Absolute URL of the backend service implementing this API.

properties.subscriptionKeyParameterNames

SubscriptionKeyParameterNamesContract

Protocols over which API is made available.

properties.subscriptionRequired

boolean

Specifies whether an API or Product subscription is required for accessing the API.

properties.termsOfServiceUrl

string

A URL to the Terms of Service for the API. MUST be in the format of a URL.

properties.type

ApiType

Type of API.

Responses

Name Type Description
200 OK

ApiContract

API was successfully updated.

Headers

ETag: string

Other Status Codes

ErrorResponse

Error response describing why the operation failed.

Security

azure_auth

Azure Active Directory OAuth2 Flow.

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

ApiManagementUpdateApi

Sample request

PATCH https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api?api-version=2021-08-01


{
  "properties": {
    "displayName": "Echo API New",
    "serviceUrl": "http://echoapi.cloudapp.net/api2",
    "path": "newecho"
  }
}

Sample response

{
  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api",
  "type": "Microsoft.ApiManagement/service/apis",
  "name": "echo-api",
  "properties": {
    "displayName": "Echo API New",
    "apiRevision": "1",
    "serviceUrl": "http://echoapi.cloudapp.net/api2",
    "path": "newecho",
    "protocols": [
      "https"
    ],
    "subscriptionKeyParameterNames": {
      "header": "Ocp-Apim-Subscription-Key",
      "query": "subscription-key"
    },
    "isCurrent": true,
    "isOnline": true
  }
}

Definitions

Name Description
ApiContactInformation

API contact information

ApiContract

API details.

ApiLicenseInformation

API license information

ApiType

Type of API.

ApiUpdateContract

API update contract details.

ApiVersionSetContractDetails

An API Version Set contains the common configuration for a set of API Versions relating

AuthenticationSettingsContract

API Authentication Settings.

bearerTokenSendingMethods

How to send token to the server.

ErrorFieldContract

Error Field contract.

ErrorResponse

Error Response.

OAuth2AuthenticationSettingsContract

API OAuth2 Authentication settings details.

OpenIdAuthenticationSettingsContract

API OAuth2 Authentication settings details.

Protocol

Describes on which protocols the operations in this API can be invoked.

SubscriptionKeyParameterNamesContract

Subscription key parameter names details.

ApiContactInformation

API contact information

Name Type Description
email

string

The email address of the contact person/organization. MUST be in the format of an email address

name

string

The identifying name of the contact person/organization

url

string

The URL pointing to the contact information. MUST be in the format of a URL

ApiContract

API details.

Name Type Description
id

string

Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

The name of the resource

properties.apiRevision

string

Describes the revision of the API. If no value is provided, default revision 1 is created

properties.apiRevisionDescription

string

Description of the API Revision.

properties.apiVersion

string

Indicates the version identifier of the API if the API is versioned

properties.apiVersionDescription

string

Description of the API Version.

properties.apiVersionSet

ApiVersionSetContractDetails

Version set details

properties.apiVersionSetId

string

A resource identifier for the related ApiVersionSet.

properties.authenticationSettings

AuthenticationSettingsContract

Collection of authentication settings included into this API.

properties.contact

ApiContactInformation

Contact information for the API.

properties.description

string

Description of the API. May include HTML formatting tags.

properties.displayName

string

API name. Must be 1 to 300 characters long.

properties.isCurrent

boolean

Indicates if API revision is current api revision.

properties.isOnline

boolean

Indicates if API revision is accessible via the gateway.

properties.license

ApiLicenseInformation

License information for the API.

properties.path

string

Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API.

properties.protocols

Protocol[]

Describes on which protocols the operations in this API can be invoked.

properties.serviceUrl

string

Absolute URL of the backend service implementing this API. Cannot be more than 2000 characters long.

properties.sourceApiId

string

API identifier of the source API.

properties.subscriptionKeyParameterNames

SubscriptionKeyParameterNamesContract

Protocols over which API is made available.

properties.subscriptionRequired

boolean

Specifies whether an API or Product subscription is required for accessing the API.

properties.termsOfServiceUrl

string

A URL to the Terms of Service for the API. MUST be in the format of a URL.

properties.type

ApiType

Type of API.

type

string

The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"

ApiLicenseInformation

API license information

Name Type Description
name

string

The license name used for the API

url

string

A URL to the license used for the API. MUST be in the format of a URL

ApiType

Type of API.

Name Type Description
graphql

string

http

string

soap

string

websocket

string

ApiUpdateContract

API update contract details.

Name Type Description
properties.apiRevision

string

Describes the revision of the API. If no value is provided, default revision 1 is created

properties.apiRevisionDescription

string

Description of the API Revision.

properties.apiVersion

string

Indicates the version identifier of the API if the API is versioned

properties.apiVersionDescription

string

Description of the API Version.

properties.apiVersionSetId

string

A resource identifier for the related ApiVersionSet.

properties.authenticationSettings

AuthenticationSettingsContract

Collection of authentication settings included into this API.

properties.contact

ApiContactInformation

Contact information for the API.

properties.description

string

Description of the API. May include HTML formatting tags.

properties.displayName

string

API name.

properties.isCurrent

boolean

Indicates if API revision is current api revision.

properties.isOnline

boolean

Indicates if API revision is accessible via the gateway.

properties.license

ApiLicenseInformation

License information for the API.

properties.path

string

Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API.

properties.protocols

Protocol[]

Describes on which protocols the operations in this API can be invoked.

properties.serviceUrl

string

Absolute URL of the backend service implementing this API.

properties.subscriptionKeyParameterNames

SubscriptionKeyParameterNamesContract

Protocols over which API is made available.

properties.subscriptionRequired

boolean

Specifies whether an API or Product subscription is required for accessing the API.

properties.termsOfServiceUrl

string

A URL to the Terms of Service for the API. MUST be in the format of a URL.

properties.type

ApiType

Type of API.

ApiVersionSetContractDetails

An API Version Set contains the common configuration for a set of API Versions relating

Name Type Description
description

string

Description of API Version Set.

id

string

Identifier for existing API Version Set. Omit this value to create a new Version Set.

name

string

The display Name of the API Version Set.

versionHeaderName

string

Name of HTTP header parameter that indicates the API Version if versioningScheme is set to header.

versionQueryName

string

Name of query parameter that indicates the API Version if versioningScheme is set to query.

versioningScheme enum:
  • Header
  • Query
  • Segment

An value that determines where the API Version identifier will be located in a HTTP request.

AuthenticationSettingsContract

API Authentication Settings.

Name Type Description
oAuth2

OAuth2AuthenticationSettingsContract

OAuth2 Authentication settings

openid

OpenIdAuthenticationSettingsContract

OpenID Connect Authentication Settings

bearerTokenSendingMethods

How to send token to the server.

Name Type Description
authorizationHeader

string

Access token will be transmitted in the Authorization header using Bearer schema

query

string

Access token will be transmitted as query parameters.

ErrorFieldContract

Error Field contract.

Name Type Description
code

string

Property level error code.

message

string

Human-readable representation of property-level error.

target

string

Property name.

ErrorResponse

Error Response.

Name Type Description
error.code

string

Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response.

error.details

ErrorFieldContract[]

The list of invalid fields send in request, in case of validation error.

error.message

string

Human-readable representation of the error.

OAuth2AuthenticationSettingsContract

API OAuth2 Authentication settings details.

Name Type Description
authorizationServerId

string

OAuth authorization server identifier.

scope

string

operations scope.

OpenIdAuthenticationSettingsContract

API OAuth2 Authentication settings details.

Name Type Description
bearerTokenSendingMethods

bearerTokenSendingMethods[]

How to send token to the server.

openidProviderId

string

OAuth authorization server identifier.

Protocol

Describes on which protocols the operations in this API can be invoked.

Name Type Description
http

string

https

string

ws

string

wss

string

SubscriptionKeyParameterNamesContract

Subscription key parameter names details.

Name Type Description
header

string

Subscription key header name.

query

string

Subscription key query string parameter name.