AnsweredAssumed Answered

Overwriting Hosted Feature Service via REST

Question asked by galligang on Oct 12, 2016
Latest reply on Oct 27, 2016 by galligang

A quick skills background... Not a full time programmer, proficient enough in Python to get by but VERY new to REST API scripting. So forgive me if there is an easy answer, I am missing something simple or a different approach is warranted.


I am trying to update an existing hosted feature service by using the 'Publish Item' operation using the overwrite=true parameter. (API Reference: ArcGIS REST API - Publish Item).


The following function (minus overwrite param) works perfectly to publish the feature service from an existing geojson item I have already added to Portal.  When I add the the overwrite parameter, I get the message that the service with that name already exists. Seems like it checks the service name before recognizing the overwrite parameter.  Service is not delete protected.  Seems simple and straightforward adding of a parameter to the REST call.  Resulting URLs from the original publishing POST call and the update call are the same except for '&overwrite=true' is added to the URL.   What am I missing?


"Publish error for item 'CMT_Test3.geojson'. Service name 'CMT_Test3' already exists"



def PublishService(Short, itemID, username, token, itemName, publishParams):

    publishURL = 'http://{}/portal/sharing/rest/content/users/{}/publish'.format(Short, username)
    query_dict = {
        'itemID': itemID,
        'filetype': 'GeoJson',
        'f': 'json',
        'token': token,
        'overwrite': 'true',

    query_dict['publishParameters'] = json.dumps(query_dict['publishParameters'], sort_keys=False)
    request =, data=query_dict)
    return request.json()