luxin88 / chrome-rest-client

Automatically exported from code.google.com/p/chrome-rest-client
0 stars 0 forks source link

POST request containing JSON arrays #228

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Is it possible to send a POST requst to a RESTful service with your tool 
encoded as 'application/json', containing JSON arrays? How would I generate a 
request with JSON arrays?

    { "id":"2" 
     ,"name":"Bob"
     ,"addresses":[{"street":"Long Street 1","town":"Short Village"}
                  ,{"street":"Short Street 1000","town":"Long Village"}]}

When I try to use the Raw Panel, I get URL encoded parameters, and no JSON Raw 
content, as I would have expected.
   id=2&name=Bob&addresses=%3F 

Is it possible to either generate a request with JSON array, or where do I 
enter the JSON Raw data (with which content-type settings in your tool)?

Thanks for your effort

Original issue reported on code.google.com by lukaszie...@gmail.com on 13 Jan 2014 at 12:07

Attachments:

GoogleCodeExporter commented 9 years ago
I think I have found the solution. My mistake was trying to fit the JSON Arrays 
into the Form fields (being a contradiction by itself). 

The solution was to solely use the Raw panel & copy/paste the JSON code 
(includining the JSON Arrays) there.

Original comment by lukaszie...@gmail.com on 13 Jan 2014 at 3:38

Attachments:

GoogleCodeExporter commented 9 years ago
feel free to close / remove the issue.

Original comment by lukaszie...@gmail.com on 13 Jan 2014 at 3:38

GoogleCodeExporter commented 9 years ago
This post was helpful to me... thank you.

Original comment by bendaka...@gmail.com on 5 Jun 2014 at 7:49

GoogleCodeExporter commented 9 years ago
thanks lot

Original comment by bhushanv...@gmail.com on 15 Jun 2014 at 7:30

GoogleCodeExporter commented 9 years ago
Hi i am working on Web Api's and i am not finding way how to use chrome rest 
client for post method with parameters if i have parameters in key-value pair 
where key is blank and value has all the values
like this:
{ '': '{"UserEmail":"pankaj.softprodigy1@gmail.com","UserPassword":"123456" }' 
},
and the method is written as :
  public string PostLogin([FromBody] string value)
{
}
where value has to accept this.

Original comment by sheetalb...@gmail.com on 19 Jun 2014 at 6:21

GoogleCodeExporter commented 9 years ago
The best approach usually is to see what the GET response of your API looks 
like and to take this as the base for your POST/PUT call.

Also take a look at the screenshot "POST-successful.gif". Your JSON code most 
likely is missing squared brackets... and do you hash encode the user password?

Original comment by lukaszie...@gmail.com on 19 Jun 2014 at 9:22