Inhalte aufrufen

Profilbild

The path template 'odata/v1/WalletHistories/Search' on the action 'SearchFiles' in controller 'WalletHistories' is not a valid OData path template. Ba

API

  • Bitte melden Sie sich an, um eine Antwort zu verfassen.
2 Antworten zu diesem Thema

#1 giakien

giakien

    Newbie

  • Members
  • Punkt
  • 8 Beiträge

Geschrieben: 01 April 2024 - 15:53

Hi everyone,

I wrote more functions in the API but LOG always reported a syntax error

'The path template 'odata/v1/WalletHistories/Search' on the action 'Search' in controller 'WalletHistories' is not a valid OData path template. Bad Request - Error in query syntax.'

Config in DefaultODataModelProvider 

 

 

 

 builder.EntitySet<WalletHistory>("WalletHistories");

  BuildWalletHistories(builder);

 private static void BuildWalletHistories(ODataModelBuilder builder)
 {
     var set = builder.EntitySet<WalletHistory>("WalletHistories");
     var config = set.EntityType.Collection;
  
     var search = config.Action(nameof(WalletHistoriesController.Search))
         .ReturnsFromEntitySet(set);
     search.Parameter<string>("accessToken").Required();
     search.Parameter<int>("i").Optional();
     search.Parameter<int>("s").Optional();
     search.Parameter<int>("page").Optional();         
 }
 

Please support.

Thanks

 



#2 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3831 Beiträge

Geschrieben: 02 April 2024 - 11:54

The endpoint configuration is missing, especially its route. Action endpoints must be accessed using HTTP Post method.
 
Navigation properties are excluded from API at the moment because of IgnoreDataMemberAttribute.
 
Overall I have created an issue to support this.

Marcus Gesing

Smartstore AG


#3 giakien

giakien

    Newbie

  • Members
  • Punkt
  • 8 Beiträge

Geschrieben: 02 April 2024 - 14:23

 

The endpoint configuration is missing, especially its route. Action endpoints must be accessed using HTTP Post method.
 
Navigation properties are excluded from API at the moment because of IgnoreDataMemberAttribute.
 
Overall I have created an issue to support this.

 

 
Thank you for responding,
 
All automatically added actions give an error,
For example, add a registration function in the customer api controller
[HttpPost("Customers/Login")]
[Consumes(Json), Produces(Json)]
[ProducesResponseType(typeof(TokenResponse), Status200OK)]
[Permission(Permissions.Customer.Read)]
public async Task<IActionResult> PostLogin([FromBody] LoginModel model){
...
}



Auch markiert mit einem oder mehrerer dieser Schlüsselwörter: API