to me need integrate javascript rest api with app on spring-boot, rest api gets json and making URL. How to call a method in a rest controller in javascript and get json? Help me please
Controller:
@RestController
@RequestMapping("/api/v1/vk-pay")
public class VKPayController {
private final PaymentService paymentService;
@Autowired
public VKPayController(@Qualifier("VKPayServiceImpl") PaymentService paymentService) {
this.paymentService = paymentService;
}
@GetMapping("/{id}")
private Parameters getParams(@PathVariable("id") Long orderId,
@AuthenticationPrincipal UserDetails user){
VKPayPayment payment = paymentService.createOrder("captureUrl", orderId);
paymentService.save(payment,user.getUsername(),orderId);
return payment.getParam();
}
}
javascript:
params = how to get json from restcontroller?
VK.App.open('vkpay', '''params''');