在同一台远程服务器上我必须安装
Tomcat7.0
Riak kv
之后我将tomcat主机设置为我的远程服务器IP,将riak主机设置为localhost,然后我就可以使用我自己的Rest API与riak进行交互。
例如:
通过邮递员: -
我正在打网址: - 的 http://localhost:8080/Apps/webapi/policy/savePolicy
有身体: -
{ “id”:“1110007836”, “policyDTOs”:[ { “policyNumber”:“1000067730-12”, “brandCode”:null, “policystatus”:null, “beginningmentDate”:null, “issueDate”:“2016/04/16”, “endDate”:“2017/04/15”, “policyPeriod”:null, “applicationNumber”:“1000067730-12”, “planOpted”:“易健康个人标准”, “planOptedCode”:“11006”, “riskStartDate”:“2016/04/16”, “riskEndDate”:“2017/04/15”, “policyId”:null, “proposerName”:“Sonali Arora女士”, “地址”:“330/4 Ram Nagar”, “小镇”:“古尔冈”, “district”:null, “州”:“哈里亚纳邦”, “国家”:“印度”, “pinCode”:“122001”, “emailId”:“garimagauri@gmail.com”, “mobile”:“9958791166”, “phoneFirst”:null, “phoneSecond”:null, “modeOfPayment”:“Check / Cash-Dir”, “loading”:“0.00”, “折扣”:0, “grossPremium”:1751.34, “paymentMadeBy”:null, “nomineeName”:“MRS Asha Arora”, “relationShipToPolicyHolder”:“母亲”, “家属”:[ { “isExpired”:null, “expiryDate”:null, “lastRefreshTime”:null, “keyValue”:null, “createdDate”:null, “modifiedDate”:null, “memberId”:“1110007837”, “firstName”:null, “middleName”:null, “lastName”:null, “fullName”:“Sonali Arora女士”, “genderCode”:null, “性别女”, “dependentBirthDate”:null, “birthDate”:“21/11/1984”, “relationshipCode”:null, “关系”:“自我”, “sumInsuredForDependent”:null, “sumInsured”:null, “criticalIllinessRiderForDependent”:null, “titleCode”:null, “title”:null, “clientCode”:null, “maritalStatusCode”:null, “nationalityCode”:null, “annualIncome”:null, “height”:null, “重量”:null, “productCode”:11108, “productType”:null, “productName”:null, “grossPremium”:null, “sumInsuredForDependentStr”:“100000”, “dependentStatus”:“活跃”, “sumAssuredCI”:null } ] “policyClaimPeriod”:“2012 - 2013”, “sumInsuredFloater”:“100000”, “memberId”:“1110007836”, “fullPolicyNumber”:“110103/11001 / 1000067730-02”, “ciRiderFlag”:false, “policyType”:“零售” } ] “policyExpired”:false }
然后根据其ID保存此信息。
现在我想通过使用curl命令和相同的rest api来保存数据,我怎么能这样做,,,,,,我无法在此api中使用curl命令来保存信息。
答案 0 :(得分:0)
请查看此处的文件:http://docs.basho.com/riak/kv/2.2.0/developing/usage/creating-objects/
有一些使用HTTP Post写入Riak KV的例子包括:
curl -XPUT \
-H "Content-Type: text/plain" \
-d "vroom" \
http://localhost:8098/types/cars/buckets/dodge/keys/viper