Testing RESTful Web Services: try to send an Array

Hallo,

I want to send an Array with the REST Client. 

I have this Array: 

$postData =
['start' => ['rot', 'gelb', 'blau'], 'zweites' => ['erster' => 'roter', 'zweiter' => 'gelber', 'blauer']];

How can I put this Array in the field RequestParameters from the REST Client?

 

I have tryed to urlencode or to serialize... it doesn't work.

I can make this: $postDataQuery = http_build_query($postData)

I can put the $postDataQuery into the RequestBody as "Text" field.

 

So I will get the POST RAW data - But this is not what I want.

 

The Problem: I make a curl-Request (with $postDataQuery) - and then I get the POST - data - how can I simulate this?

Or is this not possible?

Thank you!

 

 

 

0
1 comment

you can try sending each array element as a separate parameter, just as with Postman (https://medium.com/@darilldrems/how-to-send-arrays-with-get-or-post-request-in-postman-f87ca70b154e#.552cnuu8l). make sure to use '[]' suffix for names

Not sure if it works, didn't try myself

0

Please sign in to leave a comment.