python/foglamp/services/core/api/browser.py
async def asset_reading(request):
    """ Browse a particular sensor value of a particular asset for which we have recorded readings and
    return the timestamp and reading value for that sensor. The number of rows returned
    is limited to a small number, this number may be altered by use of
    the query parameter limit=xxx&skip=xxx and it will not respect when datetime units is supplied

    The readings returned can also be time limited by use of the query
    parameter seconds=sss. This defines a number of seconds that the reading
    must have been processed in. Older readings than this will not be returned.

    The readings returned can also be time limited by use of the query
    parameter minutes=mmm. This defines a number of minutes that the reading
    must have been processed in. Older readings than this will not be returned.

    The readings returned can also be time limited by use of the query
    parameter hours=hh. This defines a number of hours that the reading
    must have been processed in. Older readings than this will not be returned.

    Only one of hour, minutes or seconds should be supplied

    Returns:
           json result on basis of SELECT user_ts as "timestamp", reading->>'reading' FROM 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/temperature
            curl -sX GET http://localhost:8081/foglamp/asset/fogbench_humidity/temperature?limit=1
            curl -sX GET http://localhost:8081/foglamp/asset/fogbench_humidity/temperature?skip=10
            curl -sX GET "http://localhost:8081/foglamp/asset/fogbench_humidity/temperature?limit=1&skip=10"
            curl -sX GET http://localhost:8081/foglamp/asset/fogbench_humidity/temperature?minutes=60
    """
    asset_code = request.match_info.get('asset_code', '')
    reading = request.match_info.get('reading', '')

    _select = PayloadBuilder().SELECT(("user_ts", ["reading", reading])) \
        .ALIAS("return", ("user_ts", "timestamp"), ("reading", reading)).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 sensor value of a particular asset for which we have recorded readings and
    return the timestamp and reading value for that sensor. The number of rows returned
    is limited to a small number, this number may be altered by use of
    the query parameter limit=xxx&skip=xxx and it will not respect when datetime units is supplied

    The readings returned can also be time limited by use of the query
    parameter seconds=sss. This defines a number of seconds that the reading
    must have been processed in. Older readings than this will not be returned.

    The readings returned can also be time limited by use of the query
    parameter minutes=mmm. This defines a number of minutes that the reading
    must have been processed in. Older readings than this will not be returned.

    The readings returned can also be time limited by use of the query
    parameter hours=hh. This defines a number of hours that the reading
    must have been processed in. Older readings than this will not be returned.

    Only one of hour, minutes or seconds should be supplied

    Returns:
           json result on basis of SELECT user_ts as "timestamp", reading->>'reading' FROM 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/temperature
            curl -sX GET http://localhost:8081/foglamp/asset/fogbench_humidity/temperature?limit=1
            curl -sX GET http://localhost:8081/foglamp/asset/fogbench_humidity/temperature?skip=10
            curl -sX GET "http://localhost:8081/foglamp/asset/fogbench_humidity/temperature?limit=1&skip=10"
            curl -sX GET http://localhost:8081/foglamp/asset/fogbench_humidity/temperature?minutes=60
    
Browse a particular sensor value of a particular asset for which we have recorded readings and
return the timestamp and reading value for that sensor. The number of rows returned
is limited to a small number, this number may be altered by use of
the query parameter limit=xxx&skip=xxx and it will not respect when datetime units is supplied

The readings returned can also be time limited by use of the query
parameter seconds=sss. This defines a number of seconds that the reading
must have been processed in. Older readings than this will not be returned.

The readings returned can also be time limited by use of the query
parameter minutes=mmm. This defines a number of minutes that the reading
must have been processed in. Older readings than this will not be returned.

The readings returned can also be time limited by use of the query
parameter hours=hh. This defines a number of hours that the reading
must have been processed in. Older readings than this will not be returned.

Only one of hour, minutes or seconds should be supplied


Browse a particular sensor value of a particular asset for which we have recorded readings and return the timestamp and reading value for that sensor . The number of rows returned is limited to a small number this number may be altered by use of the query parameter limit = xxx&skip = xxx and it will not respect when datetime units is supplied The readings returned can also be time limited by use of the query parameter seconds = sss . This defines a number of seconds that the reading must have been processed in . Older readings than this will not be returned . The readings returned can also be time limited by use of the query parameter minutes = mmm . This defines a number of minutes that the reading must have been processed in . Older readings than this will not be returned . The readings returned can also be time limited by use of the query parameter hours = hh . This defines a number of hours that the reading must have been processed in . Older readings than this will not be returned . Only one of hour minutes or seconds should be supplied
async def asset_reading(request):
    asset_code = request.match_info.get('asset_code', '')
    reading = request.match_info.get('reading', '')
    _select = PayloadBuilder().SELECT(("user_ts", ["reading", reading])) \
        .ALIAS("return", ("user_ts", "timestamp"), ("reading", reading)).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_reading ( request ) : asset_code = request . match_info . get ( 'asset_code' , '' ) reading = request . match_info . get ( 'reading' , '' ) _select = PayloadBuilder ( ) . SELECT ( ( "user_ts" , [ "reading" , reading ] ) ) . ALIAS ( "return" , ( "user_ts" , "timestamp" ) , ( "reading" , reading ) ) . 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 sensor value of a particular asset for which we have recorded readings and
return the timestamp and reading value for that sensor.
Browse a particular sensor value of a particular asset for which we have recorded readings and return the timestamp and reading value for that sensor .
""" Browse a particular sensor value of a particular asset for which we have recorded readings and
    return the timestamp and reading value for that sensor. The number of rows returned
    is limited to a small number, this number may be altered by use of
    the query parameter limit=xxx&skip=xxx and it will not respect when datetime units is supplied

    The readings returned can also be time limited by use of the query
    parameter seconds=sss. This defines a number of seconds that the reading
    must have been processed in. Older readings than this will not be returned.

    The readings returned can also be time limited by use of the query
    parameter minutes=mmm. This defines a number of minutes that the reading
    must have been processed in. Older readings than this will not be returned.

    The readings returned can also be time limited by use of the query
    parameter hours=hh. This defines a number of hours that the reading
    must have been processed in. Older readings than this will not be returned.

    Only one of hour, minutes or seconds should be supplied

    Returns:
           json result on basis of SELECT user_ts as "timestamp", reading->>'reading' FROM 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/temperature
            curl -sX GET http://localhost:8081/foglamp/asset/fogbench_humidity/temperature?limit=1
            curl -sX GET http://localhost:8081/foglamp/asset/fogbench_humidity/temperature?skip=10
            curl -sX GET "http://localhost:8081/foglamp/asset/fogbench_humidity/temperature?limit=1&skip=10"
            curl -sX GET http://localhost:8081/foglamp/asset/fogbench_humidity/temperature?minutes=60
    """ # Add the order by and limit, offset clause
request
Example
None