AppSync: Powershell kullanarak bir AppSync sunucusuna bağlanmak için REST API komut dosyası oluşturma
Resumo: Bu KB'nin amacı, AppSync sunucusuna nasıl bağlanılacağını ve XML çıktısının bir dosya olarak nasıl döndürüleceğini gösteren örnek bir Powershell REST api betiği sağlamaktır.
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
Aşağıdaki komut dosyası, herhangi bir AppSync sunucusuna bağlanmak ve sunucuda oluşturulan tüm Servis Planlarıyla ilgili ayrıntıları döndürmek için kullanılabilir. Bu basitleştirilmiş bir örnektir ve her kullanıcının özel gereksinimlerine uyacak şekilde değiştirilmelidir.
add-type @"
kullanarak System.Net;
System.Security.Cryptography.X509Certificates kullanarak;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate sertifikası,
WebRequest isteği, 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
[dize] $loginuri = "https://" + $ashost + ":8444/cas-server/login"
$request = Invoke-WebRequest -Uri $loginuri -SessionVariable session
#Login öğesini CAS sunucusuna
$form = $request. Formlar[0]
$form. Alanlar["kullanıcı adı"] = $user
$form. Fields["password"] = $pass
[string] $loginuri = "https://" + $ashost + ":8444/cas-server/login"+ $form. Action
$request = Invoke-WebRequest -Uri $loginuri -SessionVariable session -Body $form. Alanları
#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 @"
kullanarak System.Net;
System.Security.Cryptography.X509Certificates kullanarak;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate sertifikası,
WebRequest isteği, 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
[dize] $loginuri = "https://" + $ashost + ":8444/cas-server/login"
$request = Invoke-WebRequest -Uri $loginuri -SessionVariable session
#Login öğesini CAS sunucusuna
$form = $request. Formlar[0]
$form. Alanlar["kullanıcı adı"] = $user
$form. Fields["password"] = $pass
[string] $loginuri = "https://" + $ashost + ":8444/cas-server/login"+ $form. Action
$request = Invoke-WebRequest -Uri $loginuri -SessionVariable session -Body $form. Alanları
#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
AppSyncProdutos
AppSyncPropriedades 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.