How To Invoke An AppPortal API With Powershell

How To Invoke An AppPortal API With Powershell

Summary

Api's such as those found at: http:///esd/api.asmx can be executed from Powershell.

Synopsis

This article discusses how to invoke an AppPortal API with Powershell.

Discussion

Api's such as those found at: http://<AppPortal Server>/esd/api.asmx can be executed from Powershell.

For this example we will look at the following API: RemoveDeploymentForACatalogItem

When you click on the API it will bring up an information page for that API.  Find the HTTP POST section on the API's information page. In this section, it should display the parameters for the API.  For  the RemoveDeploymentForACatalogItem API  in the HTTP POST section is,

Title=string

This lets us know that a parameter named "Title" is needed and it is a parameter of type string.

An example .ps1 script is:

$username = "<domain\user>"
$password = "<PASSWORD>" | ConvertTo-SecureString -asPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential($username,$password)

$postParams = @{Title='<Catalog Item Title>'}
Invoke-WebRequest -uri "http://localhost/esd/api.asmx/RemoveDeploymentForACatalogItem" -Method POST -Credential $cred -Body $postparams -ContentType 'application/x-www-form-urlencoded'

$username, $password, and $postParams will need to be set (after the 😃 with your information.

Labels (1)
Was this article helpful? Yes No
No ratings
Version history
Last update:
‎Aug 25, 2020 09:23 AM
Updated by: