Array in module response

Hi,

I’m new to make and i am working on a custom app and I have a module where I want to define the response, so the user can use specific values from the array in the next module. The Problem is i don’t know how to define it in the interface tab. I can’t find how to define the array content (a collection in my case)

let’s say my response looks like this

{
  "id" : 12,
  "data" : [{"name": "name1","value" : 1234},{"name": "name1","value" : 1234}]
}

I would like an example for this or another array. Or how to handle this for best user experience

Hello Tobias,

if you define the module’s output to the array called users:

"response": {
		"output": "{{item}}",
		"iterate": "{{body.users}}",
		"limit": "{{parameters.limit}}"
	}

then you need to specify the parameters that will appear in one item in the array. For each parameter, you need to specify original name from API, its type and label that will appear to the user:

[
      [
	{
		"name": "id",
		"type": "uinteger",
		"label": "User ID"
	},
	{
		"name": "email",
		"type": "email",
		"label": "Email address"
	},
	{
		"name": "name",
		"type": "text",
		"label": "Name"
	},
	{
		"name": "created",
		"type": "date",
		"label": "Date created"
	}
]

Read more about interfaces: https://docs.integromat.com/apps/app-blocks/interface
Read more about communication: Communication - Make Apps

2 Likes

thank you, if i define it like you said, how can i also add more values of the APIs response on the same layer as the array? I am asking because in the user definition of yours i cant find the connection that this is connected to the array. Like my example showed there was “id” and “data”

If the item in the array will look this way:

{
  "id" : 12,
  "data" : [
                   {
                       "name": "name1",
                       "value" : 1234
                   },
                   {
                       "name": "name1",
                       "value" : 1234
                   }
                ]
}

then the interface specification should look like this:

[
  {
    "name": "id",
    "type": "number",
    "label": "ID"
  },
  {
    "name": "data",
    "type": "array",
    "spec": {
      "type": "collection",
      "spec": [
        {
          "name": "name",
          "type": "text"
        },
        {
          "name": "value",
          "type": "number"
        }
      ]
    },
    "label": "Data"
  }
]

You can use the Generator feature: Interface - Make Apps

2 Likes