1. Gian Luca De Bonis
  2. SnapDevelop
  3. Monday, 17 May 2021 17:28 PM UTC

My API has a method with an optional parameter, that is passed as path:

api/v1/ISV/Credits/[Channel]

It is marked as [HttpGet("{customer?}")] and is declared as:

public string Credits(string channel="")

in the WebAPI Tester, it is listed as: 

http://localhost:5000/api/v1/ISV/Credits/{channel}

And I can only call it as .../ISV/Credits/WhatsApp (passing the parameter); if I don't pass any parameter, "{channel}" is passed as parameter value.

However, I can call it correctly in PostMan (even though I would prefer using the WebAPI Tester...) with both:

http://localhost:5000/api/v1/ISV/Credits

http://localhost:5000/api/v1/ISV/Credits/WhatsApp

The only workaround I've found to call it from WebAPI Tester is to mark the method with both [HttpGet] and [HttpGet("{channel}")]. If I mark the method as [HttpGet, Route("ISV/Credits/{channel?}")] I get the same effect: working in PostMan but not in WebAPI Tester.

Is there anything I can do to test the call properly with WebAPI Tester? (i.e.: editing the query command before pressing "Send")

Thanks,

GL

Logan Liu @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 18 May 2021 09:17 AM UTC
  2. SnapDevelop
  3. # 1

Hi GL,

"Is there anything I can do to test the call properly with WebAPI Tester? (i.e.: editing the query command before pressing "Send")"

The Web API Tester hasn't supported optional parameters well. You can click '+' to add a new tab to create another custom request to work around it.

Kindly please report your Web API Tester issue via our support ticketing system to ensure it is being properly received by our tech support and tracked at: https://www.appeon.com/standardsupport/

Regards,

Logan

 

Comment
  1. Gian Luca De Bonis
  2. Tuesday, 18 May 2021 11:35 AM UTC
Thank you, Logan - 6618
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.