How to pass hash in Postman


By the looks of what you are trying to send, you need to change the Grape restriction, because destinations is an Array, not a Hash:

requires :destinations, type: Array
 
You don't need the "destination" hash when sending the request:

{ destinations => [ 
  { name => 'dest1', other_attribute: 'value', etc... },
  { name => 'dest2', other_attribute: 'value', etc... }, 
  { name => 'dest3', other_attribute: 'value', etc... }
]}
 
This creates an Array of hashes.
In order to send this through POSTMAN, you'll need to modify that destinations
param your sending and add multiple lines in POSTMAN. Something like:

destinations[][name]                'dest1'
destinations[][other_attribute]     'value1'
destinations[][name]                'dest2'
destinations[][other_attribute]     'value2'
destinations[][name]                'dest3'
destinations[][other_attribute]     'value3'
 
Hope this answers your questions. Let me know if this is what you were looking for.

Comments

Popular Posts

nginx: unrecognized service

Bootstrap Select Picker append add new item if search not exist

Reading Excel Sheets using "Roo" gem in ruby on rails

Add CORS to Nginx on AWS Elastic Beanstalk

Enable gzip compression on Elastic Beanstalk with nginx

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

Get video duration by URL in Ruby on Rails

site-enables nginx setting in ruby in rails