AnsweredAssumed Answered

addPortalItemWithUrl trying to create Feature Service

Question asked by GWaltersesriaustralia-com-au-esridist Employee on Jan 2, 2018
Latest reply on Jan 3, 2018 by SQuan-esristaff

Hi everyone,

 

I am trying to write an app that creates a feature service, however I am seeing some strange things (or it might/hopefully just be me).  I won't go into each iteration I have tried but I will summarise some of the results and comments.

 

 

var jsonFS = appFolder.fileUrl("featureService.json")
console.log(jsonFS)
addPortalItemWithJson(newTracklog, jsonFS)

 

using a local file file:// (FileFolder.fileUrl from AppFramework) successfully creates the item but when I look at the service in ArcGIS.com I get an error loading the table in the data tab.  Could you please be specific to what actually has to go into this file.  I copied a previous feature layer JSON content and saved it to a file. I have attached a link at the bottom. Also the service URL is malformed.

 

 

addPortalItemWithUrl(newTracklog, https://services.arcgis.com/ZN2A4THMtsVQ15wW/ArcGIS/rest/services/TestLocationTrackingLayer/FeatureServer)
addPortalItemWithUrl(newTracklog, "https://www.dropbox.com/s/b8mvzyo82108irw/featureService.json", jsonFS)

 

Using a http:// file successfully added the item by using a feature service url but now the service url is pointing to the original feature service. It has effectively made a layer view. Once again what am I supposed to do with this. Also tested with a url outside of the environment and get a successful creation but invalid data.

 

Lucas Danzinger  and FYI Stephen Quan

 

https://www.dropbox.com/s/b8mvzyo82108irw/featureService.json?dl=0

 

Look forward to hearing what I am doing wrong

Outcomes