I'm looking for how to add a string token with @Body annotation in Android retrofit for a post request. There was a token given to each patient after a successful registration so that it can be used for authentication so I want to pass the token along side with the body when the patient want to book an appointment with the Doctor. Note this token is not like an Header for authorization so I cannot used @Header annotation but it was a request parameter that needs to be passed alongside with the dto class.Here is how I tried but it's not working, saying that the @Field annotation can only be used with a Form.
@POST("appointment/book")
Call<ApiResponse> bookAppointment(@Body AppointmentBookingDto appointmentBookingDto, @Field("token") String token);
The backend is with spring boot and this is how it's
@PostMapping("/book")
public ResponseEntity<ApiResponse> bookAppointment(@RequestBody AppointmentBookingDto appointmentBookingDto, @RequestParam("token") String token) throws DataNotFoundException, ParseException, DataAlreadyExistException {
return appointmentBookingService.bookAppointment(appointmentBookingDto,token);
}