Search for FileMetas.
The underlying data model searched is defined in devilry.apps.core.models.FileMeta. The Simplified API that the server forwards this request to is devilry.apps.examiner.simplified.SimplifiedFileMeta.search().
The request parameters (below) all modify the result of the search. They are applied in the following order:
- The query is executed.
- The result of the query is filtered through the filters.
- The result of the filtering is ordered as specified in orderby.
- The result of the ordering is limited by start and limit.
GET /examiner/restfulsimplifiedfilemeta/
{
query: 'a query string',
filters: [{field:"delivery", comp:"endswith", value:15},
{field:"filename", comp:">", value:"My example value"},
{field:"id", comp:"exact", value:15}],
orderby: ["filename", "-size", "id", "delivery"],
start: 10,
limit: 100
}
Optional request parameters are encoded as a JSON object and sent as the request body as shown in the example above.
A string to search for. If this is empty or not given, all FileMetas that the authenticated user has access to is returned.
If the string is not empty, the query-string is split on whitespace, resulting in a list of words. Every word in the list is searched for case-insensitive matches within the following fields:
- delivery__deadline__assignment_group__candidates__identifier
- Actual location of the field:
- devilry.apps.core.models.Candidate
- About the field:
- List of many values.
- Type
- List of strings
- delivery__deadline__assignment_group__parentnode__parentnode__parentnode__short_name
- Actual location of the field:
- devilry.apps.core.models.Subject
- About the field:
- Max 20 characters. Only numbers, lowercase characters, ‘_’ and ‘-‘.
- Type
- String
- delivery__deadline__assignment_group__parentnode__parentnode__parentnode__long_name
- Actual location of the field:
- devilry.apps.core.models.Subject
- About the field:
- A longer name, more descriptive than “Short name”. This is the name visible to students.
- Type
- String
- delivery__deadline__assignment_group__parentnode__parentnode__short_name
- Actual location of the field:
- devilry.apps.core.models.Period
- About the field:
- Max 20 characters. Only numbers, lowercase characters, ‘_’ and ‘-‘.
- Type
- String
- delivery__deadline__assignment_group__parentnode__parentnode__long_name
- Actual location of the field:
- devilry.apps.core.models.Period
- About the field:
- A longer name, more descriptive than “Short name”. This is the name visible to students.
- Type
- String
- delivery__deadline__assignment_group__parentnode__short_name
- Actual location of the field:
- devilry.apps.core.models.Assignment
- About the field:
- Max 20 characters. Only numbers, lowercase characters, ‘_’ and ‘-‘.
- Type
- String
- delivery__deadline__assignment_group__parentnode__long_name
- Actual location of the field:
- devilry.apps.core.models.Assignment
- About the field:
- A longer name, more descriptive than “Short name”. This is the name visible to students.
- Type
- String
Filters can be used to perform complex queries. The filters parameter is a list of filters, where each filter is a map with the following entries:
- field
- A field name.
- comp
- A comparison operator.
- value
- The value to filter on.
Example:
[{field:"delivery", comp:"endswith", value:15}, {field:"filename", comp:">", value:"My example value"}, {field:"id", comp:"exact", value:15}]
FileMetas can be filtered on the following fields:
- delivery
- Actual location of the field:
- devilry.apps.core.models.Delivery
- About the field:
- Autogenerated identifier.
- Type
- Integer
- Supported comparison operators:
- startswith, contains, >=, <=, icontains, iexact, endswith, exact, <, >.
- filename
- Actual location of the field:
- devilry.apps.core.models.FileMeta
- About the field:
- Name of the file.
- Type
- String
- Supported comparison operators:
- startswith, contains, >=, <=, icontains, iexact, endswith, exact, <, >.
- id
- Actual location of the field:
- devilry.apps.core.models.FileMeta
- About the field:
- Autogenerated identifier.
- Type
- Integer
- Supported comparison operators:
- startswith, contains, >=, <=, icontains, iexact, endswith, exact, <, >.
- size
- Actual location of the field:
- devilry.apps.core.models.FileMeta
- About the field:
- Size of the file in bytes.
- Type
- Integer
- Supported comparison operators:
- startswith, contains, >=, <=, icontains, iexact, endswith, exact, <, >.
If given, this must be a positive integer (including 0), which specifies the exact number of expected results. This enables searches that you know should fail if they do not get this exact number of results, such as filtering for a User by unique username instead of its numeric ID (where you should expect exactly one result).
List of fieldnames. Order the result by these fields. Fieldnames can be prefixed by '-' for descending ordering.
After query, filters and orderby have been executed, the result is limited to the values from start to start+limit. Start defalts to 0.
Limit results to this number of items. Defaults to 50.
A list of group names. Each group adds an additional set of fields to the results of the search. The following group names are available:
- assignment
Expands to the following fields:
- delivery__deadline__assignment_group__parentnode__id
- Actual location of the field:
- devilry.apps.core.models.Assignment
- About the field:
- Autogenerated identifier.
- Type
- Integer
- delivery__deadline__assignment_group__parentnode__short_name
- Actual location of the field:
- devilry.apps.core.models.Assignment
- About the field:
- Max 20 characters. Only numbers, lowercase characters, ‘_’ and ‘-‘.
- Type
- String
- delivery__deadline__assignment_group__parentnode__long_name
- Actual location of the field:
- devilry.apps.core.models.Assignment
- About the field:
- A longer name, more descriptive than “Short name”. This is the name visible to students.
- Type
- String
- period
Expands to the following fields:
- delivery__deadline__assignment_group__parentnode__parentnode__id
- Actual location of the field:
- devilry.apps.core.models.Period
- About the field:
- Autogenerated identifier.
- Type
- Integer
- delivery__deadline__assignment_group__parentnode__parentnode__short_name
- Actual location of the field:
- devilry.apps.core.models.Period
- About the field:
- Max 20 characters. Only numbers, lowercase characters, ‘_’ and ‘-‘.
- Type
- String
- delivery__deadline__assignment_group__parentnode__parentnode__long_name
- Actual location of the field:
- devilry.apps.core.models.Period
- About the field:
- A longer name, more descriptive than “Short name”. This is the name visible to students.
- Type
- String
- subject
Expands to the following fields:
- delivery__deadline__assignment_group__parentnode__parentnode__parentnode__id
- Actual location of the field:
- devilry.apps.core.models.Subject
- About the field:
- Autogenerated identifier.
- Type
- Integer
- delivery__deadline__assignment_group__parentnode__parentnode__parentnode__short_name
- Actual location of the field:
- devilry.apps.core.models.Subject
- About the field:
- Max 20 characters. Only numbers, lowercase characters, ‘_’ and ‘-‘.
- Type
- String
- delivery__deadline__assignment_group__parentnode__parentnode__parentnode__long_name
- Actual location of the field:
- devilry.apps.core.models.Subject
- About the field:
- A longer name, more descriptive than “Short name”. This is the name visible to students.
- Type
- String
note that the is wrong in the example. The id is always unique. However, the example is generated from a non-varying dataset.
200 OK
{
total: 20,
items: [
{ filename: "My example value",
size: 20,
id: 15,
delivery: 15 },
{ filename: "My example value",
size: 20,
id: 15,
delivery: 15 },
...
]
}
Responds with HTTP code 200 and a JSON encoded dict containing the list of results and the total number of items found before applying limit and start. Each result in the list is a JSON object where the key is a fieldname and the associated value is the value for that field. The result always contains the following fields:
- filename
- Actual location of the field:
- devilry.apps.core.models.FileMeta
- About the field:
- Name of the file.
- Type
- String
- size
- Actual location of the field:
- devilry.apps.core.models.FileMeta
- About the field:
- Size of the file in bytes.
- Type
- Integer
- id
- Actual location of the field:
- devilry.apps.core.models.FileMeta
- About the field:
- Autogenerated identifier.
- Type
- Integer
- delivery
- Actual location of the field:
- devilry.apps.core.models.Delivery
- About the field:
- Autogenerated identifier.
- Type
- Integer
However, there may be more fields if specified with the result_fieldgroups request parameter.
On errors, we respond with one of the HTTP Error status codes.