I used this script as-is with some changes to the below variables,
username = raw_input("Enter user name: ")
password = getpass.getpass("Enter password: ")
# Ask for other necessary information
serverName = raw_input("Enter Server name: ")
serverPort = 6080
mxdPath = raw_input("Enter the path to the MXD: ")
msdPath = raw_input("Enter the desired path for the MSD: ")
jsonPath = raw_input("Enter the path to the JSON file: ")
I keep getting the below error, not sure what's wrong.
---> Error: JSON object returns an error. {u'status': u'error', u'code': 500, u'messa
ges': [u"JSON object for 'Service' is missing required attribute 'type'"]}
Error returned by operation. {"status":"error","messages":["JSON object for 'Ser
vice' is missing required attribute 'type'"],"code":500}
Could someone help? Thanks.
Can you post your json file? The error indicates it is missing the type parameter. There is a sample json file on the page you referenced. According to the sample, the type should be something like:
"type": "MapServer"
Here it is. I dont see anything wrong with "Type"
{
}
After a quick look, Map Server - and the other string values - should be quoted: "Map Server". I would suggest using a service like jsonlint.com to verify that your json is properly formatted. See JSON Data Types (and related pages at w3schools.com) for some additional information on formatting numbers, booleans, arrays, and nulls.
They are all quoted. Its just how the code was pasted. I did revalidate my JSON and it looks just fine.