ArcGIS REST unable to updateDefinition

Discussion created by TW_WebMap on Feb 14, 2018
Latest reply on Feb 14, 2018 by TW_WebMap

Hi, using the REST API, I'm attempting to update multiScaleGeometryInfo for my feature layers, but I'm having trouble getting into the updateDefinition URL. Here's the error I get:


{u'error': {u'message': u'Unable to update feature service layer definition.', u'code': 400, u'details': [u'Value cannot be null. Parameter name: input']}}


Here's my Python script.  Thanks for any help!


import sys
import ntpath
import os, sys, json, urllib, urllib2, httplib, urlparse, mimetools, mimetypes
from cStringIO import StringIO

username = "un"
password = "pw"

tokenURL = ""
params = {'f': 'pjson', 'username': username, 'password': password, 'referer': ''}
req = urllib2.Request(tokenURL, urllib.urlencode(params))
   response = urllib2.urlopen(req)
   gcontext = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
   response = urllib2.urlopen(req, context=gcontext)
data = json.load(response)
token = data['token']
requesturl = "[ID]/ArcGIS/rest/admin/services/example/FeatureServer/0/updateDefinition"
#data = {'f': 'json', 'token': sh.token, "multiScaleGeometryInfo" : {"levels" : [7,9,11,13,15]}}  #this is what I'll eventually do
data = { "f": "json", "token": token}
query_string = urllib.urlencode(data)
print query_string

response = urllib.urlopen(requesturl, query_string)
resp_json = json.loads(
print resp_json