please help on HTTP POST Method with JSON req body

Showing 1-1 of 1 messages
please help on HTTP POST Method with JSON req body Nagarajan Ganesan 4/4/12 9:10 AM

This is Nagarajan from Chennai, India.

 

I’m started learning HTTParty for calling web services.

 

Thanks for that gem.

 

Could you please send me any doc you have on HTTParty.

 

Also please let me know how to send json request body to HTTParty.

 

I have a below req. body:

 

{

"registry": {

"shippingAddressSource": "OTHER","futureShippingAddressSource": "COREGISTRANT",

 

"coRegistrantContactInfo": {"emailAddress": "co1dec5@test.in","bestPhone": "9876543210","lastName": "<colastName>","firstName": "<cofirstName>","middlename":"optional",

"currentAddress": {

"addressLine1": "CORegistrant","addressLine2": "coreg2","addressLine3": "coreg3","state": "NJ","city": "New Jersey","postalCode": "20000","country": "USA"} },

 

"registrantContactInfo": { "emailAddress": "reg1dec5@test.in","bestPhone": "1234567890","lastName": "<relastName>","firstName": "<refirstName>","middlename":"optional",

"currentAddress": { "addressLine1": "Registrant","addressLine2": "reg2","addressLine3": "reg3", "state": "NJ","city": "New Jersey","postalCode": "10000","country": "USA" } },

 

"coRegistrantAddressFromRegistrant": "false", "isFutureAddress":"true",

"futureShippingAddressEffectiveMonth":"08","futureShippingAddressEffectiveDay":"16","futureShippingAddressEffectiveYear":"2018",

"futureShippingAddress" :

{ "addressLine1" : "Future Shipping Address","addressLine2":"#2 address future shipping", "addressLine3":"#3 address future shipping",

"state" : "NY", "city" : "New York", "postalCode" : "94105", "country" : "USA", "attention":"attn-future shipping" },

 

"shippingAddress": {"addressLine1": "685marketst Orion Other","addressLine2": "shipping2","addressLine3": "shipping3","state": "CA","city": "Sanfrancisco","postalCode": "94205","country": "USA" },

 

"registryInfo": { "estimatedNoOfGuests": "95","eventDay": "30","eventMonth": "11","eventYear": "2020","eventLocationStateCode": "CA","eventLocationStateName": "California","preferredStoreID": "71","availableOnTheInternet": "true","publicRegistry": "true","goGreen": "true","registryType": "ANNIVERSARY","subscribeWeddingEmailSalesEvents": "true","couplesMessage": "Happy ANNIVERSARY!"} } }

 

 

I will be reading it from excel sheet and send it to service via HTTParty.

 

Consider that the above JSON req body is in a variable rbody, how can I get it executed via POST method?

 

URL: http://200.56.164.52:11234/wssg-pscore/v2/registry/create

 

Body: as above

 

Headers:

client-id: test123

Content-Type:application/json

     

Can you send me the code sinippet in ruby for this.

 

I know I’m troubling you. Please help me.

 

Thanks in advance.