Programmatically Create Hosted Feature Service from Scratch or GeoJSON

812
1
07-02-2013 06:52 AM
Status: Open
PhilHolleran
Occasional Contributor
ArcGIS Online currently offers the ability to publish hosted feature services from zipped shapefiles, service definitions, and even csvs.  However, options are a bit limited for developers wanting to create a hosted feature service  by other means, without access to traditional GIS data.  This is especially true for non-point features (lines, polys).

It would be advantageous to offer the ability to generate hosted feature services directly through the API.  I see at least two options for this.

One would be to create REST endpoint that could be called to create an empty hosted service (http://www.arcigs.com/sharing/rest/content/users/johnSmith/createService) by passing the necessary parameters in the POST: 
{
    serviceType: 'feature',
    geometryType: 'point',
    name: 'name',
    alias: 'alias',
    coordinateSystem: [<coordinateSytstem Object],
    fields: [
        ['name','alias', 'text', '50'],
        ['name','alias', 'text', '50'],
    ]
    etc...
}
On success, the server would return the itemId of the service.

The second would be similar to the first, but allow the passing of existing geoJSON in the POST to create hosted services containing data.

These operations would help move ArcGIS Online further into the non-traditional GIS development community.
1 Comment
KellyGerrow
While it is not done programatically, you can define the database schema on the fly from the UI in developers.arcgis.com.