AnsweredAssumed Answered

"Overwrite" existing hosted Feature Service (AGOL)

Question asked by jamesfreddyc on Apr 6, 2015
Latest reply on Sep 18, 2015 by leo.ladefian1255

The only example I can locate has to do with publishing/overwriting a Feature Service on ArcGIS Online via creating and pushing an SDDraft from an .mxd document.


I don't have an .mxd, I just have a File Geodatabase that I want to overwrite with.


I can:


1. Login

2. Access the Feature Service


Is there anyway to overwrite it when I grab that FS or am I just going to need to go the SDDraft route?




def findItem(sTitle, itemType, token):
    item = -1
    params = {'token': token, 'q': sTitle, 'f': 'json'}
    dat2 = urllib.urlencode(params)
    url = urljoin(AGOL, 'sharing/rest/search')
    r = urllib2.urlopen(url=url, data=dat2)

    if itemType is None:
        itemTypes = AGOLItemTypes
        itemTypes = [itemType]
    data = json.loads('utf-8'))
    if len(data['results']) > 0:
        item = [item for item in data['results'] if item['title'] == sTitle and item['type'] in itemTypes][0]
    return item

def main():
    AGOLUser = username
    AGOLPassword = password
    token = gentoken(AGOLUser, AGOLPassword, 60)
    orgId = getOrganizationId(token)

    item = findItem('Name of Feature Service', 'Feature Service', token)
    if item is not None:
        print "item found"
        #I can see that I have grabbed the FS here