Skip to content

$top option doesn't work #62

@williamhCode

Description

@williamhCode

Hello, I'm a Purdue student using the api for my CS 307 software engineering project. I'm trying to implement a searching function for all courses, but I noticed that purdue api doesn't support the $top query option. The problem is if there's too many results it takes a while to load, which stalls the searching. It would be a lot more efficient to use $top and $skip so I can lazy load the results when scrolling down. Is it trivial to implement $top? If you don't have time and it's relatively simple I was thinking I could make a pull request.

Result of this query Courses?$top=10:

{
    "error": {
        "code": "",
        "message": "The query specified in the URI is not valid. The limit of '0' for Top query has been exceeded. The value from the incoming request is '10'.",
        "details": [],
        "innererror": {
            "message": "The limit of '0' for Top query has been exceeded. The value from the incoming request is '10'.",
            "type": "Microsoft.OData.ODataException",
            "stacktrace": "   at Microsoft.AspNetCore.OData.Query.Validator.TopQueryValidator.Validate(TopQueryOption topQueryOption, ODataValidationSettings validationSettings)\n   at Microsoft.AspNetCore.OData.Query.Validator.ODataQueryValidator.Validate(ODataQueryOptions options, ODataValidationSettings validationSettings)\n   at Microsoft.AspNetCore.OData.Query.EnableQueryAttribute.ValidateQuery(HttpRequest request, ODataQueryOptions queryOptions)\n   at Microsoft.AspNetCore.OData.Query.EnableQueryAttribute.OnActionExecuting(ActionExecutingContext actionExecutingContext)"
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions