First attempt generating data through API

Howdy. Not very experienced but trying to generate some mock data through the API using Zoho’s Deluge language.
Does a schema have to be created or can I generate data on-the-fly with parameters?

Here’s what I’m trying (with my key):

	field1 = Map();
	field1.put("name", "accountName");
	field1.put("type", "Company Name");
	fields = field1.toJsonList();
	headers = map();
	headers.put("Accept", "application/json");
	url = "https://api.mockaroo.com/api/generate.json?key=abc1230&count=10&fields="+fields;
	accounts = invokeURL
    [
    	url: url
    	type: GET
		headers: headers
    ];
	info accounts;

And I’m getting the following error:

  • {“error”:“undefined method `each_index’ for {“name”=>“accountName”, “type”=>“Company Name”}:Hash\nDid you mean? each_with_index”}

This is what my URL looks like:

https://api.mockaroo.com/api/generate.json?key=abc123&count=10&fields={“name”:“accountName”,“type”:“Company Name”}

Thanks!

The problem is that the fields parameter should be an array of hashes, not a hash.