AppSync:PowerShellを使用してAppSyncサーバーに接続するREST APIスクリプトを作成する方法
Summary: このKBの目的は、AppSyncサーバーに接続し、XML出力をファイルとして返す方法を示すサンプルPowershell REST APIスクリプトを提供することです。
This article applies to
This article does not apply to
This article is not tied to any specific product.
Not all product versions are identified in this article.
Instructions
次のスクリプトを使用すると、任意のAppSyncサーバーに接続し、サーバー上に作成されたすべてのサービス プランに関する詳細を返すことができます。これは簡略化された例であり、各ユーザー固有の要件に合わせて変更する必要があります。
add-type @"
を使用して System.Net;
using System.Security.Cryptography.X509Certificates;
パブリッククラスTrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@
#Get ログイン クレドとターゲット サーバー
$user = Read-Host 'AppSync管理者ユーザーIDを入力します'
$pass = Read-Host 'AppSync管理者パスワードを入力します'
$ashost = Read-Host 'AppSyncサーバーの名前またはIPアドレスを入力します'
#create Login URL
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
[文字列] $loginuri = "https://"+ $ashost + ":8444/cas-server/login"
$request = Invoke-WebRequest -Uri $loginuri -SessionVariable session
#Login を CAS サーバーに送信します
$form = $request。フォーム[0]
$form.Fields["ユーザー名"] = $user
$form。Fields["password"] = $pass
[string] $loginuri = "https://"+ $ashost + ":8444/cas-server/login" + $form。アクション
$request = Invoke-WebRequest -Uri $loginuri -SessionVariable session -Body $form。フィールド
#Execute Rest request
$url= "https://"+ $ashost + ":8445/appsync/rest/types/servicePlan/instances"
$restrequest = Invoke-RestMethod -method GET -Uri $url -WebSession $session -outfile .\output1.xml
add-type @"
を使用して System.Net;
using System.Security.Cryptography.X509Certificates;
パブリッククラスTrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@
#Get ログイン クレドとターゲット サーバー
$user = Read-Host 'AppSync管理者ユーザーIDを入力します'
$pass = Read-Host 'AppSync管理者パスワードを入力します'
$ashost = Read-Host 'AppSyncサーバーの名前またはIPアドレスを入力します'
#create Login URL
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
[文字列] $loginuri = "https://"+ $ashost + ":8444/cas-server/login"
$request = Invoke-WebRequest -Uri $loginuri -SessionVariable session
#Login を CAS サーバーに送信します
$form = $request。フォーム[0]
$form.Fields["ユーザー名"] = $user
$form。Fields["password"] = $pass
[string] $loginuri = "https://"+ $ashost + ":8444/cas-server/login" + $form。アクション
$request = Invoke-WebRequest -Uri $loginuri -SessionVariable session -Body $form。フィールド
#Execute Rest request
$url= "https://"+ $ashost + ":8445/appsync/rest/types/servicePlan/instances"
$restrequest = Invoke-RestMethod -method GET -Uri $url -WebSession $session -outfile .\output1.xml
Affected Products
AppSyncProducts
AppSyncArticle Properties
Article Number: 000158365
Article Type: How To
Last Modified: 18 Sept 2025
Version: 5
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.