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

221
Views
Cómo enviar una solicitud al método C# y obtener sus parámetros mediante Jquery

¿Hay alguna forma de llamar a una API para conocer sus parámetros requeridos? por ejemplo, si hay un controlador tiene un método toma un nombre y una fecha como parámetros

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

ahora, lo que estoy tratando de hacer es hacer que un formulario dinámico tome una URL de API y genere todas las entradas requeridas, por lo que tengo que encontrar alguna forma de llamar a la URL y devolver los parámetros requeridos.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

La forma rápida y sucia sería simplemente codificarlo:

 [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;} }

Puede usar Reflection para generar esto automáticamente si desea hacerlo para una gran cantidad de acciones.

Como han mencionado los comentarios, hay bibliotecas Swagger que harán esto por usted.

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!