how can i access riak Kv by using my own developed rest Api using curl

200 Views Asked by At

On same Remote Server I have to installed

  1. Tomcat7.0

  2. Riak kv

after that I set tomcat host as my Remote server IP,and riak host as localhost, then I am able to interact with riak using my Own Rest API.

for Example:

Through Postman:-

I am hitting Url :- http://localhost:8080/Apps/webapi/policy/savePolicy

having body :-

{ "id": "1110007836", "policyDTOs": [ { "policyNumber": "1000067730-12", "brandCode": null, "policystatus": null, "commencementDate": null, "issueDate": "16/04/2016", "endDate": "15/04/2017", "policyPeriod": null, "applicationNumber": "1000067730-12", "planOpted": "Easy Health Individual Standard", "planOptedCode": "11006", "riskStartDate": "16/04/2016", "riskEndDate": "15/04/2017", "policyId": null, "proposerName": "Ms Sonali Arora", "address": "330/4 Ram Nagar", "town": "Gurgaon", "district": null, "state": "Haryana", "country": "India", "pinCode": "122001", "emailId": "[email protected]", "mobile": "9958791166", "phoneFirst": null, "phoneSecond": null, "modeOfPayment": "Cheque/Cash-Dir", "loading": "0.00", "discount": 0, "grossPremium": 1751.34, "paymentMadeBy": null, "nomineeName": "MRS Asha Arora", "relationShipToPolicyHolder": "Mother", "dependents": [ { "isExpired": null, "expiryDate": null, "lastRefreshTime": null, "keyValue": null, "createdDate": null, "modifiedDate": null, "memberId": "1110007837", "firstName": null, "middleName": null, "lastName": null, "fullName": "Ms Sonali Arora", "genderCode": null, "gender": "Female", "dependentBirthDate": null, "birthDate": "21/11/1984", "relationshipCode": null, "relationship": "Self", "sumInsuredForDependent": null, "sumInsured": null, "criticalIllinessRiderForDependent": null, "titleCode": null, "title": null, "clientCode": null, "maritalStatusCode": null, "nationalityCode": null, "annualIncome": null, "height": null, "weight": null, "productCode": 11108, "productType": null, "productName": null, "grossPremium": null, "sumInsuredForDependentStr": "100000", "dependentStatus": "Active", "sumAssuredCI": null } ], "policyClaimPeriod": "2012 - 2013", "sumInsuredFloater": "100000", "memberId": "1110007836", "fullPolicyNumber": "110103/11001/1000067730-02", "ciRiderFlag": false, "policyType": "RETAIL" } ], "policyExpired": false }

then saving this info with respect to its id.

now I want to save data by using curl command with same rest api, how can I do that,,,,,, I am not able to use curl command in this api to save the info.

1

There are 1 best solutions below

1
On

Please have a look at the documents here: http://docs.basho.com/riak/kv/2.2.0/developing/usage/creating-objects/

There are examples of using HTTP Post to write to Riak KV including:

curl -XPUT \
-H "Content-Type: text/plain" \
-d "vroom" \
http://localhost:8098/types/cars/buckets/dodge/keys/viper