Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

213
Views
How To Send Request To C# Method And Get Its Parameters by Jquery

Is there any way to call an API to know its required parameters? for example, if there is a controller has a method takes a name and date as a parameters

[HttpPost]
 public string testUrl(string name,string date)
 {
    return "success";
 }

now what I am trying to do is to make a dynamic form take an API URL and generate all required inputs so I have to find some way to call the URL and return the required parameters.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The quick and dirty way would be to just hard code it:

[HttpPost]
public string testUrl(string name,string date)
{
    return "success";
}

public APISchema TestUrlSchema(){
    return new APISchema() { 
        Parameters = new List<Parameter>(){
            new Parameter(){ Name = "name", Type = "String" },
            new Parameter(){ Name = "date", Type = "String" }
        }
    };    
}

public class APISchema  {
    public List<Parameter> Parameters {get;set;}
}

public class Parameter {
    public String Name {get;set;}
    public String Type {get;set;}
}

You could use Reflection to auto-generate this if you want to do it for a large number of actions.

As comments have mentioned, there are libraries Swagger which will do this for you.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!