0

I'm building an Shiny-App with different API connections. It's all running on a server (CentOS Redhat). I've got a problem with my API. If I'm running this on my terminal (Mac), everything works.

curl --data "InvestAmountInWei=2000000000000000000&Address=Test“ "http://s*******aw.ch:8002/invest"

Same with the Postman-App. I can do a post there and all will be done perfectly. The post request should transfer the ammount and the adress (like an id) to my r-script which is running via plumber. As sad, if I do this command through terminal or Postman it works. But I need to do this command with the webbrowser.

I used this link to test it:

http://s*********aw.ch:8002/invest?InvestAmountInWei=1000000000000000000&Address=Jennifer

and now I only get this error in my web browser: {"error":["404 - Resource Not Found"]}

If checkt the iptables as well and it should be fine.

# netstat -ntpl | grep 8002
tcp        0      0 16*.**.**.*6:8002           0.0.0.0:*                   LISTEN      28563/R 

any ideas how I can solve this problem?

D. Iseli
  • 61
  • 8

1 Answers1

0

When you make a request to a URL in your browser, that's a GET request. If you setup your endpoint to support GET and POST requests at the same location, your browser and Postman requests should both work just fine.

If you want your browser to send a POST request, you'll either need to submit a form to it or use JavaScript.

Jeff Allen
  • 17,277
  • 8
  • 49
  • 70