<?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: Export from Online Feature Service Problem in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/export-from-online-feature-service-problem/m-p/1040840#M72217</link>
    <description>&lt;P&gt;That's interesting - some undocumented functionality?&lt;/P&gt;&lt;P&gt;The JSON response should give you the item id of the saved excel file:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
    "type":&amp;lt;type of the exported  item&amp;gt;, 
    "size":&amp;lt;size of the exported item&amp;gt;,
    "jobId":&amp;lt;jobId for the export job&amp;gt;
    "exportItemId":&amp;lt;id of the exported item that is created&amp;gt;,
    "serviceItemId": &amp;lt;id  of the hosted feature service item that was exported&amp;gt;,
    "exportFormat": &amp;lt;exportFormat&amp;gt;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;I think it gets saved into the same user folder?&lt;/P&gt;</description>
    <pubDate>Thu, 25 Mar 2021 21:31:07 GMT</pubDate>
    <dc:creator>Tim_McGinnes</dc:creator>
    <dc:date>2021-03-25T21:31:07Z</dc:date>
    <item>
      <title>Export from Online Feature Service Problem</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/export-from-online-feature-service-problem/m-p/1040762#M72212</link>
      <description>&lt;P&gt;I'm trying to use the Export function off of an ArcGIS Online feature service, but I keep getting an error:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;Export Excel Error: [request:server]: Unexpected token &amp;lt; in JSON at position 0&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;When I try to send the URL directly, I get this error:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;The requested layer (layerId: export) was not found.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;This is the code I'm trying to use:&lt;/FONT&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;// Export to excel
btnExport = document.getElementById("btnExport");
btnExport.onclick = function () {
    let exportURL = "https://services2.arcgis.com/2t1927381mhTgWNC/arcgis/rest/services/Regional_Bus_Stops/FeatureServer/export";

    exportURL += "?itemId=9feab4597b8d435e9c9ba41a4931d09f"; 
    exportURL += "&amp;amp;title='Regional_Bus_Stops'";
    exportURL += "&amp;amp;exportFormat='Excel'";
    exportURL += "&amp;amp;exportParameters=" + "%7b'layers'%3a%5b%7b'id'%3a0%7d%5d%7d";
    console.log(exportURL);
    esriRequest(exportURL, {
        method: "post",
        responseType: "json"
    }).then(function (response) {
        console.log(response);
    })
    .catch(function (error) {
        console.error("Export Excel Error: " + error);
    });
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;I think it has something to do with how I'm passing the Export parameters.&amp;nbsp; I've cleaned up the 'layer:0' text using URL encoded values, but that still doesn't seem to work.&amp;nbsp; Any help would be greatly appreciated.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Thanks, Jeff.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 19:10:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/export-from-online-feature-service-problem/m-p/1040762#M72212</guid>
      <dc:creator>JeffreyWilkerson</dc:creator>
      <dc:date>2021-03-25T19:10:49Z</dc:date>
    </item>
    <item>
      <title>Re: Export from Online Feature Service Problem</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/export-from-online-feature-service-problem/m-p/1040828#M72214</link>
      <description>&lt;P&gt;It's not the export parameters, the problem is that your URL is to the feature service, which does not have a REST export capability. If you paste just your URL string into the browser, you get the same error:&amp;nbsp;&lt;EM&gt;The requested layer (layerId: export) was not found.&lt;/EM&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you have a look at the example at the bottom of the following page, it looks like the export item REST functionality needs to work from a URL pointing to the content of the owner (user) of the item:&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/export-item.htm" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/rest/users-groups-and-items/export-item.htm&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also note the limitation at the top of that page:&amp;nbsp;&lt;SPAN&gt;Exports a service item (POST only) to the specified output format. Available only to users with an organizational subscription. Invokable only by the service item owner or an administrator.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 21:13:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/export-from-online-feature-service-problem/m-p/1040828#M72214</guid>
      <dc:creator>Tim_McGinnes</dc:creator>
      <dc:date>2021-03-25T21:13:41Z</dc:date>
    </item>
    <item>
      <title>Re: Export from Online Feature Service Problem</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/export-from-online-feature-service-problem/m-p/1040834#M72215</link>
      <description>&lt;P&gt;Tim,&lt;/P&gt;&lt;P&gt;Thanks for getting back to me.&amp;nbsp; I just thought that was an example URL so I disregarded it.&amp;nbsp; I had an Esri tech on the phone tell me that the URL provided in my sample was correct.&amp;nbsp; I didn't have the completed function at that time so I couldn't test it in front of him.&amp;nbsp; I did try to connect using a URL pointing to the the user, with Export on the end to follow up on your suggestion, but that didn't work either.&amp;nbsp; It actually gave me the same error:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;Export Excel Error: [request:server]: Unexpected token &amp;lt; in JSON at position 0&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 21:19:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/export-from-online-feature-service-problem/m-p/1040834#M72215</guid>
      <dc:creator>JeffreyWilkerson</dc:creator>
      <dc:date>2021-03-25T21:19:07Z</dc:date>
    </item>
    <item>
      <title>Re: Export from Online Feature Service Problem</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/export-from-online-feature-service-problem/m-p/1040837#M72216</link>
      <description>&lt;P&gt;But...&lt;/P&gt;&lt;P&gt;When I post the resulting URL directly , it doesn't give me an error.&amp;nbsp; Not sure where any downloaded Excel file went to, but it must be working.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks Tim, I'll accept this as the solution to how to get the ArcGIS REST API Export to work against an ArcGIS Online feature service, now I just have to figure out why my code keeps coming up with the 'unexpected token &amp;lt; in JSON at postion 0' error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 21:25:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/export-from-online-feature-service-problem/m-p/1040837#M72216</guid>
      <dc:creator>JeffreyWilkerson</dc:creator>
      <dc:date>2021-03-25T21:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: Export from Online Feature Service Problem</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/export-from-online-feature-service-problem/m-p/1040840#M72217</link>
      <description>&lt;P&gt;That's interesting - some undocumented functionality?&lt;/P&gt;&lt;P&gt;The JSON response should give you the item id of the saved excel file:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
    "type":&amp;lt;type of the exported  item&amp;gt;, 
    "size":&amp;lt;size of the exported item&amp;gt;,
    "jobId":&amp;lt;jobId for the export job&amp;gt;
    "exportItemId":&amp;lt;id of the exported item that is created&amp;gt;,
    "serviceItemId": &amp;lt;id  of the hosted feature service item that was exported&amp;gt;,
    "exportFormat": &amp;lt;exportFormat&amp;gt;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;I think it gets saved into the same user folder?&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 21:31:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/export-from-online-feature-service-problem/m-p/1040840#M72217</guid>
      <dc:creator>Tim_McGinnes</dc:creator>
      <dc:date>2021-03-25T21:31:07Z</dc:date>
    </item>
    <item>
      <title>Re: Export from Online Feature Service Problem</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/export-from-online-feature-service-problem/m-p/1040846#M72218</link>
      <description>&lt;P&gt;I'm seeing nothing new on the ArcGIS&amp;nbsp; Online side for this user.&amp;nbsp; The result of the page only shows the default "Arcgis Portal Directory" and 'Api Reference' link.&lt;/P&gt;&lt;P&gt;Truly not sure if it worked or not.&amp;nbsp; But now that I think about the result, I was hoping more for a file to download from the site, not be added to the content on ArcGIS Online.&amp;nbsp; I am thinking it might be better to go with a geoprocessing service on my Portal.&amp;nbsp; That way I can handle the content easier.&lt;/P&gt;&lt;P&gt;Thanks again for helping me out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 21:42:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/export-from-online-feature-service-problem/m-p/1040846#M72218</guid>
      <dc:creator>JeffreyWilkerson</dc:creator>
      <dc:date>2021-03-25T21:42:06Z</dc:date>
    </item>
  </channel>
</rss>

