次のページを参考にしました。
httr quickstart guide
http_post.R
# ---------------------------------------------------------
# http_post.R
#
# Mar/07/2018
#
# ---------------------------------------------------------
write("*** 開始 ***", stderr())
library (httr)
rr <- POST("https://httpbin.org/post", body = list(user = "jiro", password="123456"))
print ("---------------------")
http_status(rr)
print ("---------------------")
str(content(rr))
print ("---------------------")
rr
write("*** 終了 ***", stderr())
# ---------------------------------------------------------
実行コマンド
Rscript --no-restore --no-save http_post.R
次のバージョンで確認しました。
$ Rscript --version
Rscript (R) version 4.2.1 (2022-06-23)
Get の例はこちら
R の http クライアントの使い方 (Get)