Web api

Monday, November 25, 2024 4:44:52 PM
  • Posted: Thursday, May 30, 2019 8:39 AM
  • 8
grandnode version 4.4

a) http://docs.grandnode.com/operations-with-categories

how to use $expand to get all products under categories?

b) http://127.0.0.1/odata/Product?$select=Price,Name

i get below error when i select only Price and Name. am i missing something?

result:

{
    "error": {
        "code": "",
        "message": "The query specified in the URI is not valid. The property 'Price' cannot be used in the $select query option.",
        "details": [],
        "innererror": {
            "message": "The property 'Price' cannot be used in the $select query option.",
            "type": "Microsoft.OData.ODataException",
            "stacktrace": "   at Microsoft.AspNet.OData.Query.Validators.SelectExpandQueryValidator.ValidateSelectItem(SelectItem selectItem, IEdmProperty pathProperty, IEdmStructuredType pathStructuredType, IEdmModel edmModel)\n   at Microsoft.AspNet.OData.Query.Validators.SelectExpandQueryValidator.ValidateRestrictions(Nullable`1 remainDepth, Int32 currentDepth, SelectExpandClause selectExpandClause, IEdmNavigationProperty navigationProperty, ODataValidationSettings validationSettings)\n   at Microsoft.AspNet.OData.Query.Validators.SelectExpandQueryValidator.Validate(SelectExpandQueryOption selectExpandQueryOption, ODataValidationSettings validationSettings)\n   at Microsoft.AspNet.OData.Query.SelectExpandQueryOption.Validate(ODataValidationSettings validationSettings)\n   at Microsoft.AspNet.OData.Query.Validators.ODataQueryValidator.Validate(ODataQueryOptions options, ODataValidationSettings validationSettings)\n   at Microsoft.AspNet.OData.EnableQueryAttribute.ValidateQuery(HttpRequest request, ODataQueryOptions queryOptions)\n   at Microsoft.AspNet.OData.EnableQueryAttribute.<>c__DisplayClass1_0.<OnActionExecuted>b__3(ODataQueryContext queryContext)\n   at Microsoft.AspNet.OData.EnableQueryAttribute.ExecuteQuery(Object responseValue, IQueryable singleResultCollection, IWebApiActionDescriptor actionDescriptor, Func`2 modelFunction, IWebApiRequestMessage request, Func`2 createQueryOptionFunction)\n   at Microsoft.AspNet.OData.EnableQueryAttribute.OnActionExecuted(Object responseValue, IQueryable singleResultCollection, IWebApiActionDescriptor actionDescriptor, IWebApiRequestMessage request, Func`2 modelFunction, Func`2 createQueryOptionFunction, Action`1 createResponseAction, Action`3 createErrorAction)"
        }
    }

}


Regards,
Kalyan
0
  • Posted: Thursday, May 30, 2019 1:09 PM
  • 953
Hi,

Unfortunatelly due to architecture limits - select and expand are not supported yet.
Best regards,
Patryk

GrandNode Team
0
  • Posted: Thursday, May 30, 2019 1:37 PM
  • 8
Can we elegantly exit by handling this with a not supported message instead exiting with error
0
back to top
Filters