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

238
Views
Para una solicitud de recuperación de publicación, ¿cómo puedo especificar una identificación como parámetro?

En primer lugar, especifiqué la identificación real en la URL y luego definí el cuerpo. Desafortunadamente no funciona, recibí un código de error 400 del servidor.

Me gustaría agregar un nuevo jugador al club seleccionado. ¡Entonces mi solicitud de publicación está esperando una identificación y un cuerpo como parámetros!

Esta es mi solicitud de búsqueda de publicación que probé:

 fetch('https://localhost:44374/Player/' + selectedClub.clubId, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify( { playerId: id, playerName: name, countryCode: code, playerCountry: country, playerBirthdate: birthdate, playerPosition: position, shirtNumber: shirtnumber, height: height, preferredFoot: preferredfoot, playerValue: value, clubId: selectedClub.clubId, club: selectedClub })}) .then(response => response) .then(data => { console.log('Success:', data); }) .catch((error) => { console.error('Error:', error); });

ACTUALIZAR

Este es el PlayerController en backend:

 [HttpPost("{clubId}")] public void AddPlayerToClub(int clubId, [FromBody] Player player) { clubLogic.AddPlayerToClub(clubId, player); hub.Clients.All.SendAsync("PlayerCreated", player); }

La solicitud de publicación en el swagger:

IMAGEN

about 4 years ago · Juan Pablo Isaza
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!