Forum Discussion

Monty_Sinha_229's avatar
Monty_Sinha_229
Icon for Nimbostratus rankNimbostratus
Jan 18, 2017

Using Powershell to create an iApp Service

HI All,

Long time user first time poster 🙂

I am currently tryinbg to use the REST API to automate the creatation of iApps for a project we are working on.

We are trying to create a basic vServer with one pool on port 80 with no profiles, and creating this under an Application Service. using the predefied iApp http template.

I am trying to use Powershell to do this, and using the PS Module that is up on GitHub (https://github.com/joel74/POSH-LTM-Rest) as the basis for my script. I have been able to run a GET and get the JSON of an existing Application Service, and changing the parameters and doing a POST it is failing with the below error

    Invoke-RestMethodOverride : "400 Bad Request: "name" unexpected argument
At line:1 char:7
+       Invoke-RestMethodOverride -Method POST -Uri "$URI" `
+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Invoke-RestMethodOverride 

Has been driving me crazy, any recommendations?

Devcentral is not letting me upload the JSON Body cause it is too long, but below is a link to download my script, it is a txt file. https://goo.gl/4Cc3z2

Thanks