<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic ArcGIS REST unable to updateDefinition in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/arcgis-rest-unable-to-updatedefinition/m-p/736619#M36335</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;{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']}}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's my Python script.&amp;nbsp; Thanks for any help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import sys&lt;BR /&gt;import ntpath&lt;BR /&gt;import os, sys, json, urllib, urllib2, httplib, urlparse, mimetools, mimetypes&lt;BR /&gt;from cStringIO import StringIO&lt;/P&gt;&lt;P&gt;username = "un"&lt;BR /&gt;password = "pw"&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;tokenURL = "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fwww.arcgis.com%2Fsharing%2FgenerateToken" rel="nofollow" target="_blank"&gt;https://www.arcgis.com/sharing/generateToken&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;params = {'f': 'pjson', 'username': username, 'password': password, 'referer': '&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fservices7.arcgis.com" rel="nofollow" target="_blank"&gt;https://services7.arcgis.com&lt;/A&gt;&lt;SPAN&gt;'}&lt;/SPAN&gt;&lt;BR /&gt;req = urllib2.Request(tokenURL, urllib.urlencode(params))&lt;BR /&gt;try:&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;response = urllib2.urlopen(req)&lt;BR /&gt;except:&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;gcontext = ssl.SSLContext(ssl.PROTOCOL_TLSv1)&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;response = urllib2.urlopen(req, context=gcontext)&lt;BR /&gt;data = json.load(response)&lt;BR /&gt;token = data['token']&lt;BR /&gt;print(token)&lt;BR /&gt;&lt;SPAN&gt;requesturl = "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fservices7.arcgis.com%2F%5BID%5D%2FArcGIS%2Frest%2Fadmin%2Fservices%2Fexample%2FFeatureServer%2F0%2FupdateDefinition" rel="nofollow" target="_blank"&gt;https://services7.arcgis.com/[ID]/ArcGIS/rest/admin/services/example/FeatureServer/0/updateDefinition&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;BR /&gt;#data = {'f': 'json', 'token': sh.token, "multiScaleGeometryInfo" : {"levels" : [7,9,11,13,15]}}&amp;nbsp; #this is what I'll eventually do&lt;BR /&gt;data = { "f": "json", "token": token} &lt;BR /&gt;query_string = urllib.urlencode(data)&lt;BR /&gt;print query_string&lt;/P&gt;&lt;P&gt;response = urllib.urlopen(requesturl, query_string)&lt;BR /&gt;resp_json = json.loads(response.read())&lt;BR /&gt;print resp_json&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 14 Feb 2018 20:53:39 GMT</pubDate>
    <dc:creator>KevinAndras</dc:creator>
    <dc:date>2018-02-14T20:53:39Z</dc:date>
    <item>
      <title>ArcGIS REST unable to updateDefinition</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcgis-rest-unable-to-updatedefinition/m-p/736619#M36335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;{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']}}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's my Python script.&amp;nbsp; Thanks for any help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import sys&lt;BR /&gt;import ntpath&lt;BR /&gt;import os, sys, json, urllib, urllib2, httplib, urlparse, mimetools, mimetypes&lt;BR /&gt;from cStringIO import StringIO&lt;/P&gt;&lt;P&gt;username = "un"&lt;BR /&gt;password = "pw"&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;tokenURL = "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fwww.arcgis.com%2Fsharing%2FgenerateToken" rel="nofollow" target="_blank"&gt;https://www.arcgis.com/sharing/generateToken&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;params = {'f': 'pjson', 'username': username, 'password': password, 'referer': '&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fservices7.arcgis.com" rel="nofollow" target="_blank"&gt;https://services7.arcgis.com&lt;/A&gt;&lt;SPAN&gt;'}&lt;/SPAN&gt;&lt;BR /&gt;req = urllib2.Request(tokenURL, urllib.urlencode(params))&lt;BR /&gt;try:&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;response = urllib2.urlopen(req)&lt;BR /&gt;except:&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;gcontext = ssl.SSLContext(ssl.PROTOCOL_TLSv1)&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;response = urllib2.urlopen(req, context=gcontext)&lt;BR /&gt;data = json.load(response)&lt;BR /&gt;token = data['token']&lt;BR /&gt;print(token)&lt;BR /&gt;&lt;SPAN&gt;requesturl = "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fservices7.arcgis.com%2F%5BID%5D%2FArcGIS%2Frest%2Fadmin%2Fservices%2Fexample%2FFeatureServer%2F0%2FupdateDefinition" rel="nofollow" target="_blank"&gt;https://services7.arcgis.com/[ID]/ArcGIS/rest/admin/services/example/FeatureServer/0/updateDefinition&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;BR /&gt;#data = {'f': 'json', 'token': sh.token, "multiScaleGeometryInfo" : {"levels" : [7,9,11,13,15]}}&amp;nbsp; #this is what I'll eventually do&lt;BR /&gt;data = { "f": "json", "token": token} &lt;BR /&gt;query_string = urllib.urlencode(data)&lt;BR /&gt;print query_string&lt;/P&gt;&lt;P&gt;response = urllib.urlopen(requesturl, query_string)&lt;BR /&gt;resp_json = json.loads(response.read())&lt;BR /&gt;print resp_json&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Feb 2018 20:53:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcgis-rest-unable-to-updatedefinition/m-p/736619#M36335</guid>
      <dc:creator>KevinAndras</dc:creator>
      <dc:date>2018-02-14T20:53:39Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS REST unable to updateDefinition</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcgis-rest-unable-to-updatedefinition/m-p/736620#M36336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I figured it out.&amp;nbsp; Need to have async=true, and add the updateDefinition parameter.&lt;/P&gt;&lt;P&gt;This is the corrected line:&lt;/P&gt;&lt;P&gt;data = { "f": "json", "token": token, "async": "true", "updateDefinition": {"multiScaleGeometryInfo": {"levels" : [7,9,11,13,15]}}}&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Feb 2018 23:07:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcgis-rest-unable-to-updatedefinition/m-p/736620#M36336</guid>
      <dc:creator>KevinAndras</dc:creator>
      <dc:date>2018-02-14T23:07:10Z</dc:date>
    </item>
  </channel>
</rss>

