Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 175326

Basic REST Call to vROPs

$
0
0

Not sure where this post should go, but I'm trying to make a basic REST call to vROps and start with getting a token and can't.

 

Here's my code:

 

$mybody= @{

 

  username ="admin"

 

  password =  "my password"

}

$json=$mybody|ConvertTo-Json

 

$response=Invoke- RestMethod-urihttps://192.168.1.60/api/auth/token/acquire-MethodPost-Body$json-ContentType'application/json'

 

 

I'm getting this response:

 

Invoke-RestMethod : The remote server returned an error: (404) Not Found.

At C:\powershell\vrops-rest.ps1:6 char:13

 

+ $response = Invoke-RestMethod -uri https://192.168.1.60/api/auth/token/acquire -

 

...

 

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

  + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWeb

 

  Request) [Invoke-RestMethod], WebException

 

  + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.C

 

  ommands.InvokeRestMethodCommand

 

 

I can ping vROps fine at this IP and can view the rest API at https://192.168.1.60/suite-api/docs/rest/index.html just fine.

 

Any ideas?

 

Thanks!

 

 


Viewing all articles
Browse latest Browse all 175326

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>