python/foglamp/services/core/api/browser.py
async def asset(request):
    """ Browse a particular asset for which we have recorded readings and
    return a readings with timestamps for the asset. The number of readings
    return is defaulted to a small number (20), this may be changed by supplying
    the query parameter ?limit=xx&skip=xx and it will not respect when datetime units is supplied

    Returns:
          json result on basis of SELECT user_ts as "timestamp", (reading)::jsonFROM readings WHERE asset_code = 'asset_code' ORDER BY user_ts DESC LIMIT 20 OFFSET 0;

    :Example:
            curl -sX GET http://localhost:8081/foglamp/asset/fogbench_humidity
            curl -sX GET http://localhost:8081/foglamp/asset/fogbench_humidity?limit=1
            curl -sX GET "http://localhost:8081/foglamp/asset/fogbench_humidity?limit=1&skip=1"
            curl -sX GET http://localhost:8081/foglamp/asset/fogbench_humidity?seconds=60
    """
    asset_code = request.match_info.get('asset_code', '')
    _select = PayloadBuilder().SELECT(("reading", "user_ts")).ALIAS("return", ("user_ts", "timestamp")).chain_payload()

    _where = PayloadBuilder(_select).WHERE(["asset_code", "=", asset_code]).chain_payload()
    if 'seconds' in request.query or 'minutes' in request.query or 'hours' in request.query:
        _and_where = where_clause(request, _where)
    else:
        # Add the order by and limit, offset clause
        _and_where = prepare_limit_skip_payload(request, _where)

    payload = PayloadBuilder(_and_where).ORDER_BY(["user_ts", "desc"]).payload()
    results = {}
    try:
        _readings = connect.get_readings_async()
        results = await _readings.query(payload)
        response = results['rows']
    except KeyError:
        raise web.HTTPBadRequest(reason=results['message'])
    else:
        return web.json_response(response)
 Browse a particular asset for which we have recorded readings and
    return a readings with timestamps for the asset. The number of readings
    return is defaulted to a small number (20), this may be changed by supplying
    the query parameter ?limit=xx&skip=xx and it will not respect when datetime units is supplied

    Returns:
          json result on basis of SELECT user_ts as "timestamp", (reading)::jsonFROM readings WHERE asset_code = 'asset_code' ORDER BY user_ts DESC LIMIT 20 OFFSET 0;

    :Example:
            curl -sX GET http://localhost:8081/foglamp/asset/fogbench_humidity
            curl -sX GET http://localhost:8081/foglamp/asset/fogbench_humidity?limit=1
            curl -sX GET "http://localhost:8081/foglamp/asset/fogbench_humidity?limit=1&skip=1"
            curl -sX GET http://localhost:8081/foglamp/asset/fogbench_humidity?seconds=60
    
Browse a particular asset for which we have recorded readings and
return a readings with timestamps for the asset. The number of readings
return is defaulted to a small number (20), this may be changed by supplying
the query parameter ?limit=xx&skip=xx and it will not respect when datetime units is supplied


Browse a particular asset for which we have recorded readings and return a readings with timestamps for the asset . The number of readings return is defaulted to a small number ( 20 ) this may be changed by supplying the query parameter ?limit = xx&skip = xx and it will not respect when datetime units is supplied
async def asset(request):
    asset_code = request.match_info.get('asset_code', '')
    _select = PayloadBuilder().SELECT(("reading", "user_ts")).ALIAS("return", ("user_ts", "timestamp")).chain_payload()
    _where = PayloadBuilder(_select).WHERE(["asset_code", "=", asset_code]).chain_payload()
    if 'seconds' in request.query or 'minutes' in request.query or 'hours' in request.query:
        _and_where = where_clause(request, _where)
    else:
        _and_where = prepare_limit_skip_payload(request, _where)
    payload = PayloadBuilder(_and_where).ORDER_BY(["user_ts", "desc"]).payload()
    results = {}
    try:
        _readings = connect.get_readings_async()
        results = await _readings.query(payload)
        response = results['rows']
    except KeyError:
        raise web.HTTPBadRequest(reason=results['message'])
    else:
        return web.json_response(response)
async def asset ( request ) : asset_code = request . match_info . get ( 'asset_code' , '' ) _select = PayloadBuilder ( ) . SELECT ( ( "reading" , "user_ts" ) ) . ALIAS ( "return" , ( "user_ts" , "timestamp" ) ) . chain_payload ( ) _where = PayloadBuilder ( _select ) . WHERE ( [ "asset_code" , "=" , asset_code ] ) . chain_payload ( ) if 'seconds' in request . query or 'minutes' in request . query or 'hours' in request . query : _and_where = where_clause ( request , _where ) else : _and_where = prepare_limit_skip_payload ( request , _where ) payload = PayloadBuilder ( _and_where ) . ORDER_BY ( [ "user_ts" , "desc" ] ) . payload ( ) results = { } try : _readings = connect . get_readings_async ( ) results = await _readings . query ( payload ) response = results [ 'rows' ] except KeyError : raise web . HTTPBadRequest ( reason = results [ 'message' ] ) else : return web . json_response ( response )
Browse a particular asset for which we have recorded readings and
return a readings with timestamps for the asset.
Browse a particular asset for which we have recorded readings and return a readings with timestamps for the asset .
""" Browse a particular asset for which we have recorded readings and
    return a readings with timestamps for the asset. The number of readings
    return is defaulted to a small number (20), this may be changed by supplying
    the query parameter ?limit=xx&skip=xx and it will not respect when datetime units is supplied

    Returns:
          json result on basis of SELECT user_ts as "timestamp", (reading)::jsonFROM readings WHERE asset_code = 'asset_code' ORDER BY user_ts DESC LIMIT 20 OFFSET 0;

    :Example:
            curl -sX GET http://localhost:8081/foglamp/asset/fogbench_humidity
            curl -sX GET http://localhost:8081/foglamp/asset/fogbench_humidity?limit=1
            curl -sX GET "http://localhost:8081/foglamp/asset/fogbench_humidity?limit=1&skip=1"
            curl -sX GET http://localhost:8081/foglamp/asset/fogbench_humidity?seconds=60
    """ # Add the order by and limit, offset clause
request
Example
None