def QueryFields(r, what, fields=None):
    """
    Retrieves available fields for a resource.

    @type what: string
    @param what: Resource name, one of L{constants.QR_VIA_RAPI}
    @type fields: list of string
    @param fields: Requested fields

    @rtype: string
    @return: job id
    """
    query = {}
    if fields is not None:
        query['fields'] = ','.join(fields)
    return r.request('get', '/2/query/%s/fields' % what, query=query)
