post json APi PMP from powershell

post json APi PMP from powershell

I try to post json from Powershell script in use api " https://server/restapi/json/v1/resources/ressource iD/accounts?AUTHTOKEN=xxxxxxx" the connecion API is ok

# -- Workaround certificat problem ---
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@

[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
#-----------------------------------

INPUT_DATA={"operation":{
"Details":{
"ACCOUNTLIST": [
{
"ACCOUNTNAME":"bestest047",
"PASSWORD":"Pa$$Word@123",
"NOTES":"IT Security - BES PMP API Test"
},
{
"ACCOUNTNAME":"bestest048",
"PASSWORD":"Pa$$Word@123",
"NOTES":"IT Security - BES PMP API Test"
}
]
}
}
}

Invoke-RestMethod -Uri $uri -Method POST -contentType "application/json" -body $INPUT_DATA

I have the followin error message :

At E:\Scripts\IT-SelfService\CETU-SVC\GET-Ressources - test.ps1:33 char:24
+ INPUT_DATA{"operation":{
+ ~
Unexpected token ':' in expression or statement.
At E:\Scripts\IT-SelfService\CETU-SVC\GET-Ressources - test.ps1:34 char:30
+ "Details":{
+ ~
Unexpected token ':' in expression or statement.
At E:\Scripts\IT-SelfService\CETU-SVC\GET-Ressources - test.ps1:35 char:34
+ "ACCOUNTLIST": [
+ ~
Unexpected token ':' in expression or statement.
At E:\Scripts\IT-SelfService\CETU-SVC\GET-Ressources - test.ps1:37 char:36
+ "ACCOUNTNAME":"bestest047",
+ ~~~~~~~~~~~~~
Unexpected token ':"bestest047"' in expression or statement.
At E:\Scripts\IT-SelfService\CETU-SVC\GET-Ressources - test.ps1:37 char:49
+ "ACCOUNTNAME":"bestest047",
+ ~
Missing argument in parameter list.

Have you got an idea Please

thanks for you help

                  New to ADSelfService Plus?