-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OData function works with one parameter but not two or more #64
Comments
I can't find a method named "GetProductPrice" defined in the "GetEdmModelV1". Do you mean "GetPrice" method? So, I can't understand 'https://{{url}}/odata-v1/organizations/GetProductPrice(organizationId='10001', partId='100000-01')', do you mean 'https://{{url}}/odata-v1/organizations/GetPrice(organizationId='10001', partId='100000-01')' Let's assume that you
Then, it should work. "Be noted", your request call has a "whitespace" before "partId='100000-01'. If you remove it, it should work as below Postman snapshot: Detail test codes, you can find it in daea53c |
Sam, Thanks so much for the quick reply. Your blog is actually what started me on the v8.00 path on this project. The issue was, in fact, the whitespace between the first and second parameter. The function name difference in my posted code example was because I had tried changing the name when troubleshooting while I was creating the original post and didn't realize I had already copy and pasted the old edm model with the modified controller code. I really appreciate your help :) |
I made this mistake as well and it took me a while to understand what was going on; as you say
Another thing to watch out for is that if you get the parameter data types subtlety wrong this can also result in a 404, for example if my parameters to the OData function are
It's technically correct, although I suppose a 400 with details of the typing problem might be more intuitive. |
@RobTF It sounds we need to support the parameter constraint. So far, i haven't had a design for that. |
Close it. Please file a new issue if you have questions/concerns. Thanks. |
I am working on a greenfield ASP.NET 5 (net5) API and we are using Microsoft OData v8.00-preview3. I have created a function with one parameter that is working correctly. However, when I add a second parameter to that same function, I get a 404 not found when I run the API and try to hit the endpoint function in Postman.
Here is my Edm model builder. Note: With the 2nd parameter commented out, This function works properly;
Here is my controller. Note: The Get and Get() method work just fine. And the GetPrice method with just one parameter gets hit as expected and stops at the marked debug breakpoint. However, if I uncomment the 2nd parameter in the edm model builder class and replace the ODataRoute and method signature of the GetPrice method with the lines that are currently commented out below, I get a 404 Not Found error and the GetPrice method marked breakpoint is never hit.
Here is the URL in Postman for the single parameter function that works and the two parameter function that get the 404 Not Found.
I should mention that the second parameter, PartId, is not a field in the Organization Model. I just need that value for the processing within the controller method
Is this a bug or am I missing something.
The text was updated successfully, but these errors were encountered: