def update_item_properties(portal, item, hostname_map, id_map):
    '''Replace host name/item ids in item json properties'''
    
    jsonPropsToUpdate = ['description', 'snippet', 'accessInformation', 'licenseInfo', 'url']
    for jsonProp in jsonPropsToUpdate:
        is_updated = False
        propertyValue = item.get(jsonProp)
        if propertyValue:
            for host in hostname_map:
                search_str_list = [host, host.lower(), host.upper()]
                for search_str in search_str_list:
                    if propertyValue.find(search_str) > -1:
                        propertyValue = propertyValue.replace(search_str, hostname_map[host])
                        is_updated = True
    
            for item_id in id_map:
                search_str_list = [item_id, item_id.lower(), item_id.upper()]
                for search_str in search_str_list:
                    if propertyValue.find(search_str) > -1:
                        propertyValue = propertyValue.replace(search_str, id_map[item_id]["id"])
                        is_updated = True
            
            if is_updated:
                portal.update_item(item['id'], {jsonProp: propertyValue})
dataset/ETHPy150Open Esri/ops-server-config/Publish/Portal/PortalContentPost.py/update_item_properties/original