Select to view content in your preferred language

"status": "error", "messages": ["Use JSON in parameter service."], "code": 500

233
0
02-19-2025 07:26 AM
Labels (2)
ALGIS
by
Emerging Contributor

I am trying to update the ouput directory of a service via powershell. Long story short domain changed and only have a few hundred to do. I get the following error when running the script "status": "error", "messages": ["Use JSON in parameter service."], "code": 500

$editServiceUrl = "https://<myserverdomain>//server/admin/services/Hosted/<myFeatureClass>.FeatureService/edit"

updateBody = @{

"outputDir:" "\\server.domain.com\arcgisserver\arcgisoutput"

# I have also tried "outputDir:" "\\\\server.domain.com\\arcgisserver\\arcgisoutput"
} | ConvertTo-Json

$response = Invoke-RestMethod -Uri $editServiceUrl -Method Post -Body $updateBody -Headers @{
"Authorization" = "Bearer $token"
} -ContentType "application/x-www-form-urlencoded"

I have not tried to update services this way before. I can publish/delete services no issues (I know not apples to apples) . 

Is it my formatting of the json string or do I have to update the entire service properties with just the one change?

 

 

0 Kudos
0 Replies