User-1538874048 posted
In my ASP.Net Web API project, I have the following entities- Customer, Warehouse, SKU and Vendors. A customer can have multiple Warehouses, SKUs and Vendors. I have get methods in CustomersController to get the Warehouses by CustomerId or Vendors
by Customer Id or SKUs by Customer Id. The following is the code in CustomersController.cs:
[EnableQuery]
public async Task<IHttpActionResult> GetSKUs([FromODataUri] long key)
[EnableQuery]
public async Task<IHttpActionResult> GetWarehouses([FromODataUri] long key) {}
[EnableQuery]
public async Task<IHttpActionResult> GetVendors([FromODataUri] long key) {}
The following URLs works - /BookMyLoad/Customers(10000)/Warehouses and /BookMyLoad/Customers(10000)/SKUs. The following URL gives a 404 error - /BookMyLoad/Customers(10000)/Vendors
Detailed error is: { "error":{ "code":"","message":"No HTTP resource was found that matches the request URI 'http://localhost:62702/BookMyLoad/Customers(10000)/Vendors'.","innererror":{
"message":"No routing convention was found to select an action for the OData path with template '~/entityset/key/unresolved'.","type":"","stacktrace":"" } } }
I have defined both Warehouses and Vendors properly-
oDataModelBuilder.EntitySet<SKU>("SKUs");
oDataModelBuilder.EntitySet<Warehouse>("Warehouses");
oDataModelBuilder.EntitySet<Vendor>("Vendors");
oDataModelBuilder.EntitySet<Customer>("Customers");
Can you kindly help me in understanding what am i doing wrong?