Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Help with Invoke-RestMethod request

$
0
0

Sorry if this is a silly question, i am pretty new to APIs and the way invoke-restmethod takes the request. I am trying to submit the below request but powershell is failing at "windows_data_drives" section with the error message given at the end of this question. How should i pass that value? what am i doing wrong?

 

$body = @{"environment_id"="4"

"image_catalog_id"="85"

"name"="Windows2012-API"

"app_id"="AP002413"

"cost_center"="11654"

"group_id"="667"

"windows_data_drives"= [{"data_drive_id"="62" "data_drive_path"="D:"}]

"fisc_supported"="true"

"static_ip"="true"

"aliases"="win2012-sis.fmr.com"

"site_id"="2"}

-------------------

ERROR message

-------------------

Unexpected token '"data_drive_path"' in expression or statement.

At line:8 char:26

+ "windows_data_drives"= [{"data_drive_id"="62" "data_drive_path"="D:"}]

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

Assignment expression is not valid. The left hand side of an assignment operator needs to be something that can be assigned to 

like a variable or a property.


Viewing all articles
Browse latest Browse all 6937

Trending Articles