0

我试图在我的 Postgresql 数据库中插入数据,但我失败了。

所以基本上我可以用下面的查询选择数据;

curl 10.127.18.18:3001/mytable

我可以通过此请求获取所有行。

我尝试了以下命令的很多组合,但都失败了。如何使用 postgREST 插入基本数据?

mytable ”表有 2 列,“ user_id ”和“ username ”;

curl POST 10.127.18.18:3001/mytable { "user_id": 3333, "username": testuser }
curl -X POST 10.127.18.18:3001/mytable HTTP/1.1 { "user_id": "3333", "username": "testuser" }

谢谢!

4

1 回答 1

0

对于那些遇到同样问题的人,这个查询对我有用;

curl --location --request POST '10.127.18.18:3001/mytable' --header 'Content-Type: application/json' --data-raw '{  "user_id": "11", "username": "test"  }'
于 2021-06-15T10:25:35.420 回答