【发布时间】:2018-08-11 16:38:42
【问题描述】:
嗨,我是个菜鸟,我正在尝试学习如何在 Spring Boot 中使用它。
我使用 Spring Boot Data Rest 生成了一个 Rest 服务,由于我没有所有关于 rest 的基础知识,我想知道如何使用 POST 插入我的数据库,因为我知道我有一个如下所示的答案
http://localhost:8080/mNG_USERs
{
"_embedded": {
"mNG_USERs": [
{
"us_cextusr": "1234e",
"us_nomusr": "test",
"us_prnusr": "test",
"us_pwdusr": "123456",
"us_datdeb": "2018-03-03",
"us_datfin": "2018-03-03",
"us_nbrerr": 1,
"us_datcre": "2018-03-03",
"us_datmaj": "2018-03-03",
"us_etatusr": null,
"us_typusr": null,
"us_lastprg": null,
"us_nivacc": null,
"_links": {
"self": {
"href": "http://localhost:8080/mNG_USERs/1"
},
"mNG_USER": {
"href": "http://localhost:8080/mNG_USERs/1"
},
"us_langue": {
"href": "http://localhost:8080/mNG_USERs/1/us_langue"
},
"us_lastuser": {
"href": "http://localhost:8080/mNG_USERs/1/us_lastuser"
}
}
}
]
},
"_links": {
"self": {
"href": "http://localhost:8080/mNG_USERs{?page,size,sort}",
"templated": true
},
"profile": {
"href": "http://localhost:8080/profile/mNG_USERs"
}
},
"page": {
"size": 20,
"totalElements": 1,
"totalPages": 1,
"number": 0
}
}
我正在使用邮递员生成请求我知道我应该使用POST请求但我不知道如何写它
【问题讨论】:
-
在你去尝试做这样的事情之前,你应该看看 REST 基础知识。您可以获得显示的代码,但除非您了解所显示的是什么,否则它根本不会使您受益。
-
spring.io/understanding/REST 请问我能从中得到什么
标签: java spring rest spring-boot