AppSync:如何使用 Powershell 创建 REST API 脚本以连接到 AppSync 服务器

Resumo: 本知识库文章的目的是提供一个示例 Powershell REST API 脚本,该脚本演示如何连接到 AppSync 服务器并将 XML 输出作为文件返回。

Este artigo aplica-se a Este artigo não se aplica a Este artigo não está vinculado a nenhum produto específico. Nem todas as versões do produto estão identificadas neste artigo.

Instruções

以下脚本可用于连接到任何 AppSync 服务器,并返回与在服务器上创建的所有服务计划相关的详细信息。这是一个简化的示例,应进行修改以满足每个用户的特定要求。

add-type @“
使用 System.Net;
   使用 System.Security.Cryptography.X509Certificates;
   公共类 TrustAllCertsPolicy :ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
       }
}
“@

#Get Login creds and target server

$user = Read-Host 'Enter the Appsync Administrator User Id'
$pass = Read-Host 'Enter the Appsync Administrator Password'
$ashost = Read-Host 'Enter the name or IP address of the Appsync Server'


#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[“username”] = $user
$form.Fields[“password”] = $pass

[string] $loginuri = “https://”    + $ashost + “:8444/cas-server/login”+ $form。Action
 
$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
 

Produtos afetados

AppSync

Produtos

AppSync
Propriedades do artigo
Número do artigo: 000158365
Tipo de artigo: How To
Último modificado: 18 set. 2025
Versão:  5
Encontre as respostas de outros usuários da Dell para suas perguntas.
Serviços de suporte
Verifique se o dispositivo está coberto pelos serviços de suporte.