Product Api - Create Or Update

Adds an API to the specified product.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/apis/{apiId}?api-version=2019-01-01

URI Parameters

Name In Required Type Description
subscriptionId
path True
  • string

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

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])?$

productId
path True
  • string

Product identifier. Must be unique in the current API Management service instance.

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: ^[^*#&+:<>?]+$

api-version
query True
  • string

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

Responses

Name Type Description
200 OK

The specified API is already added to the product.

201 Created

The API was successfully added to the product.

Other Status Codes

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

ApiManagementCreateProductApi

Sample Request

PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/testproduct/apis/echo-api?api-version=2019-01-01

Sample Response

{
  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/5931a75ae4bbd512a88c680b",
  "type": "Microsoft.ApiManagement/service/apis",
  "name": "5931a75ae4bbd512a88c680b",
  "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/apis/5931a75ae4bbd512a88c680b",
  "type": "Microsoft.ApiManagement/service/apis",
  "name": "5931a75ae4bbd512a88c680b",
  "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
  }
}

Definitions

ApiContract

Api details.

ApiType

Type of API.

ApiVersionSetContractDetails

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

AuthenticationSettingsContract

API Authentication Settings.

ErrorFieldContract

Error Field contract.

ErrorResponse

Error Response.

OAuth2AuthenticationSettingsContract

API OAuth2 Authentication settings details.

OpenIdAuthenticationSettingsContract

API OAuth2 Authentication settings details.

SubscriptionKeyParameterNamesContract

Subscription key parameter names details.

ApiContract

Api details.

Name Type Description
id
  • string

Resource ID.

name
  • string

Resource name.

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

Version set details

properties.apiVersionSetId
  • string

A resource identifier for the related ApiVersionSet.

properties.authenticationSettings

Collection of authentication settings included into this 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.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
  • string[]

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

Protocols over which API is made available.

properties.subscriptionRequired
  • boolean

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

properties.type

Type of API.

type
  • string

Resource type for API Management resource.

ApiType

Type of API.

Name Type Description
http
  • string
soap
  • string

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 identifer will be located in a HTTP request.

AuthenticationSettingsContract

API Authentication Settings.

Name Type Description
oAuth2

OAuth2 Authentication settings

openid

OpenID Connect Authentication Settings

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

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
  • string[]

How to send token to the server.

openidProviderId
  • string

OAuth authorization server identifier.

SubscriptionKeyParameterNamesContract

Subscription key parameter names details.

Name Type Description
header
  • string

Subscription key header name.

query
  • string

Subscription key query string parameter name.