我已经用Moqui框架实现了一个应用程序,我可以通过下面的url得到json响应
http://localhost:8080/moqui/rest/s1/moqui/users
现在我需要将数据插入到表中,我该怎么做呢?在moqui.rest.xml中,我在方法中有资源,如下所示
method type="post“服务name="org.moqui.impl.UserServices.create#UserAccount”/method
为此,我需要一个网址,可以插入数据到表中。
发布于 2016-05-30 21:24:43
我尝试实现了完全相同的功能。我在Windows笔记本电脑上使用cURL (一个端点),它与Moqui实例(另一个端点,具有/moqui/users服务本身的端点)通信。这是我所做的:
根据Swagger UI (http://localhost:8080/toolstatic/lib/swagger-ui/index.html?url=http%3A%2F%2Flocalhost%3A8080%2Frest%2Fservice.swagger%2Fmoqui#/users)中的定义,
这是示例数据和cURL命令本身。注意Windows中的语法,单个配额可能会把它搞乱。这就是为什么数据存储在文件中的原因。
curl -X POST -u john.doe:moqui --header "Content-Type:application/json" --header "Accept:text/html" -d "@body.json" http://localhost/rest/s1/moqui/users{"username":"edward",“newPassword”:“BhsmsAv1^^.”,“newPasswordVerify”:“BhsmsAv1^^.”,"requirePasswordChange":"N","userFullName":"Edward Bolt","emailAddress":"ed@acme.com","currencyUomId":"EUR","locale":"sk","timeZone":"CET"}
将此用户数据放入文件中,并将其命名为body.json。然后运行该命令,有一个指向body.json文件的引用。希望这能有所帮助。
https://stackoverflow.com/questions/37497356
复制相似问题