(request, domain, app_build_id)
return JsonResponse(info)
An endpoint for CommCare mobile to get latest CommCare APK and app version
        info. (Should serve from cache as it's going to be busy view)

    'app_build_id' (that comes from URL) can be id of any version of the app
    'app_id' (urlparam) is usually id of an app that is not a copy
        mobile simply needs it to be resent back in the JSON, and doesn't
        need any validation on it. This is pulled from @uniqueid from profile.xml
An endpoint for CommCare mobile to get latest CommCare APK and app version
        info. (Should serve from cache as it's going to be busy view)
An endpoint for CommCare mobile to get latest CommCare APK and app version info . ( Should serve from cache as it s going to be busy view )
def heartbeat(request, domain, app_build_id):
    """
    An endpoint for CommCare mobile to get latest CommCare APK and app version
        info. (Should serve from cache as it's going to be busy view)

    'app_build_id' (that comes from URL) can be id of any version of the app
    'app_id' (urlparam) is usually id of an app that is not a copy
        mobile simply needs it to be resent back in the JSON, and doesn't
        need any validation on it. This is pulled from @uniqueid from profile.xml
    """
    app_id = request.GET.get('app_id', '')
    build_profile_id = request.GET.get('build_profile_id', '')
    master_app_id = app_id
    try:
        info = GlobalAppConfig.get_latest_version_info(domain, app_id, build_profile_id)
    except (Http404, AssertionError):
        # If it's not a valid master app id, find it by talking to couch
        app = get_app_cached(domain, app_build_id)
        notify_exception(request, 'Received an invalid heartbeat request')
        master_app_id = app.origin_id if app else None
        info = GlobalAppConfig.get_latest_version_info(domain, app.origin_id, build_profile_id)

    info["app_id"] = app_id
    if master_app_id:
        if not toggles.SKIP_UPDATING_USER_REPORTING_METADATA.enabled(domain):
            update_user_reporting_data(app_build_id, app_id, build_profile_id, request.couch_user, request)

    if _should_force_log_submission(request):
        info['force_logs'] = True
    return JsonResponse(info)
def heartbeat ( request , domain , app_build_id ) : app_id = request . GET . get ( 'app_id' , '' ) build_profile_id = request . GET . get ( 'build_profile_id' , '' ) master_app_id = app_id try : info = GlobalAppConfig . get_latest_version_info ( domain , app_id , build_profile_id ) except ( Http404 , AssertionError ) : # If it's not a valid master app id, find it by talking to couch app = get_app_cached ( domain , app_build_id ) notify_exception ( request , 'Received an invalid heartbeat request' ) master_app_id = app . origin_id if app else None info = GlobalAppConfig . get_latest_version_info ( domain , app . origin_id , build_profile_id ) info [ "app_id" ] = app_id if master_app_id : if not toggles . SKIP_UPDATING_USER_REPORTING_METADATA . enabled ( domain ) : update_user_reporting_data ( app_build_id , app_id , build_profile_id , request . couch_user , request ) if _should_force_log_submission ( request ) : info [ 'force_logs' ] = True return JsonResponse ( info )