<?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 Re: Can I script removal of points from hosted feature service? in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/can-i-script-removal-of-points-from-hosted-feature/m-p/636404#M31694</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xander,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Sorry for the slow response.&amp;nbsp; I'm new to using JSON inside of python; can you give me an idea of how I would use the delete command inside of a python script?&amp;nbsp; Or another resource to consult?&amp;nbsp; I'm also curious how I would list out the object id's inside of the feature service.&amp;nbsp; Is there something similar to a search cursor that I could use? &lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brandon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 10 Nov 2014 23:57:59 GMT</pubDate>
    <dc:creator>BrandonKeinath1</dc:creator>
    <dc:date>2014-11-10T23:57:59Z</dc:date>
    <item>
      <title>Can I script removal of points from hosted feature service?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/can-i-script-removal-of-points-from-hosted-feature/m-p/636402#M31692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is it possible to script the removal of points from a hosted feature service?&amp;nbsp; I have a hosted feature service that supports a geoform that we're using to collect customer information.&amp;nbsp; Once the customer submits the geoform I have a process that downloads a replica and moves the data to our ArcGIS Server.&amp;nbsp; Once that's done I'd like to clean out the feature service so that each person is presented with a "clean" map.&amp;nbsp; Is this possible?&amp;nbsp; I'd also be open to other methods to accomplish this "clean" look.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Brandon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Nov 2014 22:28:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/can-i-script-removal-of-points-from-hosted-feature/m-p/636402#M31692</guid>
      <dc:creator>BrandonKeinath1</dc:creator>
      <dc:date>2014-11-06T22:28:21Z</dc:date>
    </item>
    <item>
      <title>Re: Can I script removal of points from hosted feature service?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/can-i-script-removal-of-points-from-hosted-feature/m-p/636403#M31693</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Brandon,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use python and the REST API to execute a delete command:&lt;/P&gt;&lt;P&gt;&lt;A href="http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#//02r3000000w4000000" title="http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#//02r3000000w4000000"&gt;ArcGIS REST API&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This PDF provides some more info on interacting with the server using Python:&lt;/P&gt;&lt;P&gt;&lt;A href="http://proceedings.esri.com/library/userconf/proc14/tech-workshops/tw_187.pdf" title="http://proceedings.esri.com/library/userconf/proc14/tech-workshops/tw_187.pdf"&gt;http://proceedings.esri.com/library/userconf/proc14/tech-workshops/tw_187.pdf&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards, Xander&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Nov 2014 02:29:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/can-i-script-removal-of-points-from-hosted-feature/m-p/636403#M31693</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2014-11-07T02:29:53Z</dc:date>
    </item>
    <item>
      <title>Re: Can I script removal of points from hosted feature service?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/can-i-script-removal-of-points-from-hosted-feature/m-p/636404#M31694</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xander,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Sorry for the slow response.&amp;nbsp; I'm new to using JSON inside of python; can you give me an idea of how I would use the delete command inside of a python script?&amp;nbsp; Or another resource to consult?&amp;nbsp; I'm also curious how I would list out the object id's inside of the feature service.&amp;nbsp; Is there something similar to a search cursor that I could use? &lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brandon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Nov 2014 23:57:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/can-i-script-removal-of-points-from-hosted-feature/m-p/636404#M31694</guid>
      <dc:creator>BrandonKeinath1</dc:creator>
      <dc:date>2014-11-10T23:57:59Z</dc:date>
    </item>
    <item>
      <title>Re: Can I script removal of points from hosted feature service?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/can-i-script-removal-of-points-from-hosted-feature/m-p/636405#M31695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Below a small example of a POST request. This did not work on my computer due to an authentication error, but that just might be my proxy (the server supposedly does not require a token (but you may in your case).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;More on getting a token here (include it in the params dictionary):&lt;/P&gt;&lt;P&gt;&lt;A href="http://resources.arcgis.com/EN/HELP/MAIN/10.1/index.html#//0154000005w0000000" title="http://resources.arcgis.com/EN/HELP/MAIN/10.1/index.html#//0154000005w0000000"&gt;ArcGIS Help 10.1&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14157105263379538" jivemacro_uid="_14157105263379538"&gt;
&lt;P&gt;import urllib&lt;/P&gt;
&lt;P&gt;import urllib2&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# a list of non existing object id's (to avoid deletion of features)&lt;/P&gt;
&lt;P&gt;oids = [37,101,462]&lt;/P&gt;
&lt;P&gt;ids = ",".join([str(oid) for oid in oids])&lt;/P&gt;
&lt;P&gt;print ids&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# encode the parameters, only specifying the list of objectids (simple case)&lt;/P&gt;
&lt;P&gt;params = urllib.urlencode({'f': 'json', 'objectIds':ids})&lt;/P&gt;
&lt;P&gt;print params&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# taking the sample HomelandSecurity URL (hoping this doesn't affect my visit to the DevSummit next year)&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;queryURL = "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://sampleserver3.arcgisonline.com/ArcGIS/rest/services/HomelandSecurity/operations/FeatureServer/0/deleteFeatures" rel="nofollow" target="_blank"&gt;https://sampleserver3.arcgisonline.com/ArcGIS/rest/services/HomelandSecurity/operations/FeatureServer/0/deleteFeatures&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# use the request method on the urllib2 library&lt;/P&gt;
&lt;P&gt;req = urllib2.Request(queryURL, params) # forces POST request (deleteFeatures can only be done with a POST request)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# get the response&lt;/P&gt;
&lt;P&gt;response = urllib2.urlopen(req)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# assuming this query URL&lt;/P&gt;
&lt;P&gt;jsonResult = json.load(response)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# do something with the response&lt;/P&gt;
&lt;P&gt;print jsonResults&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will return a json list indicating the result of the deletion for each object id:&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14157106399816901" jivemacro_uid="_14157106399816901"&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp; "deleteResults" : [&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "objectId" : 37,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "globalId" : null,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "success" : false,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "error" :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "code" : -1,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "description" : "Delete for the object was not attempted. Object may not exist."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; },&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "objectId" : 101,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "globalId" : null,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "success" : false,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "error" :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "code" : -1,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "description" : "Delete for the object was not attempted. Object may not exist."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; },&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "objectId" : 462,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "globalId" : null,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "success" : false,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "error" :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "code" : -1,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "description" : "Delete for the object was not attempted. Object may not exist."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp; ]}&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards, Xander&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Nov 2014 12:57:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/can-i-script-removal-of-points-from-hosted-feature/m-p/636405#M31695</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2014-11-11T12:57:51Z</dc:date>
    </item>
    <item>
      <title>Re: Can I script removal of points from hosted feature service?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/can-i-script-removal-of-points-from-hosted-feature/m-p/636406#M31696</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for all the help Xander.&amp;nbsp; I'm excited to give it a try!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Best,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brandon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Nov 2014 13:30:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/can-i-script-removal-of-points-from-hosted-feature/m-p/636406#M31696</guid>
      <dc:creator>BrandonKeinath1</dc:creator>
      <dc:date>2014-11-11T13:30:02Z</dc:date>
    </item>
    <item>
      <title>Re: Can I script removal of points from hosted feature service?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/can-i-script-removal-of-points-from-hosted-feature/m-p/636407#M31697</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xander,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally got around to trying the process and I'm getting a traceback error that 'json' is not defined which I think is related to this line from your example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# assuming this query URL&lt;/P&gt;&lt;P&gt;jsonResult = json.load(response)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is json part of another module or is it a variable I didn't define correctly?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brandon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Nov 2014 15:55:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/can-i-script-removal-of-points-from-hosted-feature/m-p/636407#M31697</guid>
      <dc:creator>BrandonKeinath1</dc:creator>
      <dc:date>2014-11-17T15:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: Can I script removal of points from hosted feature service?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/can-i-script-removal-of-points-from-hosted-feature/m-p/636408#M31698</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Brandon,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I missed a line in the beginning... json is a module that needs to be imported.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;add the line:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14162463419566328" jivemacro_uid="_14162463419566328"&gt;
&lt;P&gt;import json&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...in the beginning of the code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry, Xander&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Nov 2014 17:45:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/can-i-script-removal-of-points-from-hosted-feature/m-p/636408#M31698</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2014-11-17T17:45:46Z</dc:date>
    </item>
    <item>
      <title>Re: Can I script removal of points from hosted feature service?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/can-i-script-removal-of-points-from-hosted-feature/m-p/636409#M31699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xander,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the quick response and no worries on the missed line.&amp;nbsp; Your fix worked but now it seems we're stuck on the token issue you mentioned briefly above.&amp;nbsp; I found the API reference for getting a token but it hasn't worked for me yet.&amp;nbsp; Thanks for all your help.&amp;nbsp; Once I have it working I'll post back here in case anyone is interested.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brandon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Nov 2014 17:56:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/can-i-script-removal-of-points-from-hosted-feature/m-p/636409#M31699</guid>
      <dc:creator>BrandonKeinath1</dc:creator>
      <dc:date>2014-11-17T17:56:25Z</dc:date>
    </item>
  </channel>
</rss>

