Created
November 27, 2015 15:47
-
-
Save jvanderbiest/fd716d3a05ed9f396aa5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param([string]$link, [string]$sas, [string]$tenantName) | |
Start-Sleep -s 15 | |
$contentType = "application/vnd.swagger.link+json" | |
$apiId = $sas.substring($sas.indexOf("uid=") + 4); | |
$apiId = $apiId.substring(0, $apiId.indexOf("&ex=")); | |
$apiUri = "https://$tenantName.management.azure-api.net/apis/{0}?api-version=2014-02-14-preview&import=true" -f $apiId | |
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]" | |
$headers.Add("Authorization", "$sas") | |
$headers.Add("If-Match", '*') | |
$payload = @{ link=$link } | |
$json = $payload | ConvertTo-Json | |
Write-Host "Deploying Swagger ($link) to Management API ($apiUri)" | |
$response = Invoke-RestMethod -Uri $apiUri -Method Put -ContentType $contentType -Body $json -Headers $headers |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment