Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
Import-AzApiManagementApi
- Module:
- Az.ApiManagement Module
Imports an API from a file or a URL.
Syntax
ImportFromLocalFile (Default)
Import-AzApiManagementApi
-Context <PsApiManagementContext>
-SpecificationFormat <PsApiManagementApiFormat>
-SpecificationPath <String>
[-ApiId <String>]
[-ApiRevision <String>]
[-Path <String>]
[-WsdlServiceName <String>]
[-WsdlEndpointName <String>]
[-ApiType <PsApiManagementApiType>]
[-Protocol <PsApiManagementSchema[]>]
[-ServiceUrl <String>]
[-ApiVersionSetId <String>]
[-ApiVersion <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ImportFromUrl
Import-AzApiManagementApi
-Context <PsApiManagementContext>
-SpecificationFormat <PsApiManagementApiFormat>
-SpecificationUrl <String>
[-ApiId <String>]
[-ApiRevision <String>]
[-Path <String>]
[-WsdlServiceName <String>]
[-WsdlEndpointName <String>]
[-ApiType <PsApiManagementApiType>]
[-Protocol <PsApiManagementSchema[]>]
[-ServiceUrl <String>]
[-ApiVersionSetId <String>]
[-ApiVersion <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
The Import-AzApiManagementApi cmdlet imports an Azure API Management API from a file or a URL in Web Application Description Language (WADL), Web Services Description Language (WSDL), or Swagger format.
Examples
Example 1: Import an API from a WADL file
$ApiMgmtContext = New-AzApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
Import-AzApiManagementApi -Context $ApiMgmtContext -SpecificationFormat "Wadl" -SpecificationPath "C:\contoso\specifications\echoapi.wadl" -Path "apis"
This command imports an API from the specified WADL file.
Example 2: Import an API from a Swagger file
$ApiMgmtContext = New-AzApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
Import-AzApiManagementApi -Context $ApiMgmtContext -SpecificationFormat "Swagger" -SpecificationPath "C:\contoso\specifications\echoapi.swagger" -Path "apis"
This command imports an API from the specified Swagger file.
Example 3: Import an API from a Swagger file and update an existing API
$ApiMgmtContext = New-AzApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
Import-AzApiManagementApi -Context $ApiMgmtContext -ApiId "26591405e27d4ff3a8d8478d7e60c7b0" -SpecificationFormat "Swagger" -SpecificationPath "C:\contoso\specifications\echoapi.swagger" -Path "apis"
This command imports an API from the specified Swagger file and updates an existing API.
Example 4: Import an API from a WADL link
$ApiMgmtContext = New-AzApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
Import-AzApiManagementApi -Context $ApiMgmtContext -SpecificationFormat "Wadl" -SpecificationUrl "http://contoso.com/specifications/wadl/echoapi" -Path "apis"
This command imports an API from the specified WADL link.
Example 5: Import an API from a Open Api Link
$context = New-AzApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
Import-AzApiManagementApi -Context $context -SpecificationFormat OpenApi -SpecificationUrl https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml -Path "petstore30"
ApiId : af3f57bab399455aa875d7050654e9d1
Name : Swagger Petstore
Description :
ServiceUrl : http://petstore.swagger.io/v1
Path : petstore30
ApiType : http
Protocols : {Https}
AuthorizationServerId :
AuthorizationScope :
OpenidProviderId :
BearerTokenSendingMethod : {}
SubscriptionKeyHeaderName : Ocp-Apim-Subscription-Key
SubscriptionKeyQueryParamName : subscription-key
ApiRevision : 1
ApiVersion :
IsCurrent : True
IsOnline : False
SubscriptionRequired :
ApiRevisionDescription :
ApiVersionSetDescription :
ApiVersionSetId :
Id : /subscriptions/subid/resourceGroups/Api-Default-West-US/providers/Microsoft.ApiManagement/service/contoso/apis/af3f57bab399455aa875d7050654e9d1
ResourceGroupName : Api-Default-West-US
ServiceName : contoso
This command imports an API from the specified Open 3.0 specification link.
Example 6: Import an API from a Open Api Link into a ApiVersion Set
$context = New-AzApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
Import-AzApiManagementApi -Context $context -SpecificationPath "C:\contoso\specifications\uspto.yml" -SpecificationFormat OpenApi -Path uspostal -ApiVersionSetId 0d50e2cf-aaeb-4ea3-8a58-db9ec079c6cd -ApiVersion v2
ApiId : 6c3f20c66e5745b19229d06cd865948f
Name : USPTO Data Set API
Description : The Data Set API (DSAPI) allows the public users to discover and search USPTO exported data sets. This is a generic API that allows USPTO users to make any CSV based data files
searchable through API. With the help of GET call, it returns the list of data fields that are searchable. With the help of POST call, data can be fetched based on the filters on the
field names. Please note that POST call is used to search the actual data. The reason for the POST call is that it allows users to specify any complex search criteria without worry
about the GET size limitations as well as encoding of the input parameters.
ServiceUrl : https://developer.uspto.gov/ds-api
Path : uspostal
ApiType : http
Protocols : {Https}
AuthorizationServerId :
AuthorizationScope :
OpenidProviderId :
BearerTokenSendingMethod : {}
SubscriptionKeyHeaderName : Ocp-Apim-Subscription-Key
SubscriptionKeyQueryParamName : subscription-key
ApiRevision : 1
ApiVersion : v2
IsCurrent : True
IsOnline : False
SubscriptionRequired :
ApiRevisionDescription :
ApiVersionSetDescription :
ApiVersionSetId : /subscriptions/subid/resourceGroups/Api-Default-East-US/providers/Microsoft.ApiManagement/service/contoso/apiVersionSets/0d50e2cf-aaeb-4ea3-8a58-db9ec079c6cd
Id : /subscriptions/subid/resourceGroups/Api-Default-East-US/providers/Microsoft.ApiManagement/service/contoso/apis/6c3f20c66e5745b19229d06cd865948f
ResourceGroupName : Api-Default-East-US
ServiceName : contoso
This command imports an API from the specified Open 3.0 specification document and create a new ApiVersion.
Example 7: Import an API from a GraphQL link
$ApiMgmtContext = New-AzApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
Import-AzApiManagementApi -Context $ApiMgmtContext -SpecificationFormat "GraphQL" -SpecificationUrl "http://contoso.com/graphql" -Path "graphqlapi"
ApiId : bg4g23csd067432zz853f0942341g3z1
Name : GraphQL Api
Description :
ServiceUrl : http://contoso.com/graphql
Path : graphqlapi
ApiType : graphql
Protocols : {Https}
AuthorizationServerId :
AuthorizationScope :
OpenidProviderId :
BearerTokenSendingMethod : {}
SubscriptionKeyHeaderName : Ocp-Apim-Subscription-Key
SubscriptionKeyQueryParamName : subscription-key
ApiRevision : 1
ApiVersion :
IsCurrent : True
IsOnline : False
SubscriptionRequired :
ApiRevisionDescription :
ApiVersionSetDescription :
ApiVersionSetId :
Id : /subscriptions/subid/resourceGroups/Api-Default-West-US/providers/Microsoft.ApiManagement/service/contoso/apis/bg4g23csd067432zz853f0942341g3z1
ResourceGroupName : Api-Default-West-US
ServiceName : contoso
This command imports an API from the GraphQL link.
Parameters
-ApiId
Specifies an ID for the API to import. If you do not specify this parameter, an ID is generated for you.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ApiRevision
Identifier of API Revision. This parameter is optional. If not specified, the import will be done onto the currently active revision or a new api.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ApiType
This parameter is optional with a default value of Http. The Soap option is only applicable when importing WSDL and will create a SOAP Passthrough API.
Parameter properties
| Type: | |
| Default value: | None |
| Accepted values: | Http, Soap, WebSocket, GraphQL |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ApiVersion
Api Version of the Api to create. This parameter is optional.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ApiVersionSetId
A resource identifier for the related Api Version Set. This parameter is optional.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Context
Specifies a PsApiManagementContext object.
Parameter properties
| Type: | PsApiManagementContext |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure.
Parameter properties
| Type: | IAzureContextContainer |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | AzContext, AzureRmContext, AzureCredential |
Parameter sets
-Path
Specifies a web API path as the last part of the API's public URL. This URL is used by API consumers for sending requests to the web service. Must be 1 to 400 characters long. The default value is $Null.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Protocol
Web API protocols (http, https). Protocols over which API is made available. This parameter is optional. If provided it will override the protocols specified in the specifications document.
Parameter properties
| Type: | |
| Default value: | None |
| Accepted values: | Http, Https, Ws, Wss |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ServiceUrl
A URL of the web service exposing the API. This URL will be used by Azure API Management only, and will not be made public. This parameter is optional. If provided it will override the ServiceUrl specified in the Specifications document.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-SpecificationFormat
Specifies the specification format. psdx_paramvalues Wadl, Wsdl, and Swagger.
Parameter properties
| Type: | PsApiManagementApiFormat |
| Default value: | None |
| Accepted values: | Wadl, Swagger, Wsdl, OpenApi, OpenApiJson, GraphQL |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-SpecificationPath
Specifies the specification file path.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-SpecificationUrl
Specifies the specification URL.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-WsdlEndpointName
Local name of WSDL Endpoint (port) to be imported. Must be 1 to 400 characters long. This parameter is optional and only required for importing Wsdl. Default value is $null.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-WsdlServiceName
Local name of WSDL Service to be imported. Must be 1 to 400 characters long. This parameter is optional and only required for importing Wsdl . Default value is $null.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs
PsApiManagementContext
String
PsApiManagementApiFormat
Nullable<T>
Outputs
PsApiManagementApi
Related Links
Azure PowerShell
Feedback
Was this page helpful?
