Gets the details of the API specified by its identifier.
GET 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.
|
Responses
Name |
Type |
Description |
200 OK
|
ApiContract
|
The response body contains the specified API entity.
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
ApiManagementGetApiContract
Sample request
GET https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/57d1f7558aa04f15146d9d8a?api-version=2021-08-01
import com.azure.core.util.Context;
/** Samples for Api Get. */
public final class Main {
/*
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiContract.json
*/
/**
* Sample code: ApiManagementGetApiContract.
*
* @param manager Entry point to ApiManagementManager.
*/
public static void apiManagementGetApiContract(
com.azure.resourcemanager.apimanagement.ApiManagementManager manager) {
manager.apis().getWithResponse("rg1", "apimService1", "57d1f7558aa04f15146d9d8a", Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apimanagement
# USAGE
python api_management_get_api_contract.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.api.get(
resource_group_name="rg1",
service_name="apimService1",
api_id="57d1f7558aa04f15146d9d8a",
)
print(response)
# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiContract.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armapimanagement_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiContract.json
func ExampleAPIClient_Get_apiManagementGetApiContract() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armapimanagement.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewAPIClient().Get(ctx, "rg1", "apimService1", "57d1f7558aa04f15146d9d8a", nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.APIContract = armapimanagement.APIContract{
// Name: to.Ptr("57d1f7558aa04f15146d9d8a"),
// Type: to.Ptr("Microsoft.ApiManagement/service/apis"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/57d1f7558aa04f15146d9d8a"),
// Properties: &armapimanagement.APIContractProperties{
// APIType: to.Ptr(armapimanagement.APITypeSoap),
// APIRevision: to.Ptr("1"),
// IsCurrent: to.Ptr(true),
// IsOnline: to.Ptr(true),
// SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{
// Header: to.Ptr("Ocp-Apim-Subscription-Key"),
// Query: to.Ptr("subscription-key"),
// },
// Path: to.Ptr("schulte"),
// DisplayName: to.Ptr("Service"),
// Protocols: []*armapimanagement.Protocol{
// to.Ptr(armapimanagement.ProtocolHTTPS)},
// ServiceURL: to.Ptr("https://api.plexonline.com/DataSource/Service.asmx"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ApiManagementClient } = require("@azure/arm-apimanagement");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Gets the details of the API specified by its identifier.
*
* @summary Gets the details of the API specified by its identifier.
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiContract.json
*/
async function apiManagementGetApiContract() {
const subscriptionId = process.env["APIMANAGEMENT_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["APIMANAGEMENT_RESOURCE_GROUP"] || "rg1";
const serviceName = "apimService1";
const apiId = "57d1f7558aa04f15146d9d8a";
const credential = new DefaultAzureCredential();
const client = new ApiManagementClient(credential, subscriptionId);
const result = await client.api.get(resourceGroupName, serviceName, apiId);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.ApiManagement;
using Azure.ResourceManager.ApiManagement.Models;
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiContract.json
// this example is just showing the usage of "Api_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ApiManagementServiceResource created on azure
// for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
string serviceName = "apimService1";
ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName);
ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId);
// get the collection of this ApiResource
ApiCollection collection = apiManagementService.GetApis();
// invoke the operation
string apiId = "57d1f7558aa04f15146d9d8a";
NullableResponse<ApiResource> response = await collection.GetIfExistsAsync(apiId);
ApiResource result = response.HasValue ? response.Value : null;
if (result == null)
{
Console.WriteLine($"Succeeded with null as result");
}
else
{
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
ApiData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/57d1f7558aa04f15146d9d8a",
"type": "Microsoft.ApiManagement/service/apis",
"name": "57d1f7558aa04f15146d9d8a",
"properties": {
"displayName": "Service",
"apiRevision": "1",
"serviceUrl": "https://api.plexonline.com/DataSource/Service.asmx",
"path": "schulte",
"protocols": [
"https"
],
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"type": "soap",
"isCurrent": true,
"isOnline": true
}
}
ApiManagementGetApiRevisionContract
Sample request
GET https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api;rev=3?api-version=2021-08-01
import com.azure.core.util.Context;
/** Samples for Api Get. */
public final class Main {
/*
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiRevision.json
*/
/**
* Sample code: ApiManagementGetApiRevisionContract.
*
* @param manager Entry point to ApiManagementManager.
*/
public static void apiManagementGetApiRevisionContract(
com.azure.resourcemanager.apimanagement.ApiManagementManager manager) {
manager.apis().getWithResponse("rg1", "apimService1", "echo-api;rev=3", Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apimanagement
# USAGE
python api_management_get_api_revision_contract.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.api.get(
resource_group_name="rg1",
service_name="apimService1",
api_id="echo-api;rev=3",
)
print(response)
# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiRevision.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armapimanagement_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiRevision.json
func ExampleAPIClient_Get_apiManagementGetApiRevisionContract() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armapimanagement.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewAPIClient().Get(ctx, "rg1", "apimService1", "echo-api;rev=3", nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.APIContract = armapimanagement.APIContract{
// Name: to.Ptr("echo-api;rev=3"),
// Type: to.Ptr("Microsoft.ApiManagement/service/apis"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api;rev=3"),
// Properties: &armapimanagement.APIContractProperties{
// APIRevision: to.Ptr("3"),
// APIRevisionDescription: to.Ptr("fixed bug in contract"),
// SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{
// Header: to.Ptr("Ocp-Apim-Subscription-Key"),
// Query: to.Ptr("subscription-key"),
// },
// Path: to.Ptr("schulte"),
// DisplayName: to.Ptr("Service"),
// Protocols: []*armapimanagement.Protocol{
// to.Ptr(armapimanagement.ProtocolHTTPS)},
// ServiceURL: to.Ptr("https://api.plexonline.com/DataSource/Service.asmx"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ApiManagementClient } = require("@azure/arm-apimanagement");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Gets the details of the API specified by its identifier.
*
* @summary Gets the details of the API specified by its identifier.
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiRevision.json
*/
async function apiManagementGetApiRevisionContract() {
const subscriptionId = process.env["APIMANAGEMENT_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["APIMANAGEMENT_RESOURCE_GROUP"] || "rg1";
const serviceName = "apimService1";
const apiId = "echo-api;rev=3";
const credential = new DefaultAzureCredential();
const client = new ApiManagementClient(credential, subscriptionId);
const result = await client.api.get(resourceGroupName, serviceName, apiId);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.ApiManagement;
using Azure.ResourceManager.ApiManagement.Models;
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2021-08-01/examples/ApiManagementGetApiRevision.json
// this example is just showing the usage of "Api_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ApiManagementServiceResource created on azure
// for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
string serviceName = "apimService1";
ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName);
ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId);
// get the collection of this ApiResource
ApiCollection collection = apiManagementService.GetApis();
// invoke the operation
string apiId = "echo-api;rev=3";
NullableResponse<ApiResource> response = await collection.GetIfExistsAsync(apiId);
ApiResource result = response.HasValue ? response.Value : null;
if (result == null)
{
Console.WriteLine($"Succeeded with null as result");
}
else
{
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
ApiData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api;rev=3",
"type": "Microsoft.ApiManagement/service/apis",
"name": "echo-api;rev=3",
"properties": {
"displayName": "Service",
"apiRevision": "3",
"serviceUrl": "https://api.plexonline.com/DataSource/Service.asmx",
"path": "schulte",
"protocols": [
"https"
],
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"apiRevisionDescription": "fixed bug in contract"
}
}
Definitions
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"
|
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
|
|
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:
|
An value that determines where the API Version identifier will be located in a HTTP request.
|
AuthenticationSettingsContract
API 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.
|