API Management サービス インスタンスの新しい API を作成するか、既存の指定された API を更新します。
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}?api-version=2022-08-01
URI パラメーター
名前 |
/ |
必須 |
型 |
説明 |
apiId
|
path |
True
|
string
|
API リビジョン識別子。 現在のAPI Management サービス インスタンスで一意である必要があります。 現在以外のリビジョンには があります。rev=n はサフィックスで、n はリビジョン番号です。
正規表現パターン: ^[^*#&+:<>?]+$
|
resourceGroupName
|
path |
True
|
string
|
リソース グループの名前。 名前の大文字と小文字は区別されます。
|
serviceName
|
path |
True
|
string
|
API Management サービスの名前。
正規表現パターン: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$
|
subscriptionId
|
path |
True
|
string
|
ターゲット サブスクリプションの ID。
|
api-version
|
query |
True
|
string
|
この操作に使用する API バージョン。
|
名前 |
必須 |
型 |
説明 |
If-Match
|
|
string
|
エンティティの ETag。 エンティティを作成する場合は必須ではありませんが、エンティティを更新する場合は必須です。
|
要求本文
名前 |
必須 |
型 |
説明 |
properties.path
|
True
|
string
|
API Management サービス インスタンス内のこの API とそのすべてのリソース パスを一意に識別する相対 URL。 この API のパブリック URL を作成するために、サービス インスタンスの作成時に指定された API エンドポイントのベース URL に追加されます。
|
apiRevision
|
|
string
|
API のリビジョンについて説明します。 値が指定されていない場合は、既定のリビジョン 1 が作成されます
|
apiRevisionDescription
|
|
string
|
API リビジョンの説明。
|
apiVersion
|
|
string
|
API がバージョン管理されている場合に API のバージョン識別子を示します
|
apiVersionDescription
|
|
string
|
API バージョンの説明。
|
apiVersionSetId
|
|
string
|
関連する ApiVersionSet のリソース識別子。
|
authenticationSettings
|
|
AuthenticationSettingsContract
|
この API に含まれる認証設定のコレクション。
|
contact
|
|
ApiContactInformation
|
API の連絡先情報。
|
description
|
|
string
|
API の説明。 HTML 書式設定タグを含めることができます。
|
isCurrent
|
|
boolean
|
API リビジョンが現在の API リビジョンであるかどうかを示します。
|
license
|
|
ApiLicenseInformation
|
API のライセンス情報。
|
properties.apiType
|
|
SoapApiType
|
作成する API の種類。
-
http REST API を作成する
-
soap SOAP パススルー API を作成する
-
websocket websocket API を作成します
-
graphql は API GraphQL作成します。
|
properties.apiVersionSet
|
|
ApiVersionSetContractDetails
|
バージョン セットの詳細
|
properties.displayName
|
|
string
|
API 名。 長さは 1 ~ 300 文字にする必要があります。
|
properties.format
|
|
ContentFormat
|
API がインポートされるコンテンツの形式。
|
properties.protocols
|
|
Protocol[]
|
この API の操作を呼び出すことができるプロトコルを記述します。
|
properties.serviceUrl
|
|
string
|
この API を実装するバックエンド サービスの絶対 URL。 2,000 文字を超えることはできません。
|
properties.sourceApiId
|
|
string
|
ソース API の API 識別子。
|
properties.translateRequiredQueryParameters
|
|
TranslateRequiredQueryParametersConduct
|
必要なクエリ パラメーターをテンプレートに変換する戦略。 既定では、値 'template' があります。 使用可能な値: 'template'、'query'
|
properties.value
|
|
string
|
API のインポート時のコンテンツ値。
|
properties.wsdlSelector
|
|
WsdlSelector
|
WSDL のインポートをドキュメントのサブセットに制限する条件。
|
subscriptionKeyParameterNames
|
|
SubscriptionKeyParameterNamesContract
|
API を使用できるようにするプロトコル。
|
subscriptionRequired
|
|
boolean
|
API にアクセスするために API サブスクリプションと Product サブスクリプションのどちらを必要とするかを指定します。
|
termsOfServiceUrl
|
|
string
|
API の利用規約への URL。 URL の形式にする必要があります。
|
type
|
|
ApiType
|
API の種類。
|
応答
名前 |
型 |
説明 |
200 OK
|
ApiContract
|
API が正常に更新されました。
ヘッダー
ETag: string
|
201 Created
|
ApiContract
|
API は正常に作成されました。
ヘッダー
ETag: string
|
202 Accepted
|
|
API の作成または更新の要求が受け入れられました。 Location ヘッダーには、実行時間の長い操作の状態を確認できる URL が含まれています。
|
Other Status Codes
|
ErrorResponse
|
操作に失敗した理由を説明するエラー応答。
|
セキュリティ
azure_auth
Azure Active Directory OAuth2 フロー。
型:
oauth2
フロー:
implicit
Authorization URL (承認 URL):
https://login.microsoftonline.com/common/oauth2/authorize
スコープ
名前 |
説明 |
user_impersonation
|
ユーザー アカウントの借用
|
例
ApiManagementCreateApi
要求のサンプル
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/tempgroup?api-version=2022-08-01
{
"properties": {
"description": "apidescription5200",
"authenticationSettings": {
"oAuth2": {
"authorizationServerId": "authorizationServerId2283",
"scope": "oauth2scope2580"
}
},
"subscriptionKeyParameterNames": {
"header": "header4520",
"query": "query3037"
},
"displayName": "apiname1463",
"serviceUrl": "http://newechoapi.cloudapp.net/api",
"path": "newapiPath",
"protocols": [
"https",
"http"
]
}
}
import com.azure.resourcemanager.apimanagement.models.AuthenticationSettingsContract;
import com.azure.resourcemanager.apimanagement.models.OAuth2AuthenticationSettingsContract;
import com.azure.resourcemanager.apimanagement.models.Protocol;
import com.azure.resourcemanager.apimanagement.models.SubscriptionKeyParameterNamesContract;
import java.util.Arrays;
/** Samples for Api CreateOrUpdate. */
public final class Main {
/*
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApi.json
*/
/**
* Sample code: ApiManagementCreateApi.
*
* @param manager Entry point to ApiManagementManager.
*/
public static void apiManagementCreateApi(com.azure.resourcemanager.apimanagement.ApiManagementManager manager) {
manager
.apis()
.define("tempgroup")
.withExistingService("rg1", "apimService1")
.withDisplayName("apiname1463")
.withServiceUrl("http://newechoapi.cloudapp.net/api")
.withPath("newapiPath")
.withProtocols(Arrays.asList(Protocol.HTTPS, Protocol.HTTP))
.withDescription("apidescription5200")
.withAuthenticationSettings(
new AuthenticationSettingsContract()
.withOAuth2(
new OAuth2AuthenticationSettingsContract()
.withAuthorizationServerId("fakeTokenPlaceholder")
.withScope("oauth2scope2580")))
.withSubscriptionKeyParameterNames(
new SubscriptionKeyParameterNamesContract().withHeaderProperty("header4520").withQuery("query3037"))
.create();
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from typing import Any, IO, Union
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_create_api.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.begin_create_or_update(
resource_group_name="rg1",
service_name="apimService1",
api_id="tempgroup",
parameters={
"properties": {
"authenticationSettings": {
"oAuth2": {"authorizationServerId": "authorizationServerId2283", "scope": "oauth2scope2580"}
},
"description": "apidescription5200",
"displayName": "apiname1463",
"path": "newapiPath",
"protocols": ["https", "http"],
"serviceUrl": "http://newechoapi.cloudapp.net/api",
"subscriptionKeyParameterNames": {"header": "header4520", "query": "query3037"},
}
},
).result()
print(response)
# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApi.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/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApi.json
func ExampleAPIClient_BeginCreateOrUpdate_apiManagementCreateApi() {
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)
}
poller, err := clientFactory.NewAPIClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "tempgroup", armapimanagement.APICreateOrUpdateParameter{
Properties: &armapimanagement.APICreateOrUpdateProperties{
Description: to.Ptr("apidescription5200"),
AuthenticationSettings: &armapimanagement.AuthenticationSettingsContract{
OAuth2: &armapimanagement.OAuth2AuthenticationSettingsContract{
AuthorizationServerID: to.Ptr("authorizationServerId2283"),
Scope: to.Ptr("oauth2scope2580"),
},
},
SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{
Header: to.Ptr("header4520"),
Query: to.Ptr("query3037"),
},
Path: to.Ptr("newapiPath"),
DisplayName: to.Ptr("apiname1463"),
Protocols: []*armapimanagement.Protocol{
to.Ptr(armapimanagement.ProtocolHTTPS),
to.Ptr(armapimanagement.ProtocolHTTP)},
ServiceURL: to.Ptr("http://newechoapi.cloudapp.net/api"),
},
}, &armapimanagement.APIClientBeginCreateOrUpdateOptions{IfMatch: nil})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %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("apiid9419"),
// Type: to.Ptr("Microsoft.ApiManagement/service/apis"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/apiid9419"),
// Properties: &armapimanagement.APIContractProperties{
// Description: to.Ptr("apidescription5200"),
// APIRevision: to.Ptr("1"),
// AuthenticationSettings: &armapimanagement.AuthenticationSettingsContract{
// OAuth2: &armapimanagement.OAuth2AuthenticationSettingsContract{
// AuthorizationServerID: to.Ptr("authorizationServerId2283"),
// Scope: to.Ptr("oauth2scope2580"),
// },
// OAuth2AuthenticationSettings: []*armapimanagement.OAuth2AuthenticationSettingsContract{
// {
// AuthorizationServerID: to.Ptr("authorizationServerId2283"),
// Scope: to.Ptr("oauth2scope2580"),
// }},
// },
// IsCurrent: to.Ptr(true),
// IsOnline: to.Ptr(true),
// SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{
// Header: to.Ptr("header4520"),
// Query: to.Ptr("query3037"),
// },
// Path: to.Ptr("newapiPath"),
// DisplayName: to.Ptr("apiname1463"),
// Protocols: []*armapimanagement.Protocol{
// to.Ptr(armapimanagement.ProtocolHTTP),
// to.Ptr(armapimanagement.ProtocolHTTPS)},
// ServiceURL: to.Ptr("http://newechoapi.cloudapp.net/api"),
// },
// }
}
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 Creates new or updates existing specified API of the API Management service instance.
*
* @summary Creates new or updates existing specified API of the API Management service instance.
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApi.json
*/
async function apiManagementCreateApi() {
const subscriptionId = process.env["APIMANAGEMENT_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["APIMANAGEMENT_RESOURCE_GROUP"] || "rg1";
const serviceName = "apimService1";
const apiId = "tempgroup";
const parameters = {
path: "newapiPath",
description: "apidescription5200",
authenticationSettings: {
oAuth2: {
authorizationServerId: "authorizationServerId2283",
scope: "oauth2scope2580",
},
},
displayName: "apiname1463",
protocols: ["https", "http"],
serviceUrl: "http://newechoapi.cloudapp.net/api",
subscriptionKeyParameterNames: { header: "header4520", query: "query3037" },
};
const credential = new DefaultAzureCredential();
const client = new ApiManagementClient(credential, subscriptionId);
const result = await client.api.beginCreateOrUpdateAndWait(
resourceGroupName,
serviceName,
apiId,
parameters
);
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.ApiManagement.Models;
using Azure.ResourceManager.ApiManagement;
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApi.json
// this example is just showing the usage of "Api_CreateOrUpdate" 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://video2.skills-academy.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 = "tempgroup";
ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent()
{
Description = "apidescription5200",
AuthenticationSettings = new AuthenticationSettingsContract()
{
OAuth2 = new OAuth2AuthenticationSettingsContract()
{
AuthorizationServerId = "authorizationServerId2283",
Scope = "oauth2scope2580",
},
},
SubscriptionKeyParameterNames = new SubscriptionKeyParameterNamesContract()
{
Header = "header4520",
Query = "query3037",
},
DisplayName = "apiname1463",
ServiceLink = "http://newechoapi.cloudapp.net/api",
Path = "newapiPath",
Protocols =
{
ApiOperationInvokableProtocol.Https,ApiOperationInvokableProtocol.Http
},
};
ArmOperation<ApiResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content);
ApiResource result = lro.Value;
// 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
応答のサンプル
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/apiid9419",
"type": "Microsoft.ApiManagement/service/apis",
"name": "apiid9419",
"properties": {
"displayName": "apiname1463",
"apiRevision": "1",
"description": "apidescription5200",
"serviceUrl": "http://newechoapi.cloudapp.net/api",
"path": "newapiPath",
"protocols": [
"http",
"https"
],
"authenticationSettings": {
"oAuth2": {
"authorizationServerId": "authorizationServerId2283",
"scope": "oauth2scope2580"
},
"oAuth2AuthenticationSettings": [
{
"authorizationServerId": "authorizationServerId2283",
"scope": "oauth2scope2580"
}
]
},
"subscriptionKeyParameterNames": {
"header": "header4520",
"query": "query3037"
},
"isCurrent": true,
"isOnline": true
}
}
location: https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/tempgroup?api-version=2022-08-01&asyncId=5c730e343244df1b9cb56e85&asyncCode=201
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/apiid9419",
"type": "Microsoft.ApiManagement/service/apis",
"name": "apiid9419",
"properties": {
"displayName": "apiname1463",
"apiRevision": "1",
"description": "apidescription5200",
"serviceUrl": "http://newechoapi.cloudapp.net/api",
"path": "newapiPath",
"protocols": [
"http",
"https"
],
"authenticationSettings": {
"oAuth2": {
"authorizationServerId": "authorizationServerId2283",
"scope": "oauth2scope2580"
},
"oAuth2AuthenticationSettings": [
{
"authorizationServerId": "authorizationServerId2283",
"scope": "oauth2scope2580"
}
]
},
"subscriptionKeyParameterNames": {
"header": "header4520",
"query": "query3037"
},
"isCurrent": true,
"isOnline": true
}
}
ApiManagementCreateApiClone
要求のサンプル
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api2?api-version=2022-08-01
{
"properties": {
"displayName": "Echo API2",
"description": "Copy of Existing Echo Api including Operations.",
"subscriptionRequired": true,
"serviceUrl": "http://echoapi.cloudapp.net/api",
"path": "echo2",
"protocols": [
"http",
"https"
],
"isCurrent": true,
"sourceApiId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/58a4aeac497000007d040001"
}
}
import com.azure.resourcemanager.apimanagement.models.Protocol;
import java.util.Arrays;
/** Samples for Api CreateOrUpdate. */
public final class Main {
/*
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiClone.json
*/
/**
* Sample code: ApiManagementCreateApiClone.
*
* @param manager Entry point to ApiManagementManager.
*/
public static void apiManagementCreateApiClone(
com.azure.resourcemanager.apimanagement.ApiManagementManager manager) {
manager
.apis()
.define("echo-api2")
.withExistingService("rg1", "apimService1")
.withSourceApiId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/58a4aeac497000007d040001")
.withDisplayName("Echo API2")
.withServiceUrl("http://echoapi.cloudapp.net/api")
.withPath("echo2")
.withProtocols(Arrays.asList(Protocol.HTTP, Protocol.HTTPS))
.withDescription("Copy of Existing Echo Api including Operations.")
.withIsCurrent(true)
.withSubscriptionRequired(true)
.create();
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from typing import Any, IO, Union
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_create_api_clone.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.begin_create_or_update(
resource_group_name="rg1",
service_name="apimService1",
api_id="echo-api2",
parameters={
"properties": {
"description": "Copy of Existing Echo Api including Operations.",
"displayName": "Echo API2",
"isCurrent": True,
"path": "echo2",
"protocols": ["http", "https"],
"serviceUrl": "http://echoapi.cloudapp.net/api",
"sourceApiId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/58a4aeac497000007d040001",
"subscriptionRequired": True,
}
},
).result()
print(response)
# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiClone.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/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiClone.json
func ExampleAPIClient_BeginCreateOrUpdate_apiManagementCreateApiClone() {
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)
}
poller, err := clientFactory.NewAPIClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "echo-api2", armapimanagement.APICreateOrUpdateParameter{
Properties: &armapimanagement.APICreateOrUpdateProperties{
Description: to.Ptr("Copy of Existing Echo Api including Operations."),
IsCurrent: to.Ptr(true),
SubscriptionRequired: to.Ptr(true),
Path: to.Ptr("echo2"),
DisplayName: to.Ptr("Echo API2"),
Protocols: []*armapimanagement.Protocol{
to.Ptr(armapimanagement.ProtocolHTTP),
to.Ptr(armapimanagement.ProtocolHTTPS)},
ServiceURL: to.Ptr("http://echoapi.cloudapp.net/api"),
SourceAPIID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/58a4aeac497000007d040001"),
},
}, &armapimanagement.APIClientBeginCreateOrUpdateOptions{IfMatch: nil})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %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("echoapi2"),
// Type: to.Ptr("Microsoft.ApiManagement/service/apis"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echoapi2"),
// Properties: &armapimanagement.APIContractProperties{
// Description: to.Ptr("Copy of Existing Echo Api including Operations."),
// APIRevision: to.Ptr("1"),
// IsCurrent: to.Ptr(true),
// SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{
// Header: to.Ptr("Ocp-Apim-Subscription-Key"),
// Query: to.Ptr("subscription-key"),
// },
// SubscriptionRequired: to.Ptr(true),
// Path: to.Ptr("echo2"),
// DisplayName: to.Ptr("Echo API2"),
// Protocols: []*armapimanagement.Protocol{
// to.Ptr(armapimanagement.ProtocolHTTP),
// to.Ptr(armapimanagement.ProtocolHTTPS)},
// ServiceURL: to.Ptr("http://echoapi.cloudapp.net/api"),
// },
// }
}
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 Creates new or updates existing specified API of the API Management service instance.
*
* @summary Creates new or updates existing specified API of the API Management service instance.
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiClone.json
*/
async function apiManagementCreateApiClone() {
const subscriptionId = process.env["APIMANAGEMENT_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["APIMANAGEMENT_RESOURCE_GROUP"] || "rg1";
const serviceName = "apimService1";
const apiId = "echo-api2";
const parameters = {
path: "echo2",
description: "Copy of Existing Echo Api including Operations.",
displayName: "Echo API2",
isCurrent: true,
protocols: ["http", "https"],
serviceUrl: "http://echoapi.cloudapp.net/api",
sourceApiId:
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/58a4aeac497000007d040001",
subscriptionRequired: true,
};
const credential = new DefaultAzureCredential();
const client = new ApiManagementClient(credential, subscriptionId);
const result = await client.api.beginCreateOrUpdateAndWait(
resourceGroupName,
serviceName,
apiId,
parameters
);
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.ApiManagement.Models;
using Azure.ResourceManager.ApiManagement;
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiClone.json
// this example is just showing the usage of "Api_CreateOrUpdate" 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://video2.skills-academy.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-api2";
ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent()
{
Description = "Copy of Existing Echo Api including Operations.",
IsCurrent = true,
IsSubscriptionRequired = true,
SourceApiId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/58a4aeac497000007d040001"),
DisplayName = "Echo API2",
ServiceLink = "http://echoapi.cloudapp.net/api",
Path = "echo2",
Protocols =
{
ApiOperationInvokableProtocol.Http,ApiOperationInvokableProtocol.Https
},
};
ArmOperation<ApiResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content);
ApiResource result = lro.Value;
// 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
応答のサンプル
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echoapi2",
"type": "Microsoft.ApiManagement/service/apis",
"name": "echoapi2",
"properties": {
"displayName": "Echo API2",
"apiRevision": "1",
"description": "Copy of Existing Echo Api including Operations.",
"subscriptionRequired": true,
"serviceUrl": "http://echoapi.cloudapp.net/api",
"path": "echo2",
"protocols": [
"http",
"https"
],
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"isCurrent": true
}
}
location: https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/tempgroup?api-version=2022-08-01&asyncId=5c730e343244df1b9cb56e85&asyncCode=201
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echoapi2",
"type": "Microsoft.ApiManagement/service/apis",
"name": "echoapi2",
"properties": {
"displayName": "Echo API2",
"apiRevision": "1",
"description": "Copy of Existing Echo Api including Operations.",
"subscriptionRequired": true,
"serviceUrl": "http://echoapi.cloudapp.net/api",
"path": "echo2",
"protocols": [
"http",
"https"
],
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"isCurrent": true
}
}
ApiManagementCreateApiNewVersionUsingExistingApi
要求のサンプル
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echoapiv3?api-version=2022-08-01
{
"properties": {
"displayName": "Echo API2",
"description": "Create Echo API into a new Version using Existing Version Set and Copy all Operations.",
"subscriptionRequired": true,
"serviceUrl": "http://echoapi.cloudapp.net/api",
"path": "echo2",
"protocols": [
"http",
"https"
],
"isCurrent": true,
"apiVersion": "v4",
"sourceApiId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echoPath",
"apiVersionSetId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apiVersionSets/aa9c59e6-c0cd-4258-9356-9ca7d2f0b458"
}
}
import com.azure.resourcemanager.apimanagement.models.Protocol;
import java.util.Arrays;
/** Samples for Api CreateOrUpdate. */
public final class Main {
/*
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiNewVersionUsingExistingApi.json
*/
/**
* Sample code: ApiManagementCreateApiNewVersionUsingExistingApi.
*
* @param manager Entry point to ApiManagementManager.
*/
public static void apiManagementCreateApiNewVersionUsingExistingApi(
com.azure.resourcemanager.apimanagement.ApiManagementManager manager) {
manager
.apis()
.define("echoapiv3")
.withExistingService("rg1", "apimService1")
.withSourceApiId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echoPath")
.withDisplayName("Echo API2")
.withServiceUrl("http://echoapi.cloudapp.net/api")
.withPath("echo2")
.withProtocols(Arrays.asList(Protocol.HTTP, Protocol.HTTPS))
.withDescription("Create Echo API into a new Version using Existing Version Set and Copy all Operations.")
.withApiVersion("v4")
.withIsCurrent(true)
.withApiVersionSetId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apiVersionSets/aa9c59e6-c0cd-4258-9356-9ca7d2f0b458")
.withSubscriptionRequired(true)
.create();
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from typing import Any, IO, Union
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_create_api_new_version_using_existing_api.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.begin_create_or_update(
resource_group_name="rg1",
service_name="apimService1",
api_id="echoapiv3",
parameters={
"properties": {
"apiVersion": "v4",
"apiVersionSetId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apiVersionSets/aa9c59e6-c0cd-4258-9356-9ca7d2f0b458",
"description": "Create Echo API into a new Version using Existing Version Set and Copy all Operations.",
"displayName": "Echo API2",
"isCurrent": True,
"path": "echo2",
"protocols": ["http", "https"],
"serviceUrl": "http://echoapi.cloudapp.net/api",
"sourceApiId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echoPath",
"subscriptionRequired": True,
}
},
).result()
print(response)
# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiNewVersionUsingExistingApi.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/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiNewVersionUsingExistingApi.json
func ExampleAPIClient_BeginCreateOrUpdate_apiManagementCreateApiNewVersionUsingExistingApi() {
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)
}
poller, err := clientFactory.NewAPIClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "echoapiv3", armapimanagement.APICreateOrUpdateParameter{
Properties: &armapimanagement.APICreateOrUpdateProperties{
Description: to.Ptr("Create Echo API into a new Version using Existing Version Set and Copy all Operations."),
APIVersion: to.Ptr("v4"),
APIVersionSetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apiVersionSets/aa9c59e6-c0cd-4258-9356-9ca7d2f0b458"),
IsCurrent: to.Ptr(true),
SubscriptionRequired: to.Ptr(true),
Path: to.Ptr("echo2"),
DisplayName: to.Ptr("Echo API2"),
Protocols: []*armapimanagement.Protocol{
to.Ptr(armapimanagement.ProtocolHTTP),
to.Ptr(armapimanagement.ProtocolHTTPS)},
ServiceURL: to.Ptr("http://echoapi.cloudapp.net/api"),
SourceAPIID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echoPath"),
},
}, &armapimanagement.APIClientBeginCreateOrUpdateOptions{IfMatch: nil})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %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("echoapiv3"),
// Type: to.Ptr("Microsoft.ApiManagement/service/apis"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echoapiv3"),
// Properties: &armapimanagement.APIContractProperties{
// Description: to.Ptr("Create Echo API into a new Version using Existing Version Set and Copy all Operations."),
// APIRevision: to.Ptr("1"),
// APIVersion: to.Ptr("v4"),
// APIVersionSetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apiVersionSets/aa9c59e6-c0cd-4258-9356-9ca7d2f0b458"),
// IsCurrent: to.Ptr(true),
// SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{
// Header: to.Ptr("Ocp-Apim-Subscription-Key"),
// Query: to.Ptr("subscription-key"),
// },
// SubscriptionRequired: to.Ptr(true),
// Path: to.Ptr("echo2"),
// APIVersionSet: &armapimanagement.APIVersionSetContractDetails{
// Name: to.Ptr("Echo API2"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apiVersionSets/aa9c59e6-c0cd-4258-9356-9ca7d2f0b458"),
// VersioningScheme: to.Ptr(armapimanagement.APIVersionSetContractDetailsVersioningSchemeSegment),
// },
// DisplayName: to.Ptr("Echo API2"),
// Protocols: []*armapimanagement.Protocol{
// to.Ptr(armapimanagement.ProtocolHTTP),
// to.Ptr(armapimanagement.ProtocolHTTPS)},
// ServiceURL: to.Ptr("http://echoapi.cloudapp.net/api"),
// },
// }
}
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 Creates new or updates existing specified API of the API Management service instance.
*
* @summary Creates new or updates existing specified API of the API Management service instance.
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiNewVersionUsingExistingApi.json
*/
async function apiManagementCreateApiNewVersionUsingExistingApi() {
const subscriptionId = process.env["APIMANAGEMENT_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["APIMANAGEMENT_RESOURCE_GROUP"] || "rg1";
const serviceName = "apimService1";
const apiId = "echoapiv3";
const parameters = {
path: "echo2",
description:
"Create Echo API into a new Version using Existing Version Set and Copy all Operations.",
apiVersion: "v4",
apiVersionSetId:
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apiVersionSets/aa9c59e6-c0cd-4258-9356-9ca7d2f0b458",
displayName: "Echo API2",
isCurrent: true,
protocols: ["http", "https"],
serviceUrl: "http://echoapi.cloudapp.net/api",
sourceApiId:
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echoPath",
subscriptionRequired: true,
};
const credential = new DefaultAzureCredential();
const client = new ApiManagementClient(credential, subscriptionId);
const result = await client.api.beginCreateOrUpdateAndWait(
resourceGroupName,
serviceName,
apiId,
parameters
);
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.ApiManagement.Models;
using Azure.ResourceManager.ApiManagement;
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiNewVersionUsingExistingApi.json
// this example is just showing the usage of "Api_CreateOrUpdate" 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://video2.skills-academy.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 = "echoapiv3";
ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent()
{
Description = "Create Echo API into a new Version using Existing Version Set and Copy all Operations.",
ApiVersion = "v4",
IsCurrent = true,
ApiVersionSetId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apiVersionSets/aa9c59e6-c0cd-4258-9356-9ca7d2f0b458"),
IsSubscriptionRequired = true,
SourceApiId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echoPath"),
DisplayName = "Echo API2",
ServiceLink = "http://echoapi.cloudapp.net/api",
Path = "echo2",
Protocols =
{
ApiOperationInvokableProtocol.Http,ApiOperationInvokableProtocol.Https
},
};
ArmOperation<ApiResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content);
ApiResource result = lro.Value;
// 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
応答のサンプル
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echoapiv3",
"type": "Microsoft.ApiManagement/service/apis",
"name": "echoapiv3",
"properties": {
"displayName": "Echo API2",
"apiRevision": "1",
"description": "Create Echo API into a new Version using Existing Version Set and Copy all Operations.",
"subscriptionRequired": true,
"serviceUrl": "http://echoapi.cloudapp.net/api",
"path": "echo2",
"protocols": [
"http",
"https"
],
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"isCurrent": true,
"apiVersion": "v4",
"apiVersionSetId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apiVersionSets/aa9c59e6-c0cd-4258-9356-9ca7d2f0b458",
"apiVersionSet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apiVersionSets/aa9c59e6-c0cd-4258-9356-9ca7d2f0b458",
"name": "Echo API2",
"versioningScheme": "Segment"
}
}
}
location: https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/tempgroup?api-version=2022-08-01&asyncId=5c730e343244df1b9cb56e85&asyncCode=201
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echoapiv3",
"type": "Microsoft.ApiManagement/service/apis",
"name": "echoapiv3",
"properties": {
"displayName": "Echo API2",
"apiRevision": "1",
"description": "Create Echo API into a new Version using Existing Version Set and Copy all Operations.",
"subscriptionRequired": true,
"serviceUrl": "http://echoapi.cloudapp.net/api",
"path": "echo2",
"protocols": [
"http",
"https"
],
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"isCurrent": true,
"apiVersion": "v4",
"apiVersionSetId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apiVersionSets/aa9c59e6-c0cd-4258-9356-9ca7d2f0b458",
"apiVersionSet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apiVersionSets/aa9c59e6-c0cd-4258-9356-9ca7d2f0b458",
"name": "Echo API2",
"versioningScheme": "Segment"
}
}
}
ApiManagementCreateApiRevisionFromExistingApi
要求のサンプル
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api;rev=3?api-version=2022-08-01
{
"properties": {
"path": "echo",
"serviceUrl": "http://echoapi.cloudapp.net/apiv3",
"sourceApiId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api",
"apiRevisionDescription": "Creating a Revision of an existing API"
}
}
/** Samples for Api CreateOrUpdate. */
public final class Main {
/*
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiRevisionFromExistingApi.json
*/
/**
* Sample code: ApiManagementCreateApiRevisionFromExistingApi.
*
* @param manager Entry point to ApiManagementManager.
*/
public static void apiManagementCreateApiRevisionFromExistingApi(
com.azure.resourcemanager.apimanagement.ApiManagementManager manager) {
manager
.apis()
.define("echo-api;rev=3")
.withExistingService("rg1", "apimService1")
.withSourceApiId(
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api")
.withServiceUrl("http://echoapi.cloudapp.net/apiv3")
.withPath("echo")
.withApiRevisionDescription("Creating a Revision of an existing API")
.create();
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from typing import Any, IO, Union
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_create_api_revision_from_existing_api.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.begin_create_or_update(
resource_group_name="rg1",
service_name="apimService1",
api_id="echo-api;rev=3",
parameters={
"properties": {
"apiRevisionDescription": "Creating a Revision of an existing API",
"path": "echo",
"serviceUrl": "http://echoapi.cloudapp.net/apiv3",
"sourceApiId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api",
}
},
).result()
print(response)
# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiRevisionFromExistingApi.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/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiRevisionFromExistingApi.json
func ExampleAPIClient_BeginCreateOrUpdate_apiManagementCreateApiRevisionFromExistingApi() {
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)
}
poller, err := clientFactory.NewAPIClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "echo-api;rev=3", armapimanagement.APICreateOrUpdateParameter{
Properties: &armapimanagement.APICreateOrUpdateProperties{
APIRevisionDescription: to.Ptr("Creating a Revision of an existing API"),
Path: to.Ptr("echo"),
ServiceURL: to.Ptr("http://echoapi.cloudapp.net/apiv3"),
SourceAPIID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api"),
},
}, &armapimanagement.APIClientBeginCreateOrUpdateOptions{IfMatch: nil})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %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("Creating a Revision of an existing API"),
// SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{
// Header: to.Ptr("Ocp-Apim-Subscription-Key"),
// Query: to.Ptr("subscription-key"),
// },
// SubscriptionRequired: to.Ptr(true),
// Path: to.Ptr("echo"),
// DisplayName: to.Ptr("Echo API"),
// Protocols: []*armapimanagement.Protocol{
// to.Ptr(armapimanagement.ProtocolHTTPS)},
// ServiceURL: to.Ptr("http://echoapi.cloudapp.net/apiv3"),
// },
// }
}
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 Creates new or updates existing specified API of the API Management service instance.
*
* @summary Creates new or updates existing specified API of the API Management service instance.
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiRevisionFromExistingApi.json
*/
async function apiManagementCreateApiRevisionFromExistingApi() {
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 parameters = {
path: "echo",
apiRevisionDescription: "Creating a Revision of an existing API",
serviceUrl: "http://echoapi.cloudapp.net/apiv3",
sourceApiId:
"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api",
};
const credential = new DefaultAzureCredential();
const client = new ApiManagementClient(credential, subscriptionId);
const result = await client.api.beginCreateOrUpdateAndWait(
resourceGroupName,
serviceName,
apiId,
parameters
);
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.ApiManagement.Models;
using Azure.ResourceManager.ApiManagement;
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiRevisionFromExistingApi.json
// this example is just showing the usage of "Api_CreateOrUpdate" 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://video2.skills-academy.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";
ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent()
{
ApiRevisionDescription = "Creating a Revision of an existing API",
SourceApiId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api"),
ServiceLink = "http://echoapi.cloudapp.net/apiv3",
Path = "echo",
};
ArmOperation<ApiResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content);
ApiResource result = lro.Value;
// 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
応答のサンプル
{
"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": "Echo API",
"apiRevision": "3",
"subscriptionRequired": true,
"serviceUrl": "http://echoapi.cloudapp.net/apiv3",
"path": "echo",
"protocols": [
"https"
],
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"apiRevisionDescription": "Creating a Revision of an existing API"
}
}
location: https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/tempgroup?api-version=2022-08-01&asyncId=5c730e343244df1b9cb56e85&asyncCode=201
{
"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": "Echo API",
"apiRevision": "3",
"subscriptionRequired": true,
"serviceUrl": "http://echoapi.cloudapp.net/apiv3",
"path": "echo",
"protocols": [
"https"
],
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"apiRevisionDescription": "Creating a Revision of an existing API"
}
}
ApiManagementCreateApiUsingImportOverrideServiceUrl
要求のサンプル
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/apidocs?api-version=2022-08-01
{
"properties": {
"format": "swagger-link",
"value": "http://apimpimportviaurl.azurewebsites.net/api/apidocs/",
"path": "petstoreapi123",
"serviceUrl": "http://petstore.swagger.wordnik.com/api"
}
}
import com.azure.resourcemanager.apimanagement.models.ContentFormat;
/** Samples for Api CreateOrUpdate. */
public final class Main {
/*
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiUsingImportOverrideServiceUrl.json
*/
/**
* Sample code: ApiManagementCreateApiUsingImportOverrideServiceUrl.
*
* @param manager Entry point to ApiManagementManager.
*/
public static void apiManagementCreateApiUsingImportOverrideServiceUrl(
com.azure.resourcemanager.apimanagement.ApiManagementManager manager) {
manager
.apis()
.define("apidocs")
.withExistingService("rg1", "apimService1")
.withValue("http://apimpimportviaurl.azurewebsites.net/api/apidocs/")
.withFormat(ContentFormat.fromString("swagger-link"))
.withServiceUrl("http://petstore.swagger.wordnik.com/api")
.withPath("petstoreapi123")
.create();
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from typing import Any, IO, Union
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_create_api_using_import_override_service_url.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.begin_create_or_update(
resource_group_name="rg1",
service_name="apimService1",
api_id="apidocs",
parameters={
"properties": {
"format": "swagger-link",
"path": "petstoreapi123",
"serviceUrl": "http://petstore.swagger.wordnik.com/api",
"value": "http://apimpimportviaurl.azurewebsites.net/api/apidocs/",
}
},
).result()
print(response)
# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiUsingImportOverrideServiceUrl.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/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiUsingImportOverrideServiceUrl.json
func ExampleAPIClient_BeginCreateOrUpdate_apiManagementCreateApiUsingImportOverrideServiceUrl() {
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)
}
poller, err := clientFactory.NewAPIClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "apidocs", armapimanagement.APICreateOrUpdateParameter{
Properties: &armapimanagement.APICreateOrUpdateProperties{
Path: to.Ptr("petstoreapi123"),
ServiceURL: to.Ptr("http://petstore.swagger.wordnik.com/api"),
Format: to.Ptr(armapimanagement.ContentFormat("swagger-link")),
Value: to.Ptr("http://apimpimportviaurl.azurewebsites.net/api/apidocs/"),
},
}, &armapimanagement.APIClientBeginCreateOrUpdateOptions{IfMatch: nil})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %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("apidocs"),
// Type: to.Ptr("Microsoft.ApiManagement/service/apis"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/apidocs"),
// Properties: &armapimanagement.APIContractProperties{
// Description: to.Ptr("This is a sample server Petstore server. You can find out more about Swagger \n at <a href=\"http://swagger.wordnik.com\">http://swagger.wordnik.com</a> or on irc.freenode.net, #swagger. For this sample,\n you can use the api key \"special-key\" to test the authorization filters"),
// APIRevision: to.Ptr("1"),
// IsCurrent: to.Ptr(true),
// SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{
// Header: to.Ptr("Ocp-Apim-Subscription-Key"),
// Query: to.Ptr("subscription-key"),
// },
// Path: to.Ptr("petstoreapi123"),
// DisplayName: to.Ptr("Swagger Sample App"),
// Protocols: []*armapimanagement.Protocol{
// to.Ptr(armapimanagement.ProtocolHTTPS)},
// ServiceURL: to.Ptr("http://petstore.swagger.wordnik.com/api"),
// },
// }
}
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 Creates new or updates existing specified API of the API Management service instance.
*
* @summary Creates new or updates existing specified API of the API Management service instance.
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiUsingImportOverrideServiceUrl.json
*/
async function apiManagementCreateApiUsingImportOverrideServiceUrl() {
const subscriptionId = process.env["APIMANAGEMENT_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["APIMANAGEMENT_RESOURCE_GROUP"] || "rg1";
const serviceName = "apimService1";
const apiId = "apidocs";
const parameters = {
format: "swagger-link",
path: "petstoreapi123",
serviceUrl: "http://petstore.swagger.wordnik.com/api",
value: "http://apimpimportviaurl.azurewebsites.net/api/apidocs/",
};
const credential = new DefaultAzureCredential();
const client = new ApiManagementClient(credential, subscriptionId);
const result = await client.api.beginCreateOrUpdateAndWait(
resourceGroupName,
serviceName,
apiId,
parameters
);
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.ApiManagement.Models;
using Azure.ResourceManager.ApiManagement;
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiUsingImportOverrideServiceUrl.json
// this example is just showing the usage of "Api_CreateOrUpdate" 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://video2.skills-academy.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 = "apidocs";
ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent()
{
ServiceLink = "http://petstore.swagger.wordnik.com/api",
Path = "petstoreapi123",
Value = "http://apimpimportviaurl.azurewebsites.net/api/apidocs/",
Format = new ContentFormat("swagger-link"),
};
ArmOperation<ApiResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content);
ApiResource result = lro.Value;
// 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
応答のサンプル
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/apidocs",
"type": "Microsoft.ApiManagement/service/apis",
"name": "apidocs",
"properties": {
"displayName": "Swagger Sample App",
"apiRevision": "1",
"description": "This is a sample server Petstore server. You can find out more about Swagger \n at <a href=\"http://swagger.wordnik.com\">http://swagger.wordnik.com</a> or on irc.freenode.net, #swagger. For this sample,\n you can use the api key \"special-key\" to test the authorization filters",
"serviceUrl": "http://petstore.swagger.wordnik.com/api",
"path": "petstoreapi123",
"protocols": [
"https"
],
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"isCurrent": true
}
}
location: https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/apidocs?api-version=2022-08-01&asyncId=5c730e343244df1b9cb56e85&asyncCode=201
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/apidocs",
"type": "Microsoft.ApiManagement/service/apis",
"name": "apidocs",
"properties": {
"displayName": "Swagger Sample App",
"apiRevision": "1",
"description": "This is a sample server Petstore server. You can find out more about Swagger \n at <a href=\"http://swagger.wordnik.com\">http://swagger.wordnik.com</a> or on irc.freenode.net, #swagger. For this sample,\n you can use the api key \"special-key\" to test the authorization filters",
"serviceUrl": "http://petstore.swagger.wordnik.com/api",
"path": "petstoreapi123",
"protocols": [
"https"
],
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"isCurrent": true
}
}
ApiManagementCreateApiUsingOai3Import
要求のサンプル
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/petstore?api-version=2022-08-01
{
"properties": {
"format": "openapi-link",
"value": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml",
"path": "petstore"
}
}
import com.azure.resourcemanager.apimanagement.models.ContentFormat;
/** Samples for Api CreateOrUpdate. */
public final class Main {
/*
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiUsingOai3Import.json
*/
/**
* Sample code: ApiManagementCreateApiUsingOai3Import.
*
* @param manager Entry point to ApiManagementManager.
*/
public static void apiManagementCreateApiUsingOai3Import(
com.azure.resourcemanager.apimanagement.ApiManagementManager manager) {
manager
.apis()
.define("petstore")
.withExistingService("rg1", "apimService1")
.withValue("https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml")
.withFormat(ContentFormat.OPENAPI_LINK)
.withPath("petstore")
.create();
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from typing import Any, IO, Union
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_create_api_using_oai3_import.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.begin_create_or_update(
resource_group_name="rg1",
service_name="apimService1",
api_id="petstore",
parameters={
"properties": {
"format": "openapi-link",
"path": "petstore",
"value": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml",
}
},
).result()
print(response)
# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiUsingOai3Import.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/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiUsingOai3Import.json
func ExampleAPIClient_BeginCreateOrUpdate_apiManagementCreateApiUsingOai3Import() {
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)
}
poller, err := clientFactory.NewAPIClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "petstore", armapimanagement.APICreateOrUpdateParameter{
Properties: &armapimanagement.APICreateOrUpdateProperties{
Path: to.Ptr("petstore"),
Format: to.Ptr(armapimanagement.ContentFormatOpenapiLink),
Value: to.Ptr("https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml"),
},
}, &armapimanagement.APIClientBeginCreateOrUpdateOptions{IfMatch: nil})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %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("petstoreapi"),
// Type: to.Ptr("Microsoft.ApiManagement/service/apis"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/petstoreapi"),
// Properties: &armapimanagement.APIContractProperties{
// APIRevision: to.Ptr("1"),
// IsCurrent: to.Ptr(true),
// SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{
// Header: to.Ptr("Ocp-Apim-Subscription-Key"),
// Query: to.Ptr("subscription-key"),
// },
// Path: to.Ptr("petstore"),
// DisplayName: to.Ptr("Swagger Petstore"),
// Protocols: []*armapimanagement.Protocol{
// to.Ptr(armapimanagement.ProtocolHTTPS)},
// ServiceURL: to.Ptr("http://petstore.swagger.io/v1"),
// },
// }
}
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 Creates new or updates existing specified API of the API Management service instance.
*
* @summary Creates new or updates existing specified API of the API Management service instance.
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiUsingOai3Import.json
*/
async function apiManagementCreateApiUsingOai3Import() {
const subscriptionId = process.env["APIMANAGEMENT_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["APIMANAGEMENT_RESOURCE_GROUP"] || "rg1";
const serviceName = "apimService1";
const apiId = "petstore";
const parameters = {
format: "openapi-link",
path: "petstore",
value:
"https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml",
};
const credential = new DefaultAzureCredential();
const client = new ApiManagementClient(credential, subscriptionId);
const result = await client.api.beginCreateOrUpdateAndWait(
resourceGroupName,
serviceName,
apiId,
parameters
);
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.ApiManagement.Models;
using Azure.ResourceManager.ApiManagement;
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiUsingOai3Import.json
// this example is just showing the usage of "Api_CreateOrUpdate" 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://video2.skills-academy.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 = "petstore";
ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent()
{
Path = "petstore",
Value = "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml",
Format = ContentFormat.OpenApiLink,
};
ArmOperation<ApiResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content);
ApiResource result = lro.Value;
// 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
応答のサンプル
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/petstoreapi",
"type": "Microsoft.ApiManagement/service/apis",
"name": "petstoreapi",
"properties": {
"displayName": "Swagger Petstore",
"apiRevision": "1",
"serviceUrl": "http://petstore.swagger.io/v1",
"path": "petstore",
"protocols": [
"https"
],
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"isCurrent": true
}
}
location: https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/tempgroup?api-version=2022-08-01&asyncId=5c730e343244df1b9cb56e85&asyncCode=201
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/petstoreapi",
"type": "Microsoft.ApiManagement/service/apis",
"name": "petstoreapi",
"properties": {
"displayName": "Swagger Petstore",
"apiRevision": "1",
"serviceUrl": "http://petstore.swagger.io/v1",
"path": "petstore",
"protocols": [
"https"
],
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"isCurrent": true
}
}
ApiManagementCreateApiUsingOai3ImportWithTranslateRequiredQueryParametersConduct
要求のサンプル
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/petstore?api-version=2022-08-01
{
"properties": {
"format": "openapi-link",
"value": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml",
"path": "petstore",
"translateRequiredQueryParameters": "template"
}
}
import com.azure.resourcemanager.apimanagement.models.ContentFormat;
import com.azure.resourcemanager.apimanagement.models.TranslateRequiredQueryParametersConduct;
/** Samples for Api CreateOrUpdate. */
public final class Main {
/*
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiUsingOai3ImportWithTranslateRequiredQueryParametersConduct.json
*/
/**
* Sample code: ApiManagementCreateApiUsingOai3ImportWithTranslateRequiredQueryParametersConduct.
*
* @param manager Entry point to ApiManagementManager.
*/
public static void apiManagementCreateApiUsingOai3ImportWithTranslateRequiredQueryParametersConduct(
com.azure.resourcemanager.apimanagement.ApiManagementManager manager) {
manager
.apis()
.define("petstore")
.withExistingService("rg1", "apimService1")
.withValue("https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml")
.withFormat(ContentFormat.OPENAPI_LINK)
.withTranslateRequiredQueryParametersConduct(TranslateRequiredQueryParametersConduct.TEMPLATE)
.withPath("petstore")
.create();
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from typing import Any, IO, Union
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_create_api_using_oai3_import_with_translate_required_query_parameters_conduct.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.begin_create_or_update(
resource_group_name="rg1",
service_name="apimService1",
api_id="petstore",
parameters={
"properties": {
"format": "openapi-link",
"path": "petstore",
"translateRequiredQueryParameters": "template",
"value": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml",
}
},
).result()
print(response)
# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiUsingOai3ImportWithTranslateRequiredQueryParametersConduct.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/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiUsingOai3ImportWithTranslateRequiredQueryParametersConduct.json
func ExampleAPIClient_BeginCreateOrUpdate_apiManagementCreateApiUsingOai3ImportWithTranslateRequiredQueryParametersConduct() {
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)
}
poller, err := clientFactory.NewAPIClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "petstore", armapimanagement.APICreateOrUpdateParameter{
Properties: &armapimanagement.APICreateOrUpdateProperties{
Path: to.Ptr("petstore"),
Format: to.Ptr(armapimanagement.ContentFormatOpenapiLink),
TranslateRequiredQueryParametersConduct: to.Ptr(armapimanagement.TranslateRequiredQueryParametersConductTemplate),
Value: to.Ptr("https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml"),
},
}, &armapimanagement.APIClientBeginCreateOrUpdateOptions{IfMatch: nil})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %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("petstoreapi"),
// Type: to.Ptr("Microsoft.ApiManagement/service/apis"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/petstoreapi"),
// Properties: &armapimanagement.APIContractProperties{
// APIRevision: to.Ptr("1"),
// IsCurrent: to.Ptr(true),
// SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{
// Header: to.Ptr("Ocp-Apim-Subscription-Key"),
// Query: to.Ptr("subscription-key"),
// },
// Path: to.Ptr("petstore"),
// DisplayName: to.Ptr("Swagger Petstore"),
// Protocols: []*armapimanagement.Protocol{
// to.Ptr(armapimanagement.ProtocolHTTPS)},
// ServiceURL: to.Ptr("http://petstore.swagger.io/v1"),
// },
// }
}
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 Creates new or updates existing specified API of the API Management service instance.
*
* @summary Creates new or updates existing specified API of the API Management service instance.
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiUsingOai3ImportWithTranslateRequiredQueryParametersConduct.json
*/
async function apiManagementCreateApiUsingOai3ImportWithTranslateRequiredQueryParametersConduct() {
const subscriptionId = process.env["APIMANAGEMENT_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["APIMANAGEMENT_RESOURCE_GROUP"] || "rg1";
const serviceName = "apimService1";
const apiId = "petstore";
const parameters = {
format: "openapi-link",
path: "petstore",
translateRequiredQueryParametersConduct: "template",
value:
"https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml",
};
const credential = new DefaultAzureCredential();
const client = new ApiManagementClient(credential, subscriptionId);
const result = await client.api.beginCreateOrUpdateAndWait(
resourceGroupName,
serviceName,
apiId,
parameters
);
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.ApiManagement.Models;
using Azure.ResourceManager.ApiManagement;
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiUsingOai3ImportWithTranslateRequiredQueryParametersConduct.json
// this example is just showing the usage of "Api_CreateOrUpdate" 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://video2.skills-academy.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 = "petstore";
ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent()
{
Path = "petstore",
Value = "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml",
Format = ContentFormat.OpenApiLink,
TranslateRequiredQueryParametersConduct = TranslateRequiredQueryParametersConduct.Template,
};
ArmOperation<ApiResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content);
ApiResource result = lro.Value;
// 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
応答のサンプル
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/petstoreapi",
"type": "Microsoft.ApiManagement/service/apis",
"name": "petstoreapi",
"properties": {
"displayName": "Swagger Petstore",
"apiRevision": "1",
"serviceUrl": "http://petstore.swagger.io/v1",
"path": "petstore",
"protocols": [
"https"
],
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"isCurrent": true
}
}
location: https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/tempgroup?api-version=2022-08-01&asyncId=5c730e343244df1b9cb56e85&asyncCode=201
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/petstoreapi",
"type": "Microsoft.ApiManagement/service/apis",
"name": "petstoreapi",
"properties": {
"displayName": "Swagger Petstore",
"apiRevision": "1",
"serviceUrl": "http://petstore.swagger.io/v1",
"path": "petstore",
"protocols": [
"https"
],
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"isCurrent": true
}
}
ApiManagementCreateApiUsingSwaggerImport
要求のサンプル
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/petstore?api-version=2022-08-01
{
"properties": {
"format": "swagger-link-json",
"value": "http://petstore.swagger.io/v2/swagger.json",
"path": "petstore"
}
}
import com.azure.resourcemanager.apimanagement.models.ContentFormat;
/** Samples for Api CreateOrUpdate. */
public final class Main {
/*
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiUsingSwaggerImport.json
*/
/**
* Sample code: ApiManagementCreateApiUsingSwaggerImport.
*
* @param manager Entry point to ApiManagementManager.
*/
public static void apiManagementCreateApiUsingSwaggerImport(
com.azure.resourcemanager.apimanagement.ApiManagementManager manager) {
manager
.apis()
.define("petstore")
.withExistingService("rg1", "apimService1")
.withValue("http://petstore.swagger.io/v2/swagger.json")
.withFormat(ContentFormat.SWAGGER_LINK_JSON)
.withPath("petstore")
.create();
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from typing import Any, IO, Union
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_create_api_using_swagger_import.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.begin_create_or_update(
resource_group_name="rg1",
service_name="apimService1",
api_id="petstore",
parameters={
"properties": {
"format": "swagger-link-json",
"path": "petstore",
"value": "http://petstore.swagger.io/v2/swagger.json",
}
},
).result()
print(response)
# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiUsingSwaggerImport.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/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiUsingSwaggerImport.json
func ExampleAPIClient_BeginCreateOrUpdate_apiManagementCreateApiUsingSwaggerImport() {
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)
}
poller, err := clientFactory.NewAPIClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "petstore", armapimanagement.APICreateOrUpdateParameter{
Properties: &armapimanagement.APICreateOrUpdateProperties{
Path: to.Ptr("petstore"),
Format: to.Ptr(armapimanagement.ContentFormatSwaggerLinkJSON),
Value: to.Ptr("http://petstore.swagger.io/v2/swagger.json"),
},
}, &armapimanagement.APIClientBeginCreateOrUpdateOptions{IfMatch: nil})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %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("petstoreapi"),
// Type: to.Ptr("Microsoft.ApiManagement/service/apis"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/petstoreapi"),
// Properties: &armapimanagement.APIContractProperties{
// Description: to.Ptr("This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters."),
// APIRevision: to.Ptr("1"),
// IsCurrent: to.Ptr(true),
// SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{
// Header: to.Ptr("Ocp-Apim-Subscription-Key"),
// Query: to.Ptr("subscription-key"),
// },
// Path: to.Ptr("petstore"),
// DisplayName: to.Ptr("Swagger Petstore"),
// Protocols: []*armapimanagement.Protocol{
// to.Ptr(armapimanagement.ProtocolHTTP)},
// ServiceURL: to.Ptr("http://petstore.swagger.io/v2"),
// },
// }
}
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 Creates new or updates existing specified API of the API Management service instance.
*
* @summary Creates new or updates existing specified API of the API Management service instance.
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiUsingSwaggerImport.json
*/
async function apiManagementCreateApiUsingSwaggerImport() {
const subscriptionId = process.env["APIMANAGEMENT_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["APIMANAGEMENT_RESOURCE_GROUP"] || "rg1";
const serviceName = "apimService1";
const apiId = "petstore";
const parameters = {
format: "swagger-link-json",
path: "petstore",
value: "http://petstore.swagger.io/v2/swagger.json",
};
const credential = new DefaultAzureCredential();
const client = new ApiManagementClient(credential, subscriptionId);
const result = await client.api.beginCreateOrUpdateAndWait(
resourceGroupName,
serviceName,
apiId,
parameters
);
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.ApiManagement.Models;
using Azure.ResourceManager.ApiManagement;
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiUsingSwaggerImport.json
// this example is just showing the usage of "Api_CreateOrUpdate" 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://video2.skills-academy.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 = "petstore";
ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent()
{
Path = "petstore",
Value = "http://petstore.swagger.io/v2/swagger.json",
Format = ContentFormat.SwaggerLinkJson,
};
ArmOperation<ApiResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content);
ApiResource result = lro.Value;
// 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
応答のサンプル
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/petstoreapi",
"type": "Microsoft.ApiManagement/service/apis",
"name": "petstoreapi",
"properties": {
"displayName": "Swagger Petstore",
"apiRevision": "1",
"description": "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.",
"serviceUrl": "http://petstore.swagger.io/v2",
"path": "petstore",
"protocols": [
"http"
],
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"isCurrent": true
}
}
location: https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/tempgroup?api-version=2022-08-01&asyncId=5c730e343244df1b9cb56e85&asyncCode=201
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/petstoreapi",
"type": "Microsoft.ApiManagement/service/apis",
"name": "petstoreapi",
"properties": {
"displayName": "Swagger Petstore",
"apiRevision": "1",
"description": "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.",
"serviceUrl": "http://petstore.swagger.io/v2",
"path": "petstore",
"protocols": [
"http"
],
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"isCurrent": true
}
}
ApiManagementCreateApiUsingWadlImport
要求のサンプル
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/petstore?api-version=2022-08-01
{
"properties": {
"format": "wadl-link-json",
"value": "https://developer.cisco.com/media/wae-release-6-2-api-reference/wae-collector-rest-api/application.wadl",
"path": "collector"
}
}
import com.azure.resourcemanager.apimanagement.models.ContentFormat;
/** Samples for Api CreateOrUpdate. */
public final class Main {
/*
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiUsingWadlImport.json
*/
/**
* Sample code: ApiManagementCreateApiUsingWadlImport.
*
* @param manager Entry point to ApiManagementManager.
*/
public static void apiManagementCreateApiUsingWadlImport(
com.azure.resourcemanager.apimanagement.ApiManagementManager manager) {
manager
.apis()
.define("petstore")
.withExistingService("rg1", "apimService1")
.withValue(
"https://developer.cisco.com/media/wae-release-6-2-api-reference/wae-collector-rest-api/application.wadl")
.withFormat(ContentFormat.WADL_LINK_JSON)
.withPath("collector")
.create();
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from typing import Any, IO, Union
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_create_api_using_wadl_import.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.begin_create_or_update(
resource_group_name="rg1",
service_name="apimService1",
api_id="petstore",
parameters={
"properties": {
"format": "wadl-link-json",
"path": "collector",
"value": "https://developer.cisco.com/media/wae-release-6-2-api-reference/wae-collector-rest-api/application.wadl",
}
},
).result()
print(response)
# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiUsingWadlImport.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/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiUsingWadlImport.json
func ExampleAPIClient_BeginCreateOrUpdate_apiManagementCreateApiUsingWadlImport() {
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)
}
poller, err := clientFactory.NewAPIClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "petstore", armapimanagement.APICreateOrUpdateParameter{
Properties: &armapimanagement.APICreateOrUpdateProperties{
Path: to.Ptr("collector"),
Format: to.Ptr(armapimanagement.ContentFormatWadlLinkJSON),
Value: to.Ptr("https://developer.cisco.com/media/wae-release-6-2-api-reference/wae-collector-rest-api/application.wadl"),
},
}, &armapimanagement.APIClientBeginCreateOrUpdateOptions{IfMatch: nil})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %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("collectorwadl"),
// Type: to.Ptr("Microsoft.ApiManagement/service/apis"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/collectorwadl"),
// Properties: &armapimanagement.APIContractProperties{
// Description: to.Ptr(""),
// APIRevision: to.Ptr("1"),
// IsCurrent: to.Ptr(true),
// SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{
// Header: to.Ptr("Ocp-Apim-Subscription-Key"),
// Query: to.Ptr("subscription-key"),
// },
// Path: to.Ptr("collector"),
// DisplayName: to.Ptr("http://localhost:8080/collector-northbound"),
// Protocols: []*armapimanagement.Protocol{
// to.Ptr(armapimanagement.ProtocolHTTPS)},
// ServiceURL: to.Ptr("http://localhost:8080/collector-northbound"),
// },
// }
}
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 Creates new or updates existing specified API of the API Management service instance.
*
* @summary Creates new or updates existing specified API of the API Management service instance.
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiUsingWadlImport.json
*/
async function apiManagementCreateApiUsingWadlImport() {
const subscriptionId = process.env["APIMANAGEMENT_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["APIMANAGEMENT_RESOURCE_GROUP"] || "rg1";
const serviceName = "apimService1";
const apiId = "petstore";
const parameters = {
format: "wadl-link-json",
path: "collector",
value:
"https://developer.cisco.com/media/wae-release-6-2-api-reference/wae-collector-rest-api/application.wadl",
};
const credential = new DefaultAzureCredential();
const client = new ApiManagementClient(credential, subscriptionId);
const result = await client.api.beginCreateOrUpdateAndWait(
resourceGroupName,
serviceName,
apiId,
parameters
);
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.ApiManagement.Models;
using Azure.ResourceManager.ApiManagement;
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiUsingWadlImport.json
// this example is just showing the usage of "Api_CreateOrUpdate" 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://video2.skills-academy.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 = "petstore";
ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent()
{
Path = "collector",
Value = "https://developer.cisco.com/media/wae-release-6-2-api-reference/wae-collector-rest-api/application.wadl",
Format = ContentFormat.WadlLinkJson,
};
ArmOperation<ApiResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content);
ApiResource result = lro.Value;
// 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
応答のサンプル
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/collectorwadl",
"type": "Microsoft.ApiManagement/service/apis",
"name": "collectorwadl",
"properties": {
"displayName": "http://localhost:8080/collector-northbound",
"apiRevision": "1",
"description": "",
"serviceUrl": "http://localhost:8080/collector-northbound",
"path": "collector",
"protocols": [
"https"
],
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"isCurrent": true
}
}
location: https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/tempgroup?api-version=2022-08-01&asyncId=5c730e343244df1b9cb56e85&asyncCode=201
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/collectorwadl",
"type": "Microsoft.ApiManagement/service/apis",
"name": "collectorwadl",
"properties": {
"displayName": "http://localhost:8080/collector-northbound",
"apiRevision": "1",
"description": "",
"serviceUrl": "http://localhost:8080/collector-northbound",
"path": "collector",
"protocols": [
"https"
],
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"isCurrent": true
}
}
ApiManagementCreateApiWithMultipleAuthServers
要求のサンプル
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/tempgroup?api-version=2022-08-01
{
"properties": {
"description": "apidescription5200",
"authenticationSettings": {
"oAuth2AuthenticationSettings": [
{
"authorizationServerId": "authorizationServerId2283",
"scope": "oauth2scope2580"
},
{
"authorizationServerId": "authorizationServerId2284",
"scope": "oauth2scope2581"
}
]
},
"subscriptionKeyParameterNames": {
"header": "header4520",
"query": "query3037"
},
"displayName": "apiname1463",
"serviceUrl": "http://newechoapi.cloudapp.net/api",
"path": "newapiPath",
"protocols": [
"https",
"http"
]
}
}
import com.azure.resourcemanager.apimanagement.models.AuthenticationSettingsContract;
import com.azure.resourcemanager.apimanagement.models.OAuth2AuthenticationSettingsContract;
import com.azure.resourcemanager.apimanagement.models.Protocol;
import com.azure.resourcemanager.apimanagement.models.SubscriptionKeyParameterNamesContract;
import java.util.Arrays;
/** Samples for Api CreateOrUpdate. */
public final class Main {
/*
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiWithMultipleAuthServers.json
*/
/**
* Sample code: ApiManagementCreateApiWithMultipleAuthServers.
*
* @param manager Entry point to ApiManagementManager.
*/
public static void apiManagementCreateApiWithMultipleAuthServers(
com.azure.resourcemanager.apimanagement.ApiManagementManager manager) {
manager
.apis()
.define("tempgroup")
.withExistingService("rg1", "apimService1")
.withDisplayName("apiname1463")
.withServiceUrl("http://newechoapi.cloudapp.net/api")
.withPath("newapiPath")
.withProtocols(Arrays.asList(Protocol.HTTPS, Protocol.HTTP))
.withDescription("apidescription5200")
.withAuthenticationSettings(
new AuthenticationSettingsContract()
.withOAuth2AuthenticationSettings(
Arrays
.asList(
new OAuth2AuthenticationSettingsContract()
.withAuthorizationServerId("fakeTokenPlaceholder")
.withScope("oauth2scope2580"),
new OAuth2AuthenticationSettingsContract()
.withAuthorizationServerId("fakeTokenPlaceholder")
.withScope("oauth2scope2581"))))
.withSubscriptionKeyParameterNames(
new SubscriptionKeyParameterNamesContract().withHeaderProperty("header4520").withQuery("query3037"))
.create();
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from typing import Any, IO, Union
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_create_api_with_multiple_auth_servers.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.begin_create_or_update(
resource_group_name="rg1",
service_name="apimService1",
api_id="tempgroup",
parameters={
"properties": {
"authenticationSettings": {
"oAuth2AuthenticationSettings": [
{"authorizationServerId": "authorizationServerId2283", "scope": "oauth2scope2580"},
{"authorizationServerId": "authorizationServerId2284", "scope": "oauth2scope2581"},
]
},
"description": "apidescription5200",
"displayName": "apiname1463",
"path": "newapiPath",
"protocols": ["https", "http"],
"serviceUrl": "http://newechoapi.cloudapp.net/api",
"subscriptionKeyParameterNames": {"header": "header4520", "query": "query3037"},
}
},
).result()
print(response)
# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiWithMultipleAuthServers.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/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiWithMultipleAuthServers.json
func ExampleAPIClient_BeginCreateOrUpdate_apiManagementCreateApiWithMultipleAuthServers() {
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)
}
poller, err := clientFactory.NewAPIClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "tempgroup", armapimanagement.APICreateOrUpdateParameter{
Properties: &armapimanagement.APICreateOrUpdateProperties{
Description: to.Ptr("apidescription5200"),
AuthenticationSettings: &armapimanagement.AuthenticationSettingsContract{
OAuth2AuthenticationSettings: []*armapimanagement.OAuth2AuthenticationSettingsContract{
{
AuthorizationServerID: to.Ptr("authorizationServerId2283"),
Scope: to.Ptr("oauth2scope2580"),
},
{
AuthorizationServerID: to.Ptr("authorizationServerId2284"),
Scope: to.Ptr("oauth2scope2581"),
}},
},
SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{
Header: to.Ptr("header4520"),
Query: to.Ptr("query3037"),
},
Path: to.Ptr("newapiPath"),
DisplayName: to.Ptr("apiname1463"),
Protocols: []*armapimanagement.Protocol{
to.Ptr(armapimanagement.ProtocolHTTPS),
to.Ptr(armapimanagement.ProtocolHTTP)},
ServiceURL: to.Ptr("http://newechoapi.cloudapp.net/api"),
},
}, &armapimanagement.APIClientBeginCreateOrUpdateOptions{IfMatch: nil})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %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("apiid9419"),
// Type: to.Ptr("Microsoft.ApiManagement/service/apis"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/apiid9419"),
// Properties: &armapimanagement.APIContractProperties{
// Description: to.Ptr("apidescription5200"),
// APIRevision: to.Ptr("1"),
// AuthenticationSettings: &armapimanagement.AuthenticationSettingsContract{
// OAuth2: &armapimanagement.OAuth2AuthenticationSettingsContract{
// AuthorizationServerID: to.Ptr("authorizationServerId2283"),
// Scope: to.Ptr("oauth2scope2580"),
// },
// OAuth2AuthenticationSettings: []*armapimanagement.OAuth2AuthenticationSettingsContract{
// {
// AuthorizationServerID: to.Ptr("authorizationServerId2283"),
// Scope: to.Ptr("oauth2scope2580"),
// },
// {
// AuthorizationServerID: to.Ptr("authorizationServerId2284"),
// Scope: to.Ptr("oauth2scope2581"),
// }},
// },
// IsCurrent: to.Ptr(true),
// IsOnline: to.Ptr(true),
// SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{
// Header: to.Ptr("header4520"),
// Query: to.Ptr("query3037"),
// },
// Path: to.Ptr("newapiPath"),
// DisplayName: to.Ptr("apiname1463"),
// Protocols: []*armapimanagement.Protocol{
// to.Ptr(armapimanagement.ProtocolHTTP),
// to.Ptr(armapimanagement.ProtocolHTTPS)},
// ServiceURL: to.Ptr("http://newechoapi.cloudapp.net/api"),
// },
// }
}
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 Creates new or updates existing specified API of the API Management service instance.
*
* @summary Creates new or updates existing specified API of the API Management service instance.
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiWithMultipleAuthServers.json
*/
async function apiManagementCreateApiWithMultipleAuthServers() {
const subscriptionId = process.env["APIMANAGEMENT_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["APIMANAGEMENT_RESOURCE_GROUP"] || "rg1";
const serviceName = "apimService1";
const apiId = "tempgroup";
const parameters = {
path: "newapiPath",
description: "apidescription5200",
authenticationSettings: {
oAuth2AuthenticationSettings: [
{
authorizationServerId: "authorizationServerId2283",
scope: "oauth2scope2580",
},
{
authorizationServerId: "authorizationServerId2284",
scope: "oauth2scope2581",
},
],
},
displayName: "apiname1463",
protocols: ["https", "http"],
serviceUrl: "http://newechoapi.cloudapp.net/api",
subscriptionKeyParameterNames: { header: "header4520", query: "query3037" },
};
const credential = new DefaultAzureCredential();
const client = new ApiManagementClient(credential, subscriptionId);
const result = await client.api.beginCreateOrUpdateAndWait(
resourceGroupName,
serviceName,
apiId,
parameters
);
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.ApiManagement.Models;
using Azure.ResourceManager.ApiManagement;
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiWithMultipleAuthServers.json
// this example is just showing the usage of "Api_CreateOrUpdate" 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://video2.skills-academy.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 = "tempgroup";
ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent()
{
Description = "apidescription5200",
AuthenticationSettings = new AuthenticationSettingsContract()
{
OAuth2AuthenticationSettings =
{
new OAuth2AuthenticationSettingsContract()
{
AuthorizationServerId = "authorizationServerId2283",
Scope = "oauth2scope2580",
},new OAuth2AuthenticationSettingsContract()
{
AuthorizationServerId = "authorizationServerId2284",
Scope = "oauth2scope2581",
}
},
},
SubscriptionKeyParameterNames = new SubscriptionKeyParameterNamesContract()
{
Header = "header4520",
Query = "query3037",
},
DisplayName = "apiname1463",
ServiceLink = "http://newechoapi.cloudapp.net/api",
Path = "newapiPath",
Protocols =
{
ApiOperationInvokableProtocol.Https,ApiOperationInvokableProtocol.Http
},
};
ArmOperation<ApiResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content);
ApiResource result = lro.Value;
// 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
応答のサンプル
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/apiid9419",
"type": "Microsoft.ApiManagement/service/apis",
"name": "apiid9419",
"properties": {
"displayName": "apiname1463",
"apiRevision": "1",
"description": "apidescription5200",
"serviceUrl": "http://newechoapi.cloudapp.net/api",
"path": "newapiPath",
"protocols": [
"http",
"https"
],
"subscriptionKeyParameterNames": {
"header": "header4520",
"query": "query3037"
},
"isCurrent": true,
"isOnline": true
}
}
location: https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/tempgroup?api-version=2022-08-01&asyncId=5c730e343244df1b9cb56e85&asyncCode=201
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/apiid9419",
"type": "Microsoft.ApiManagement/service/apis",
"name": "apiid9419",
"properties": {
"displayName": "apiname1463",
"apiRevision": "1",
"description": "apidescription5200",
"serviceUrl": "http://newechoapi.cloudapp.net/api",
"path": "newapiPath",
"protocols": [
"http",
"https"
],
"authenticationSettings": {
"oAuth2": {
"authorizationServerId": "authorizationServerId2283",
"scope": "oauth2scope2580"
},
"oAuth2AuthenticationSettings": [
{
"authorizationServerId": "authorizationServerId2283",
"scope": "oauth2scope2580"
},
{
"authorizationServerId": "authorizationServerId2284",
"scope": "oauth2scope2581"
}
]
},
"subscriptionKeyParameterNames": {
"header": "header4520",
"query": "query3037"
},
"isCurrent": true,
"isOnline": true
}
}
ApiManagementCreateApiWithMultipleOpenIdConnectProviders
要求のサンプル
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/tempgroup?api-version=2022-08-01
{
"properties": {
"description": "apidescription5200",
"authenticationSettings": {
"openidAuthenticationSettings": [
{
"openidProviderId": "openidProviderId2283",
"bearerTokenSendingMethods": [
"authorizationHeader"
]
},
{
"openidProviderId": "openidProviderId2284",
"bearerTokenSendingMethods": [
"authorizationHeader"
]
}
]
},
"subscriptionKeyParameterNames": {
"header": "header4520",
"query": "query3037"
},
"displayName": "apiname1463",
"serviceUrl": "http://newechoapi.cloudapp.net/api",
"path": "newapiPath",
"protocols": [
"https",
"http"
]
}
}
import com.azure.resourcemanager.apimanagement.models.AuthenticationSettingsContract;
import com.azure.resourcemanager.apimanagement.models.BearerTokenSendingMethods;
import com.azure.resourcemanager.apimanagement.models.OpenIdAuthenticationSettingsContract;
import com.azure.resourcemanager.apimanagement.models.Protocol;
import com.azure.resourcemanager.apimanagement.models.SubscriptionKeyParameterNamesContract;
import java.util.Arrays;
/** Samples for Api CreateOrUpdate. */
public final class Main {
/*
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiWithMultipleOpenIdConnectProviders.json
*/
/**
* Sample code: ApiManagementCreateApiWithMultipleOpenIdConnectProviders.
*
* @param manager Entry point to ApiManagementManager.
*/
public static void apiManagementCreateApiWithMultipleOpenIdConnectProviders(
com.azure.resourcemanager.apimanagement.ApiManagementManager manager) {
manager
.apis()
.define("tempgroup")
.withExistingService("rg1", "apimService1")
.withDisplayName("apiname1463")
.withServiceUrl("http://newechoapi.cloudapp.net/api")
.withPath("newapiPath")
.withProtocols(Arrays.asList(Protocol.HTTPS, Protocol.HTTP))
.withDescription("apidescription5200")
.withAuthenticationSettings(
new AuthenticationSettingsContract()
.withOpenidAuthenticationSettings(
Arrays
.asList(
new OpenIdAuthenticationSettingsContract()
.withOpenidProviderId("openidProviderId2283")
.withBearerTokenSendingMethods(
Arrays.asList(BearerTokenSendingMethods.AUTHORIZATION_HEADER)),
new OpenIdAuthenticationSettingsContract()
.withOpenidProviderId("openidProviderId2284")
.withBearerTokenSendingMethods(
Arrays.asList(BearerTokenSendingMethods.AUTHORIZATION_HEADER)))))
.withSubscriptionKeyParameterNames(
new SubscriptionKeyParameterNamesContract().withHeaderProperty("header4520").withQuery("query3037"))
.create();
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from typing import Any, IO, Union
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_create_api_with_multiple_open_id_connect_providers.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.begin_create_or_update(
resource_group_name="rg1",
service_name="apimService1",
api_id="tempgroup",
parameters={
"properties": {
"authenticationSettings": {
"openidAuthenticationSettings": [
{
"bearerTokenSendingMethods": ["authorizationHeader"],
"openidProviderId": "openidProviderId2283",
},
{
"bearerTokenSendingMethods": ["authorizationHeader"],
"openidProviderId": "openidProviderId2284",
},
]
},
"description": "apidescription5200",
"displayName": "apiname1463",
"path": "newapiPath",
"protocols": ["https", "http"],
"serviceUrl": "http://newechoapi.cloudapp.net/api",
"subscriptionKeyParameterNames": {"header": "header4520", "query": "query3037"},
}
},
).result()
print(response)
# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiWithMultipleOpenIdConnectProviders.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/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiWithMultipleOpenIdConnectProviders.json
func ExampleAPIClient_BeginCreateOrUpdate_apiManagementCreateApiWithMultipleOpenIdConnectProviders() {
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)
}
poller, err := clientFactory.NewAPIClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "tempgroup", armapimanagement.APICreateOrUpdateParameter{
Properties: &armapimanagement.APICreateOrUpdateProperties{
Description: to.Ptr("apidescription5200"),
AuthenticationSettings: &armapimanagement.AuthenticationSettingsContract{
OpenidAuthenticationSettings: []*armapimanagement.OpenIDAuthenticationSettingsContract{
{
BearerTokenSendingMethods: []*armapimanagement.BearerTokenSendingMethods{
to.Ptr(armapimanagement.BearerTokenSendingMethodsAuthorizationHeader)},
OpenidProviderID: to.Ptr("openidProviderId2283"),
},
{
BearerTokenSendingMethods: []*armapimanagement.BearerTokenSendingMethods{
to.Ptr(armapimanagement.BearerTokenSendingMethodsAuthorizationHeader)},
OpenidProviderID: to.Ptr("openidProviderId2284"),
}},
},
SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{
Header: to.Ptr("header4520"),
Query: to.Ptr("query3037"),
},
Path: to.Ptr("newapiPath"),
DisplayName: to.Ptr("apiname1463"),
Protocols: []*armapimanagement.Protocol{
to.Ptr(armapimanagement.ProtocolHTTPS),
to.Ptr(armapimanagement.ProtocolHTTP)},
ServiceURL: to.Ptr("http://newechoapi.cloudapp.net/api"),
},
}, &armapimanagement.APIClientBeginCreateOrUpdateOptions{IfMatch: nil})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %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("apiid9419"),
// Type: to.Ptr("Microsoft.ApiManagement/service/apis"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/apiid9419"),
// Properties: &armapimanagement.APIContractProperties{
// Description: to.Ptr("apidescription5200"),
// APIRevision: to.Ptr("1"),
// AuthenticationSettings: &armapimanagement.AuthenticationSettingsContract{
// Openid: &armapimanagement.OpenIDAuthenticationSettingsContract{
// BearerTokenSendingMethods: []*armapimanagement.BearerTokenSendingMethods{
// to.Ptr(armapimanagement.BearerTokenSendingMethodsAuthorizationHeader)},
// OpenidProviderID: to.Ptr("openidProviderId2283"),
// },
// OpenidAuthenticationSettings: []*armapimanagement.OpenIDAuthenticationSettingsContract{
// {
// BearerTokenSendingMethods: []*armapimanagement.BearerTokenSendingMethods{
// to.Ptr(armapimanagement.BearerTokenSendingMethodsAuthorizationHeader)},
// OpenidProviderID: to.Ptr("openidProviderId2283"),
// },
// {
// BearerTokenSendingMethods: []*armapimanagement.BearerTokenSendingMethods{
// to.Ptr(armapimanagement.BearerTokenSendingMethodsAuthorizationHeader)},
// OpenidProviderID: to.Ptr("openidProviderId2284"),
// }},
// },
// IsCurrent: to.Ptr(true),
// IsOnline: to.Ptr(true),
// SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{
// Header: to.Ptr("header4520"),
// Query: to.Ptr("query3037"),
// },
// Path: to.Ptr("newapiPath"),
// DisplayName: to.Ptr("apiname1463"),
// Protocols: []*armapimanagement.Protocol{
// to.Ptr(armapimanagement.ProtocolHTTP),
// to.Ptr(armapimanagement.ProtocolHTTPS)},
// ServiceURL: to.Ptr("http://newechoapi.cloudapp.net/api"),
// },
// }
}
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 Creates new or updates existing specified API of the API Management service instance.
*
* @summary Creates new or updates existing specified API of the API Management service instance.
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiWithMultipleOpenIdConnectProviders.json
*/
async function apiManagementCreateApiWithMultipleOpenIdConnectProviders() {
const subscriptionId = process.env["APIMANAGEMENT_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["APIMANAGEMENT_RESOURCE_GROUP"] || "rg1";
const serviceName = "apimService1";
const apiId = "tempgroup";
const parameters = {
path: "newapiPath",
description: "apidescription5200",
authenticationSettings: {
openidAuthenticationSettings: [
{
bearerTokenSendingMethods: ["authorizationHeader"],
openidProviderId: "openidProviderId2283",
},
{
bearerTokenSendingMethods: ["authorizationHeader"],
openidProviderId: "openidProviderId2284",
},
],
},
displayName: "apiname1463",
protocols: ["https", "http"],
serviceUrl: "http://newechoapi.cloudapp.net/api",
subscriptionKeyParameterNames: { header: "header4520", query: "query3037" },
};
const credential = new DefaultAzureCredential();
const client = new ApiManagementClient(credential, subscriptionId);
const result = await client.api.beginCreateOrUpdateAndWait(
resourceGroupName,
serviceName,
apiId,
parameters
);
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.ApiManagement.Models;
using Azure.ResourceManager.ApiManagement;
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiWithMultipleOpenIdConnectProviders.json
// this example is just showing the usage of "Api_CreateOrUpdate" 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://video2.skills-academy.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 = "tempgroup";
ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent()
{
Description = "apidescription5200",
AuthenticationSettings = new AuthenticationSettingsContract()
{
OpenidAuthenticationSettings =
{
new OpenIdAuthenticationSettingsContract()
{
OpenIdProviderId = "openidProviderId2283",
BearerTokenSendingMethods =
{
BearerTokenSendingMethod.AuthorizationHeader
},
},new OpenIdAuthenticationSettingsContract()
{
OpenIdProviderId = "openidProviderId2284",
BearerTokenSendingMethods =
{
BearerTokenSendingMethod.AuthorizationHeader
},
}
},
},
SubscriptionKeyParameterNames = new SubscriptionKeyParameterNamesContract()
{
Header = "header4520",
Query = "query3037",
},
DisplayName = "apiname1463",
ServiceLink = "http://newechoapi.cloudapp.net/api",
Path = "newapiPath",
Protocols =
{
ApiOperationInvokableProtocol.Https,ApiOperationInvokableProtocol.Http
},
};
ArmOperation<ApiResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content);
ApiResource result = lro.Value;
// 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
応答のサンプル
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/apiid9419",
"type": "Microsoft.ApiManagement/service/apis",
"name": "apiid9419",
"properties": {
"displayName": "apiname1463",
"apiRevision": "1",
"description": "apidescription5200",
"serviceUrl": "http://newechoapi.cloudapp.net/api",
"path": "newapiPath",
"protocols": [
"http",
"https"
],
"subscriptionKeyParameterNames": {
"header": "header4520",
"query": "query3037"
},
"isCurrent": true,
"isOnline": true
}
}
location: https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/tempgroup?api-version=2022-08-01&asyncId=5c730e343244df1b9cb56e85&asyncCode=201
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/apiid9419",
"type": "Microsoft.ApiManagement/service/apis",
"name": "apiid9419",
"properties": {
"displayName": "apiname1463",
"apiRevision": "1",
"description": "apidescription5200",
"serviceUrl": "http://newechoapi.cloudapp.net/api",
"path": "newapiPath",
"protocols": [
"http",
"https"
],
"authenticationSettings": {
"openid": {
"openidProviderId": "openidProviderId2283",
"bearerTokenSendingMethods": [
"authorizationHeader"
]
},
"openidAuthenticationSettings": [
{
"openidProviderId": "openidProviderId2283",
"bearerTokenSendingMethods": [
"authorizationHeader"
]
},
{
"openidProviderId": "openidProviderId2284",
"bearerTokenSendingMethods": [
"authorizationHeader"
]
}
]
},
"subscriptionKeyParameterNames": {
"header": "header4520",
"query": "query3037"
},
"isCurrent": true,
"isOnline": true
}
}
ApiManagementCreateApiWithOpenIdConnect
要求のサンプル
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/tempgroup?api-version=2022-08-01
{
"properties": {
"displayName": "Swagger Petstore",
"description": "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.",
"serviceUrl": "http://petstore.swagger.io/v2",
"path": "petstore",
"protocols": [
"https"
],
"authenticationSettings": {
"openid": {
"openidProviderId": "testopenid",
"bearerTokenSendingMethods": [
"authorizationHeader"
]
}
},
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
}
}
}
import com.azure.resourcemanager.apimanagement.models.AuthenticationSettingsContract;
import com.azure.resourcemanager.apimanagement.models.BearerTokenSendingMethods;
import com.azure.resourcemanager.apimanagement.models.OpenIdAuthenticationSettingsContract;
import com.azure.resourcemanager.apimanagement.models.Protocol;
import com.azure.resourcemanager.apimanagement.models.SubscriptionKeyParameterNamesContract;
import java.util.Arrays;
/** Samples for Api CreateOrUpdate. */
public final class Main {
/*
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiWithOpenIdConnect.json
*/
/**
* Sample code: ApiManagementCreateApiWithOpenIdConnect.
*
* @param manager Entry point to ApiManagementManager.
*/
public static void apiManagementCreateApiWithOpenIdConnect(
com.azure.resourcemanager.apimanagement.ApiManagementManager manager) {
manager
.apis()
.define("tempgroup")
.withExistingService("rg1", "apimService1")
.withDisplayName("Swagger Petstore")
.withServiceUrl("http://petstore.swagger.io/v2")
.withPath("petstore")
.withProtocols(Arrays.asList(Protocol.HTTPS))
.withDescription(
"This is a sample server Petstore server. You can find out more about Swagger at"
+ " [http://swagger.io](http://swagger.io) or on [irc.freenode.net,"
+ " #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to"
+ " test the authorization filters.")
.withAuthenticationSettings(
new AuthenticationSettingsContract()
.withOpenid(
new OpenIdAuthenticationSettingsContract()
.withOpenidProviderId("testopenid")
.withBearerTokenSendingMethods(
Arrays.asList(BearerTokenSendingMethods.AUTHORIZATION_HEADER))))
.withSubscriptionKeyParameterNames(
new SubscriptionKeyParameterNamesContract()
.withHeaderProperty("Ocp-Apim-Subscription-Key")
.withQuery("subscription-key"))
.create();
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from typing import Any, IO, Union
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_create_api_with_open_id_connect.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.begin_create_or_update(
resource_group_name="rg1",
service_name="apimService1",
api_id="tempgroup",
parameters={
"properties": {
"authenticationSettings": {
"openid": {"bearerTokenSendingMethods": ["authorizationHeader"], "openidProviderId": "testopenid"}
},
"description": "This is a sample server Petstore server. You can find out more about Swagger at `http://swagger.io <http://swagger.io>`_ or on `irc.freenode.net, #swagger <http://swagger.io/irc/>`_. For this sample, you can use the api key ``special-key`` to test the authorization filters.",
"displayName": "Swagger Petstore",
"path": "petstore",
"protocols": ["https"],
"serviceUrl": "http://petstore.swagger.io/v2",
"subscriptionKeyParameterNames": {"header": "Ocp-Apim-Subscription-Key", "query": "subscription-key"},
}
},
).result()
print(response)
# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiWithOpenIdConnect.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/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiWithOpenIdConnect.json
func ExampleAPIClient_BeginCreateOrUpdate_apiManagementCreateApiWithOpenIdConnect() {
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)
}
poller, err := clientFactory.NewAPIClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "tempgroup", armapimanagement.APICreateOrUpdateParameter{
Properties: &armapimanagement.APICreateOrUpdateProperties{
Description: to.Ptr("This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters."),
AuthenticationSettings: &armapimanagement.AuthenticationSettingsContract{
Openid: &armapimanagement.OpenIDAuthenticationSettingsContract{
BearerTokenSendingMethods: []*armapimanagement.BearerTokenSendingMethods{
to.Ptr(armapimanagement.BearerTokenSendingMethodsAuthorizationHeader)},
OpenidProviderID: to.Ptr("testopenid"),
},
},
SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{
Header: to.Ptr("Ocp-Apim-Subscription-Key"),
Query: to.Ptr("subscription-key"),
},
Path: to.Ptr("petstore"),
DisplayName: to.Ptr("Swagger Petstore"),
Protocols: []*armapimanagement.Protocol{
to.Ptr(armapimanagement.ProtocolHTTPS)},
ServiceURL: to.Ptr("http://petstore.swagger.io/v2"),
},
}, &armapimanagement.APIClientBeginCreateOrUpdateOptions{IfMatch: nil})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %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("58da4c4ccdae970a08121230"),
// Type: to.Ptr("Microsoft.ApiManagement/service/apis"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/58da4c4ccdae970a08121230"),
// Properties: &armapimanagement.APIContractProperties{
// Description: to.Ptr("This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters."),
// APIRevision: to.Ptr("1"),
// AuthenticationSettings: &armapimanagement.AuthenticationSettingsContract{
// Openid: &armapimanagement.OpenIDAuthenticationSettingsContract{
// BearerTokenSendingMethods: []*armapimanagement.BearerTokenSendingMethods{
// to.Ptr(armapimanagement.BearerTokenSendingMethodsAuthorizationHeader)},
// OpenidProviderID: to.Ptr("testopenid"),
// },
// },
// IsCurrent: to.Ptr(true),
// SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{
// Header: to.Ptr("Ocp-Apim-Subscription-Key"),
// Query: to.Ptr("subscription-key"),
// },
// Path: to.Ptr("petstore"),
// DisplayName: to.Ptr("Swagger Petstore"),
// Protocols: []*armapimanagement.Protocol{
// to.Ptr(armapimanagement.ProtocolHTTPS)},
// ServiceURL: to.Ptr("http://petstore.swagger.io/v2"),
// },
// }
}
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 Creates new or updates existing specified API of the API Management service instance.
*
* @summary Creates new or updates existing specified API of the API Management service instance.
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiWithOpenIdConnect.json
*/
async function apiManagementCreateApiWithOpenIdConnect() {
const subscriptionId = process.env["APIMANAGEMENT_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["APIMANAGEMENT_RESOURCE_GROUP"] || "rg1";
const serviceName = "apimService1";
const apiId = "tempgroup";
const parameters = {
path: "petstore",
description:
"This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.",
authenticationSettings: {
openid: {
bearerTokenSendingMethods: ["authorizationHeader"],
openidProviderId: "testopenid",
},
},
displayName: "Swagger Petstore",
protocols: ["https"],
serviceUrl: "http://petstore.swagger.io/v2",
subscriptionKeyParameterNames: {
header: "Ocp-Apim-Subscription-Key",
query: "subscription-key",
},
};
const credential = new DefaultAzureCredential();
const client = new ApiManagementClient(credential, subscriptionId);
const result = await client.api.beginCreateOrUpdateAndWait(
resourceGroupName,
serviceName,
apiId,
parameters
);
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.ApiManagement.Models;
using Azure.ResourceManager.ApiManagement;
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateApiWithOpenIdConnect.json
// this example is just showing the usage of "Api_CreateOrUpdate" 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://video2.skills-academy.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 = "tempgroup";
ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent()
{
Description = "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.",
AuthenticationSettings = new AuthenticationSettingsContract()
{
OpenId = new OpenIdAuthenticationSettingsContract()
{
OpenIdProviderId = "testopenid",
BearerTokenSendingMethods =
{
BearerTokenSendingMethod.AuthorizationHeader
},
},
},
SubscriptionKeyParameterNames = new SubscriptionKeyParameterNamesContract()
{
Header = "Ocp-Apim-Subscription-Key",
Query = "subscription-key",
},
DisplayName = "Swagger Petstore",
ServiceLink = "http://petstore.swagger.io/v2",
Path = "petstore",
Protocols =
{
ApiOperationInvokableProtocol.Https
},
};
ArmOperation<ApiResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content);
ApiResource result = lro.Value;
// 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
応答のサンプル
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/58da4c4ccdae970a08121230",
"type": "Microsoft.ApiManagement/service/apis",
"name": "58da4c4ccdae970a08121230",
"properties": {
"displayName": "Swagger Petstore",
"apiRevision": "1",
"description": "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.",
"serviceUrl": "http://petstore.swagger.io/v2",
"path": "petstore",
"protocols": [
"https"
],
"authenticationSettings": {
"openid": {
"openidProviderId": "testopenid",
"bearerTokenSendingMethods": [
"authorizationHeader"
]
}
},
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"isCurrent": true
}
}
location: https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/tempgroup?api-version=2022-08-01&asyncId=5c730e343244df1b9cb56e85&asyncCode=201
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/58da4c4ccdae970a08121230",
"type": "Microsoft.ApiManagement/service/apis",
"name": "58da4c4ccdae970a08121230",
"properties": {
"displayName": "Swagger Petstore",
"apiRevision": "1",
"description": "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.",
"serviceUrl": "http://petstore.swagger.io/v2",
"path": "petstore",
"protocols": [
"https"
],
"authenticationSettings": {
"openid": {
"openidProviderId": "testopenid",
"bearerTokenSendingMethods": [
"authorizationHeader"
]
}
},
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"isCurrent": true
}
}
ApiManagementCreateGraphQLApi
要求のサンプル
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/tempgroup?api-version=2022-08-01
{
"properties": {
"description": "apidescription5200",
"displayName": "apiname1463",
"type": "graphql",
"serviceUrl": "https://api.spacex.land/graphql",
"path": "graphql-api",
"protocols": [
"http",
"https"
]
}
}
import com.azure.resourcemanager.apimanagement.models.ApiType;
import com.azure.resourcemanager.apimanagement.models.Protocol;
import java.util.Arrays;
/** Samples for Api CreateOrUpdate. */
public final class Main {
/*
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateGraphQLApi.json
*/
/**
* Sample code: ApiManagementCreateGraphQLApi.
*
* @param manager Entry point to ApiManagementManager.
*/
public static void apiManagementCreateGraphQLApi(
com.azure.resourcemanager.apimanagement.ApiManagementManager manager) {
manager
.apis()
.define("tempgroup")
.withExistingService("rg1", "apimService1")
.withDisplayName("apiname1463")
.withServiceUrl("https://api.spacex.land/graphql")
.withPath("graphql-api")
.withProtocols(Arrays.asList(Protocol.HTTP, Protocol.HTTPS))
.withDescription("apidescription5200")
.withApiType(ApiType.GRAPHQL)
.create();
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from typing import Any, IO, Union
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_create_graph_ql_api.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.begin_create_or_update(
resource_group_name="rg1",
service_name="apimService1",
api_id="tempgroup",
parameters={
"properties": {
"description": "apidescription5200",
"displayName": "apiname1463",
"path": "graphql-api",
"protocols": ["http", "https"],
"serviceUrl": "https://api.spacex.land/graphql",
"type": "graphql",
}
},
).result()
print(response)
# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateGraphQLApi.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/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateGraphQLApi.json
func ExampleAPIClient_BeginCreateOrUpdate_apiManagementCreateGraphQlApi() {
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)
}
poller, err := clientFactory.NewAPIClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "tempgroup", armapimanagement.APICreateOrUpdateParameter{
Properties: &armapimanagement.APICreateOrUpdateProperties{
APIType: to.Ptr(armapimanagement.APITypeGraphql),
Description: to.Ptr("apidescription5200"),
Path: to.Ptr("graphql-api"),
DisplayName: to.Ptr("apiname1463"),
Protocols: []*armapimanagement.Protocol{
to.Ptr(armapimanagement.ProtocolHTTP),
to.Ptr(armapimanagement.ProtocolHTTPS)},
ServiceURL: to.Ptr("https://api.spacex.land/graphql"),
},
}, &armapimanagement.APIClientBeginCreateOrUpdateOptions{IfMatch: nil})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %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("apiid9419"),
// Type: to.Ptr("Microsoft.ApiManagement/service/apis"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/apiid9419"),
// Properties: &armapimanagement.APIContractProperties{
// APIType: to.Ptr(armapimanagement.APITypeGraphql),
// Description: to.Ptr("apidescription5200"),
// APIRevision: to.Ptr("1"),
// IsCurrent: to.Ptr(true),
// IsOnline: to.Ptr(true),
// Path: to.Ptr("graphql-api"),
// DisplayName: to.Ptr("apiname1463"),
// Protocols: []*armapimanagement.Protocol{
// to.Ptr(armapimanagement.ProtocolHTTP),
// to.Ptr(armapimanagement.ProtocolHTTPS)},
// ServiceURL: to.Ptr("https://api.spacex.land/graphql"),
// },
// }
}
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 Creates new or updates existing specified API of the API Management service instance.
*
* @summary Creates new or updates existing specified API of the API Management service instance.
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateGraphQLApi.json
*/
async function apiManagementCreateGraphQlApi() {
const subscriptionId = process.env["APIMANAGEMENT_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["APIMANAGEMENT_RESOURCE_GROUP"] || "rg1";
const serviceName = "apimService1";
const apiId = "tempgroup";
const parameters = {
apiType: "graphql",
path: "graphql-api",
description: "apidescription5200",
displayName: "apiname1463",
protocols: ["http", "https"],
serviceUrl: "https://api.spacex.land/graphql",
};
const credential = new DefaultAzureCredential();
const client = new ApiManagementClient(credential, subscriptionId);
const result = await client.api.beginCreateOrUpdateAndWait(
resourceGroupName,
serviceName,
apiId,
parameters
);
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.ApiManagement.Models;
using Azure.ResourceManager.ApiManagement;
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateGraphQLApi.json
// this example is just showing the usage of "Api_CreateOrUpdate" 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://video2.skills-academy.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 = "tempgroup";
ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent()
{
Description = "apidescription5200",
ApiType = ApiType.GraphQL,
DisplayName = "apiname1463",
ServiceLink = "https://api.spacex.land/graphql",
Path = "graphql-api",
Protocols =
{
ApiOperationInvokableProtocol.Http,ApiOperationInvokableProtocol.Https
},
};
ArmOperation<ApiResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content);
ApiResource result = lro.Value;
// 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
応答のサンプル
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/apiid9419",
"type": "Microsoft.ApiManagement/service/apis",
"name": "apiid9419",
"properties": {
"displayName": "apiname1463",
"apiRevision": "1",
"description": "apidescription5200",
"serviceUrl": "https://api.spacex.land/graphql",
"type": "graphql",
"path": "graphql-api",
"protocols": [
"https",
"https"
],
"authenticationSettings": null,
"subscriptionKeyParameterNames": null,
"isCurrent": true,
"isOnline": true
}
}
location: https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/tempgroup?api-version=2022-08-01&asyncId=5c730e343244df1b9cb56e85&asyncCode=201
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/apiid9419",
"type": "Microsoft.ApiManagement/service/apis",
"name": "apiid9419",
"properties": {
"displayName": "apiname1463",
"apiRevision": "1",
"description": "apidescription5200",
"serviceUrl": "https://api.spacex.land/graphql",
"type": "graphql",
"path": "graphql-api",
"protocols": [
"http",
"https"
],
"authenticationSettings": null,
"subscriptionKeyParameterNames": null,
"isCurrent": true,
"isOnline": true
}
}
ApiManagementCreateSoapPassThroughApiUsingWsdlImport
要求のサンプル
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/soapApi?api-version=2022-08-01
{
"properties": {
"format": "wsdl-link",
"value": "http://www.webservicex.net/CurrencyConvertor.asmx?WSDL",
"path": "currency",
"apiType": "soap",
"wsdlSelector": {
"wsdlServiceName": "CurrencyConvertor",
"wsdlEndpointName": "CurrencyConvertorSoap"
}
}
}
import com.azure.resourcemanager.apimanagement.models.ApiCreateOrUpdatePropertiesWsdlSelector;
import com.azure.resourcemanager.apimanagement.models.ContentFormat;
import com.azure.resourcemanager.apimanagement.models.SoapApiType;
/** Samples for Api CreateOrUpdate. */
public final class Main {
/*
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateSoapPassThroughApiUsingWsdlImport.json
*/
/**
* Sample code: ApiManagementCreateSoapPassThroughApiUsingWsdlImport.
*
* @param manager Entry point to ApiManagementManager.
*/
public static void apiManagementCreateSoapPassThroughApiUsingWsdlImport(
com.azure.resourcemanager.apimanagement.ApiManagementManager manager) {
manager
.apis()
.define("soapApi")
.withExistingService("rg1", "apimService1")
.withValue("http://www.webservicex.net/CurrencyConvertor.asmx?WSDL")
.withFormat(ContentFormat.WSDL_LINK)
.withWsdlSelector(
new ApiCreateOrUpdatePropertiesWsdlSelector()
.withWsdlServiceName("CurrencyConvertor")
.withWsdlEndpointName("CurrencyConvertorSoap"))
.withSoapApiType(SoapApiType.SOAP)
.withPath("currency")
.create();
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from typing import Any, IO, Union
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_create_soap_pass_through_api_using_wsdl_import.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.begin_create_or_update(
resource_group_name="rg1",
service_name="apimService1",
api_id="soapApi",
parameters={
"properties": {
"apiType": "soap",
"format": "wsdl-link",
"path": "currency",
"value": "http://www.webservicex.net/CurrencyConvertor.asmx?WSDL",
"wsdlSelector": {"wsdlEndpointName": "CurrencyConvertorSoap", "wsdlServiceName": "CurrencyConvertor"},
}
},
).result()
print(response)
# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateSoapPassThroughApiUsingWsdlImport.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/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateSoapPassThroughApiUsingWsdlImport.json
func ExampleAPIClient_BeginCreateOrUpdate_apiManagementCreateSoapPassThroughApiUsingWsdlImport() {
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)
}
poller, err := clientFactory.NewAPIClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "soapApi", armapimanagement.APICreateOrUpdateParameter{
Properties: &armapimanagement.APICreateOrUpdateProperties{
Path: to.Ptr("currency"),
Format: to.Ptr(armapimanagement.ContentFormatWsdlLink),
SoapAPIType: to.Ptr(armapimanagement.SoapAPITypeSoapPassThrough),
Value: to.Ptr("http://www.webservicex.net/CurrencyConvertor.asmx?WSDL"),
WsdlSelector: &armapimanagement.APICreateOrUpdatePropertiesWsdlSelector{
WsdlEndpointName: to.Ptr("CurrencyConvertorSoap"),
WsdlServiceName: to.Ptr("CurrencyConvertor"),
},
},
}, &armapimanagement.APIClientBeginCreateOrUpdateOptions{IfMatch: nil})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %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("soapApi"),
// Type: to.Ptr("Microsoft.ApiManagement/service/apis"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/soapApi"),
// Properties: &armapimanagement.APIContractProperties{
// APIType: to.Ptr(armapimanagement.APITypeSoap),
// APIRevision: to.Ptr("1"),
// IsCurrent: to.Ptr(true),
// SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{
// Header: to.Ptr("Ocp-Apim-Subscription-Key"),
// Query: to.Ptr("subscription-key"),
// },
// Path: to.Ptr("currency"),
// DisplayName: to.Ptr("CurrencyConvertor"),
// Protocols: []*armapimanagement.Protocol{
// to.Ptr(armapimanagement.ProtocolHTTPS)},
// ServiceURL: to.Ptr("http://www.webservicex.net"),
// },
// }
}
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 Creates new or updates existing specified API of the API Management service instance.
*
* @summary Creates new or updates existing specified API of the API Management service instance.
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateSoapPassThroughApiUsingWsdlImport.json
*/
async function apiManagementCreateSoapPassThroughApiUsingWsdlImport() {
const subscriptionId = process.env["APIMANAGEMENT_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["APIMANAGEMENT_RESOURCE_GROUP"] || "rg1";
const serviceName = "apimService1";
const apiId = "soapApi";
const parameters = {
format: "wsdl-link",
path: "currency",
soapApiType: "soap",
value: "http://www.webservicex.net/CurrencyConvertor.asmx?WSDL",
wsdlSelector: {
wsdlEndpointName: "CurrencyConvertorSoap",
wsdlServiceName: "CurrencyConvertor",
},
};
const credential = new DefaultAzureCredential();
const client = new ApiManagementClient(credential, subscriptionId);
const result = await client.api.beginCreateOrUpdateAndWait(
resourceGroupName,
serviceName,
apiId,
parameters
);
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.ApiManagement.Models;
using Azure.ResourceManager.ApiManagement;
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateSoapPassThroughApiUsingWsdlImport.json
// this example is just showing the usage of "Api_CreateOrUpdate" 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://video2.skills-academy.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 = "soapApi";
ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent()
{
Path = "currency",
Value = "http://www.webservicex.net/CurrencyConvertor.asmx?WSDL",
Format = ContentFormat.WsdlLink,
WsdlSelector = new ApiCreateOrUpdatePropertiesWsdlSelector()
{
WsdlServiceName = "CurrencyConvertor",
WsdlEndpointName = "CurrencyConvertorSoap",
},
SoapApiType = SoapApiType.SoapPassThrough,
};
ArmOperation<ApiResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content);
ApiResource result = lro.Value;
// 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
応答のサンプル
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/soapApi",
"type": "Microsoft.ApiManagement/service/apis",
"name": "soapApi",
"properties": {
"displayName": "CurrencyConvertor",
"apiRevision": "1",
"serviceUrl": "http://www.webservicex.net",
"path": "currency",
"protocols": [
"https"
],
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"type": "soap",
"isCurrent": true
}
}
location: https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/tempgroup?api-version=2022-08-01&asyncId=5c730e343244df1b9cb56e85&asyncCode=201
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/soapApi",
"type": "Microsoft.ApiManagement/service/apis",
"name": "soapApi",
"properties": {
"displayName": "CurrencyConvertor",
"apiRevision": "1",
"serviceUrl": "http://www.webservicex.net",
"path": "currency",
"protocols": [
"https"
],
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"type": "soap",
"isCurrent": true
}
}
ApiManagementCreateSoapToRestApiUsingWsdlImport
要求のサンプル
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/soapApi?api-version=2022-08-01
{
"properties": {
"format": "wsdl-link",
"value": "http://www.webservicex.net/CurrencyConvertor.asmx?WSDL",
"path": "currency",
"wsdlSelector": {
"wsdlServiceName": "CurrencyConvertor",
"wsdlEndpointName": "CurrencyConvertorSoap"
}
}
}
import com.azure.resourcemanager.apimanagement.models.ApiCreateOrUpdatePropertiesWsdlSelector;
import com.azure.resourcemanager.apimanagement.models.ContentFormat;
/** Samples for Api CreateOrUpdate. */
public final class Main {
/*
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateSoapToRestApiUsingWsdlImport.json
*/
/**
* Sample code: ApiManagementCreateSoapToRestApiUsingWsdlImport.
*
* @param manager Entry point to ApiManagementManager.
*/
public static void apiManagementCreateSoapToRestApiUsingWsdlImport(
com.azure.resourcemanager.apimanagement.ApiManagementManager manager) {
manager
.apis()
.define("soapApi")
.withExistingService("rg1", "apimService1")
.withValue("http://www.webservicex.net/CurrencyConvertor.asmx?WSDL")
.withFormat(ContentFormat.WSDL_LINK)
.withWsdlSelector(
new ApiCreateOrUpdatePropertiesWsdlSelector()
.withWsdlServiceName("CurrencyConvertor")
.withWsdlEndpointName("CurrencyConvertorSoap"))
.withPath("currency")
.create();
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from typing import Any, IO, Union
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_create_soap_to_rest_api_using_wsdl_import.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.begin_create_or_update(
resource_group_name="rg1",
service_name="apimService1",
api_id="soapApi",
parameters={
"properties": {
"format": "wsdl-link",
"path": "currency",
"value": "http://www.webservicex.net/CurrencyConvertor.asmx?WSDL",
"wsdlSelector": {"wsdlEndpointName": "CurrencyConvertorSoap", "wsdlServiceName": "CurrencyConvertor"},
}
},
).result()
print(response)
# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateSoapToRestApiUsingWsdlImport.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/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateSoapToRestApiUsingWsdlImport.json
func ExampleAPIClient_BeginCreateOrUpdate_apiManagementCreateSoapToRestApiUsingWsdlImport() {
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)
}
poller, err := clientFactory.NewAPIClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "soapApi", armapimanagement.APICreateOrUpdateParameter{
Properties: &armapimanagement.APICreateOrUpdateProperties{
Path: to.Ptr("currency"),
Format: to.Ptr(armapimanagement.ContentFormatWsdlLink),
Value: to.Ptr("http://www.webservicex.net/CurrencyConvertor.asmx?WSDL"),
WsdlSelector: &armapimanagement.APICreateOrUpdatePropertiesWsdlSelector{
WsdlEndpointName: to.Ptr("CurrencyConvertorSoap"),
WsdlServiceName: to.Ptr("CurrencyConvertor"),
},
},
}, &armapimanagement.APIClientBeginCreateOrUpdateOptions{IfMatch: nil})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %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("soapApi"),
// Type: to.Ptr("Microsoft.ApiManagement/service/apis"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/soapApi"),
// Properties: &armapimanagement.APIContractProperties{
// APIRevision: to.Ptr("1"),
// IsCurrent: to.Ptr(true),
// SubscriptionKeyParameterNames: &armapimanagement.SubscriptionKeyParameterNamesContract{
// Header: to.Ptr("Ocp-Apim-Subscription-Key"),
// Query: to.Ptr("subscription-key"),
// },
// Path: to.Ptr("currency"),
// DisplayName: to.Ptr("CurrencyConvertor"),
// Protocols: []*armapimanagement.Protocol{
// to.Ptr(armapimanagement.ProtocolHTTPS)},
// ServiceURL: to.Ptr("http://www.webservicex.net"),
// },
// }
}
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 Creates new or updates existing specified API of the API Management service instance.
*
* @summary Creates new or updates existing specified API of the API Management service instance.
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateSoapToRestApiUsingWsdlImport.json
*/
async function apiManagementCreateSoapToRestApiUsingWsdlImport() {
const subscriptionId = process.env["APIMANAGEMENT_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["APIMANAGEMENT_RESOURCE_GROUP"] || "rg1";
const serviceName = "apimService1";
const apiId = "soapApi";
const parameters = {
format: "wsdl-link",
path: "currency",
value: "http://www.webservicex.net/CurrencyConvertor.asmx?WSDL",
wsdlSelector: {
wsdlEndpointName: "CurrencyConvertorSoap",
wsdlServiceName: "CurrencyConvertor",
},
};
const credential = new DefaultAzureCredential();
const client = new ApiManagementClient(credential, subscriptionId);
const result = await client.api.beginCreateOrUpdateAndWait(
resourceGroupName,
serviceName,
apiId,
parameters
);
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.ApiManagement.Models;
using Azure.ResourceManager.ApiManagement;
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateSoapToRestApiUsingWsdlImport.json
// this example is just showing the usage of "Api_CreateOrUpdate" 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://video2.skills-academy.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 = "soapApi";
ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent()
{
Path = "currency",
Value = "http://www.webservicex.net/CurrencyConvertor.asmx?WSDL",
Format = ContentFormat.WsdlLink,
WsdlSelector = new ApiCreateOrUpdatePropertiesWsdlSelector()
{
WsdlServiceName = "CurrencyConvertor",
WsdlEndpointName = "CurrencyConvertorSoap",
},
};
ArmOperation<ApiResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content);
ApiResource result = lro.Value;
// 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
応答のサンプル
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/soapApi",
"type": "Microsoft.ApiManagement/service/apis",
"name": "soapApi",
"properties": {
"displayName": "CurrencyConvertor",
"apiRevision": "1",
"serviceUrl": "http://www.webservicex.net",
"path": "currency",
"protocols": [
"https"
],
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"isCurrent": true
}
}
location: https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/tempgroup?api-version=2022-08-01&asyncId=5c730e343244df1b9cb56e85&asyncCode=201
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/soapApi",
"type": "Microsoft.ApiManagement/service/apis",
"name": "soapApi",
"properties": {
"displayName": "CurrencyConvertor",
"apiRevision": "1",
"serviceUrl": "http://www.webservicex.net",
"path": "currency",
"protocols": [
"https"
],
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"isCurrent": true
}
}
ApiManagementCreateWebSocketApi
要求のサンプル
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/tempgroup?api-version=2022-08-01
{
"properties": {
"description": "apidescription5200",
"displayName": "apiname1463",
"type": "websocket",
"serviceUrl": "wss://echo.websocket.org",
"path": "newapiPath",
"protocols": [
"wss",
"ws"
]
}
}
import com.azure.resourcemanager.apimanagement.models.ApiType;
import com.azure.resourcemanager.apimanagement.models.Protocol;
import java.util.Arrays;
/** Samples for Api CreateOrUpdate. */
public final class Main {
/*
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateWebsocketApi.json
*/
/**
* Sample code: ApiManagementCreateWebSocketApi.
*
* @param manager Entry point to ApiManagementManager.
*/
public static void apiManagementCreateWebSocketApi(
com.azure.resourcemanager.apimanagement.ApiManagementManager manager) {
manager
.apis()
.define("tempgroup")
.withExistingService("rg1", "apimService1")
.withDisplayName("apiname1463")
.withServiceUrl("wss://echo.websocket.org")
.withPath("newapiPath")
.withProtocols(Arrays.asList(Protocol.WSS, Protocol.WS))
.withDescription("apidescription5200")
.withApiType(ApiType.WEBSOCKET)
.create();
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from typing import Any, IO, Union
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_create_websocket_api.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.begin_create_or_update(
resource_group_name="rg1",
service_name="apimService1",
api_id="tempgroup",
parameters={
"properties": {
"description": "apidescription5200",
"displayName": "apiname1463",
"path": "newapiPath",
"protocols": ["wss", "ws"],
"serviceUrl": "wss://echo.websocket.org",
"type": "websocket",
}
},
).result()
print(response)
# x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateWebsocketApi.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/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateWebsocketApi.json
func ExampleAPIClient_BeginCreateOrUpdate_apiManagementCreateWebSocketApi() {
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)
}
poller, err := clientFactory.NewAPIClient().BeginCreateOrUpdate(ctx, "rg1", "apimService1", "tempgroup", armapimanagement.APICreateOrUpdateParameter{
Properties: &armapimanagement.APICreateOrUpdateProperties{
APIType: to.Ptr(armapimanagement.APITypeWebsocket),
Description: to.Ptr("apidescription5200"),
Path: to.Ptr("newapiPath"),
DisplayName: to.Ptr("apiname1463"),
Protocols: []*armapimanagement.Protocol{
to.Ptr(armapimanagement.ProtocolWss),
to.Ptr(armapimanagement.ProtocolWs)},
ServiceURL: to.Ptr("wss://echo.websocket.org"),
},
}, &armapimanagement.APIClientBeginCreateOrUpdateOptions{IfMatch: nil})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %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("apiid9419"),
// Type: to.Ptr("Microsoft.ApiManagement/service/apis"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/apiid9419"),
// Properties: &armapimanagement.APIContractProperties{
// APIType: to.Ptr(armapimanagement.APITypeWebsocket),
// Description: to.Ptr("apidescription5200"),
// APIRevision: to.Ptr("1"),
// IsCurrent: to.Ptr(true),
// IsOnline: to.Ptr(true),
// Path: to.Ptr("newapiPath"),
// DisplayName: to.Ptr("apiname1463"),
// Protocols: []*armapimanagement.Protocol{
// to.Ptr(armapimanagement.ProtocolWs),
// to.Ptr(armapimanagement.ProtocolWss)},
// ServiceURL: to.Ptr("wss://echo.websocket.org"),
// },
// }
}
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 Creates new or updates existing specified API of the API Management service instance.
*
* @summary Creates new or updates existing specified API of the API Management service instance.
* x-ms-original-file: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateWebsocketApi.json
*/
async function apiManagementCreateWebSocketApi() {
const subscriptionId = process.env["APIMANAGEMENT_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["APIMANAGEMENT_RESOURCE_GROUP"] || "rg1";
const serviceName = "apimService1";
const apiId = "tempgroup";
const parameters = {
apiType: "websocket",
path: "newapiPath",
description: "apidescription5200",
displayName: "apiname1463",
protocols: ["wss", "ws"],
serviceUrl: "wss://echo.websocket.org",
};
const credential = new DefaultAzureCredential();
const client = new ApiManagementClient(credential, subscriptionId);
const result = await client.api.beginCreateOrUpdateAndWait(
resourceGroupName,
serviceName,
apiId,
parameters
);
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.ApiManagement.Models;
using Azure.ResourceManager.ApiManagement;
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2022-08-01/examples/ApiManagementCreateWebsocketApi.json
// this example is just showing the usage of "Api_CreateOrUpdate" 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://video2.skills-academy.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 = "tempgroup";
ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent()
{
Description = "apidescription5200",
ApiType = ApiType.WebSocket,
DisplayName = "apiname1463",
ServiceLink = "wss://echo.websocket.org",
Path = "newapiPath",
Protocols =
{
ApiOperationInvokableProtocol.Wss,ApiOperationInvokableProtocol.Ws
},
};
ArmOperation<ApiResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content);
ApiResource result = lro.Value;
// 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
応答のサンプル
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/apiid9419",
"type": "Microsoft.ApiManagement/service/apis",
"name": "apiid9419",
"properties": {
"displayName": "apiname1463",
"apiRevision": "1",
"description": "apidescription5200",
"serviceUrl": "wss://echo.websocket.org",
"type": "websocket",
"path": "newapiPath",
"protocols": [
"ws",
"wss"
],
"authenticationSettings": null,
"subscriptionKeyParameterNames": null,
"isCurrent": true,
"isOnline": true
}
}
location: https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/tempgroup?api-version=2022-08-01&asyncId=5c730e343244df1b9cb56e85&asyncCode=201
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/apiid9419",
"type": "Microsoft.ApiManagement/service/apis",
"name": "apiid9419",
"properties": {
"displayName": "apiname1463",
"apiRevision": "1",
"description": "apidescription5200",
"serviceUrl": "wss://echo.websocket.org",
"type": "websocket",
"path": "newapiPath",
"protocols": [
"ws",
"wss"
],
"authenticationSettings": null,
"subscriptionKeyParameterNames": null,
"isCurrent": true,
"isOnline": true
}
}
定義
API の連絡先情報
名前 |
型 |
説明 |
email
|
string
|
連絡先/organizationのメール アドレス。 電子メール アドレスの形式にする必要があります
|
name
|
string
|
連絡先/organizationの識別名
|
url
|
string
|
連絡先情報を指す URL。 URL の形式にする必要があります
|
ApiContract
API の詳細。
名前 |
型 |
説明 |
id
|
string
|
リソースの完全修飾リソース ID。 例 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
name
|
string
|
リソースの名前
|
properties.apiRevision
|
string
|
API のリビジョンについて説明します。 値が指定されていない場合、既定のリビジョン 1 が作成されます
|
properties.apiRevisionDescription
|
string
|
API リビジョンの説明。
|
properties.apiVersion
|
string
|
API がバージョン管理されている場合の API のバージョン識別子を示します
|
properties.apiVersionDescription
|
string
|
API バージョンの説明。
|
properties.apiVersionSet
|
ApiVersionSetContractDetails
|
バージョン セットの詳細
|
properties.apiVersionSetId
|
string
|
関連する ApiVersionSet のリソース識別子。
|
properties.authenticationSettings
|
AuthenticationSettingsContract
|
この API に含まれる認証設定のコレクション。
|
properties.contact
|
ApiContactInformation
|
API の連絡先情報。
|
properties.description
|
string
|
API の説明。 HTML 書式設定タグを含めることができます。
|
properties.displayName
|
string
|
API 名。 1 から 300 文字の長さにする必要があります。
|
properties.isCurrent
|
boolean
|
API リビジョンが現在の API リビジョンであるかどうかを示します。
|
properties.isOnline
|
boolean
|
API リビジョンにゲートウェイ経由でアクセスできるかどうかを示します。
|
properties.license
|
ApiLicenseInformation
|
API のライセンス情報。
|
properties.path
|
string
|
API Management サービス インスタンス内のこの API とそのすべてのリソース パスを一意に識別する相対 URL。 この API のパブリック URL を作成するために、サービス インスタンスの作成時に指定された API エンドポイントのベース URL に追加されます。
|
properties.protocols
|
Protocol[]
|
この API の操作を呼び出すことができるプロトコルを記述します。
|
properties.serviceUrl
|
string
|
この API を実装するバックエンド サービスの絶対 URL。 2,000 文字を超えることはできません。
|
properties.sourceApiId
|
string
|
ソース API の API 識別子。
|
properties.subscriptionKeyParameterNames
|
SubscriptionKeyParameterNamesContract
|
API を使用できるようにするプロトコル。
|
properties.subscriptionRequired
|
boolean
|
API にアクセスするために API または製品サブスクリプションが必要かどうかを指定します。
|
properties.termsOfServiceUrl
|
string
|
API のサービス利用規約への URL。 URL の形式にする必要があります。
|
properties.type
|
ApiType
|
API の種類。
|
type
|
string
|
リソースの型。 例: "Microsoft.Compute/virtualMachines" または "Microsoft.Storage/storageAccounts"
|
ApiCreateOrUpdateParameter
API の作成またはパラメーターの更新。
名前 |
型 |
説明 |
apiRevision
|
string
|
API のリビジョンについて説明します。 値が指定されていない場合、既定のリビジョン 1 が作成されます
|
apiRevisionDescription
|
string
|
API リビジョンの説明。
|
apiVersion
|
string
|
API がバージョン管理されている場合の API のバージョン識別子を示します
|
apiVersionDescription
|
string
|
API バージョンの説明。
|
apiVersionSetId
|
string
|
関連する ApiVersionSet のリソース識別子。
|
authenticationSettings
|
AuthenticationSettingsContract
|
この API に含まれる認証設定のコレクション。
|
contact
|
ApiContactInformation
|
API の連絡先情報。
|
description
|
string
|
API の説明。 HTML 書式設定タグを含めることができます。
|
isCurrent
|
boolean
|
API リビジョンが現在の API リビジョンであるかどうかを示します。
|
isOnline
|
boolean
|
API リビジョンにゲートウェイ経由でアクセスできるかどうかを示します。
|
license
|
ApiLicenseInformation
|
API のライセンス情報。
|
properties.apiType
|
SoapApiType
|
作成する API の種類。
-
http REST API を作成する
-
soap SOAP パススルー API を作成する
-
websocket websocket API を作成する
-
graphql は API GraphQL作成します。
|
properties.apiVersionSet
|
ApiVersionSetContractDetails
|
バージョン セットの詳細
|
properties.displayName
|
string
|
API 名。 1 から 300 文字の長さにする必要があります。
|
properties.format
|
ContentFormat
|
API がインポートされるコンテンツの形式。
|
properties.path
|
string
|
API Management サービス インスタンス内のこの API とそのすべてのリソース パスを一意に識別する相対 URL。 この API のパブリック URL を作成するために、サービス インスタンスの作成時に指定された API エンドポイントのベース URL に追加されます。
|
properties.protocols
|
Protocol[]
|
この API の操作を呼び出すことができるプロトコルを記述します。
|
properties.serviceUrl
|
string
|
この API を実装するバックエンド サービスの絶対 URL。 2,000 文字を超えることはできません。
|
properties.sourceApiId
|
string
|
ソース API の API 識別子。
|
properties.translateRequiredQueryParameters
|
TranslateRequiredQueryParametersConduct
|
必要なクエリ パラメーターをテンプレートに変換する戦略。 既定では、値は 'template' です。 使用可能な値: 'template'、'query'
|
properties.value
|
string
|
API のインポート時のコンテンツ値。
|
properties.wsdlSelector
|
WsdlSelector
|
WSDL のインポートをドキュメントのサブセットに制限する条件。
|
subscriptionKeyParameterNames
|
SubscriptionKeyParameterNamesContract
|
API を使用できるようにするプロトコル。
|
subscriptionRequired
|
boolean
|
API にアクセスするために API サブスクリプションと Product サブスクリプションのどちらを必要とするかを指定します。
|
termsOfServiceUrl
|
string
|
API の利用規約への URL。 URL の形式にする必要があります。
|
type
|
ApiType
|
API の種類。
|
API ライセンス情報
名前 |
型 |
説明 |
name
|
string
|
API に使用されるライセンス名
|
url
|
string
|
API に使用されるライセンスの URL。 URL の形式にする必要があります
|
ApiType
API の種類。
名前 |
型 |
説明 |
graphql
|
string
|
|
http
|
string
|
|
soap
|
string
|
|
websocket
|
string
|
|
ApiVersionSetContractDetails
API バージョン セットには、関連する一連の API バージョンの共通構成が含まれています
名前 |
型 |
説明 |
description
|
string
|
API バージョン セットの説明。
|
id
|
string
|
既存の API バージョン セットの識別子。 新しいバージョン セットを作成するには、この値を省略します。
|
name
|
string
|
API バージョン セットの表示名。
|
versionHeaderName
|
string
|
versioningScheme が に header 設定されている場合に API バージョンを示す HTTP ヘッダー パラメーターの名前。
|
versionQueryName
|
string
|
versioningScheme が に query 設定されている場合に API バージョンを示すクエリ パラメーターの名前。
|
versioningScheme
|
versioningScheme
|
API バージョン識別子が HTTP 要求内のどこに配置されるのかを決定する値。
|
AuthenticationSettingsContract
API 認証の設定。
bearerTokenSendingMethods
サーバーにトークンを送信する方法。
名前 |
型 |
説明 |
authorizationHeader
|
string
|
アクセス トークンは、Bearer スキーマを使用して Authorization ヘッダーで送信されます
|
query
|
string
|
アクセス トークンはクエリ パラメーターとして送信されます。
|
ContentFormat
API がインポートされるコンテンツの形式。
名前 |
型 |
説明 |
graphql-link
|
string
|
パブリックにアクセス可能なインターネット アドレスでホストされている GraphQL API エンドポイント。
|
openapi
|
string
|
コンテンツはインラインであり、コンテンツ タイプは OpenAPI 3.0 YAML ドキュメントです。
|
openapi+json
|
string
|
コンテンツはインラインであり、コンテンツ タイプは OpenAPI 3.0 JSON ドキュメントです。
|
openapi+json-link
|
string
|
OpenAPI 3.0 JSON ドキュメントは、パブリックにアクセスできるインターネット アドレスでホストされています。
|
openapi-link
|
string
|
OpenAPI 3.0 YAML ドキュメントは、パブリックにアクセスできるインターネット アドレスでホストされています。
|
swagger-json
|
string
|
コンテンツはインラインであり、コンテンツ タイプは OpenAPI 2.0 JSON ドキュメントです。
|
swagger-link-json
|
string
|
OpenAPI 2.0 JSON ドキュメントは、パブリックにアクセスできるインターネット アドレスでホストされています。
|
wadl-link-json
|
string
|
WADL ドキュメントは、パブリックにアクセス可能なインターネット アドレスでホストされます。
|
wadl-xml
|
string
|
コンテンツはインラインで、コンテンツ タイプは WADL ドキュメントです。
|
wsdl
|
string
|
内容はインラインで、ドキュメントは WSDL/Soap ドキュメントです。
|
wsdl-link
|
string
|
WSDL ドキュメントは、パブリックにアクセス可能なインターネット アドレスでホストされます。
|
ErrorFieldContract
エラー フィールド コントラクト。
名前 |
型 |
説明 |
code
|
string
|
プロパティ レベルのエラー コード。
|
message
|
string
|
プロパティ レベルエラーの人間が判読できる表現。
|
target
|
string
|
プロパティ名。
|
ErrorResponse
エラー応答。
名前 |
型 |
説明 |
error.code
|
string
|
サービスによって定義されたエラー コード。 このコードは、応答に指定された HTTP エラー コードのサブステータスとして機能します。
|
error.details
|
ErrorFieldContract[]
|
検証エラーが発生した場合に要求で送信される無効なフィールドの一覧。
|
error.message
|
string
|
人が判読できるエラーの表現。
|
OAuth2AuthenticationSettingsContract
API OAuth2 認証設定の詳細。
名前 |
型 |
説明 |
authorizationServerId
|
string
|
OAuth 承認サーバーの識別子。
|
scope
|
string
|
操作スコープ。
|
OpenIdAuthenticationSettingsContract
API OAuth2 認証設定の詳細。
Protocol
この API の操作を呼び出すことができるプロトコルを記述します。
名前 |
型 |
説明 |
http
|
string
|
|
https
|
string
|
|
ws
|
string
|
|
wss
|
string
|
|
SoapApiType
作成する API の種類。
-
http
REST API を作成する
-
soap
SOAP パススルー API を作成する
-
websocket
websocket API を作成します
-
graphql
は API GraphQL作成します。
名前 |
型 |
説明 |
graphql
|
string
|
GraphQL フロントエンドを持つ API をインポートします。
|
http
|
string
|
RESTful フロントエンドを持つ SOAP API をインポートします。
|
soap
|
string
|
SOAP フロントエンドを持つ SOAP API をインポートします。
|
websocket
|
string
|
Websocket フロントエンドを持つ API をインポートします。
|
SubscriptionKeyParameterNamesContract
サブスクリプション キー パラメーター名の詳細。
名前 |
型 |
説明 |
header
|
string
|
サブスクリプション キー ヘッダー名。
|
query
|
string
|
サブスクリプション キー クエリ文字列パラメーター名。
|
TranslateRequiredQueryParametersConduct
必要なクエリ パラメーターをテンプレートに変換する戦略。 既定では、値 'template' があります。 使用可能な値: 'template'、'query'
名前 |
型 |
説明 |
query
|
string
|
必要なクエリ パラメーターをそのまま残します (翻訳は行われません)。
|
template
|
string
|
必要なクエリ パラメーターをテンプレートパラメーターに変換します。 既定値です
|
versioningScheme
HTTP 要求内の API バージョン識別子の場所を決定する値。
名前 |
型 |
説明 |
Header
|
string
|
API バージョンは HTTP ヘッダーで渡されます。
|
Query
|
string
|
API バージョンはクエリ パラメーターで渡されます。
|
Segment
|
string
|
API バージョンはパス セグメントで渡されます。
|
WsdlSelector
WSDL のインポートをドキュメントのサブセットに制限する条件。
名前 |
型 |
説明 |
wsdlEndpointName
|
string
|
WSDL からインポートするエンドポイント (ポート) の名前
|
wsdlServiceName
|
string
|
WSDL からインポートするサービスの名前
|