Last post Aug 24, 2017 06:23 AM by Edward Z
Aug 23, 2017 08:43 AM|samrecd|LINK
Is it possible to have the Help Page sample generator ignore certain properties of a particular type?
For example, we use the same request model for multiple operations.
public class Request
public string name;
public string address;
public string postalCode;
Now operation A will only use property name, and operation B will use address and postalCode properties.
But when you generate the help page the API will contain the parameters name, address and postalCode for both the operations like
I want to customize the API and the API should be -
This will be more relevant to each operations
Aug 23, 2017 09:00 AM|Dmitry Sikorsky|LINK
Yes, this is possible. You can just check the received parameters, whether address and postalCode are null for example. But I would suggest to pass operationCode parameter also, so you will always know what the operation it is.
Aug 23, 2017 09:05 AM|samrecd|LINK
Thanks for your reply.
From the controller it is working fine, I don't have any issue with the service implementation.
I just want to control the parameters in the help page, so that operation A in the help page will only display sample url with 1 parameter
Aug 23, 2017 09:33 AM|Dmitry Sikorsky|LINK
What are you using for help generation?
Aug 23, 2017 09:38 AM|samrecd|LINK
ASP.Net web api help page
Aug 24, 2017 06:23 AM|Edward Z|LINK
What do you mean by Get with Request object?
In my option, for passing object, it is usually used for POST or Put. For Get method, the web api method will be something like below:
public void GetByProperty(string name, string address)
/// Post a request object
/// <param name="request"></param>
/// Post /PostRequest
/// "name":"test name",
/// "address":"test address"
public void PostRequest(Request request)
What is your web api method?
How did you generate help page? Did you try Swagger? If not, I suggest you refer below link to use Swagger which is powerful while generating help page.
# ASP.NET Web API Help Pages using Swagger
By using Swagger, it will generate below help page for above method.