How to set metadata in a Connnection when the endpoint returns an Array

In my custom application, I have a Connection configuration which “Communication” configuration is the following:

{
	"url": "https://myserver/endpoint",
	"headers": {
		"Authorization": "Bearer {{connection.apiKey}}"
	},
	"response": {
		"metadata": {
			"type": "email",
			"value": "{{first(body).owner}}" // <<< NOT WORKING
		},
		"error": {
			"message": "[{{statusCode}}] {{body.error}}"
		}
	},
	"log": {
		"sanitize": [
			"request.headers.authorization"
		]
	}
}

The endpoint returns the following body when requested:

[
  {
    "accountId": "018ade1a-c617-723e-ba1a-ce40d894271b",
    "owner": "bob.wilson@pickaform.com",
    "createdAt": "2023-09-28T23:23:31.223Z",
    "status": "active",
    "id": "018ade1a-c617-723e-ba1a-ce40d894271b"
  }
]

The goal is to retrieve the “owner” property in the metadata of the connection.

The returned array of the API always has a single item, and I would like to get this first item, then grab its “owner” property.

I tried many different syntaxes, and none of them work.
Any suggestion?

Welcome to the Make community!

Try

{{body.1.owner}}

Hope this helps! Let me know if there are any further questions or issues.

@samliew

P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.

Wow thanks, I will try that right away!

FYI, just tried this solution and it doesn’t generate any error, but it does not feed the metadata of the connection properly (it stays blank), despite the API endpoint returns the right data, in the array.

But there is no problem => as a workaround, I updated the API of my SaaS to not return an array anymore… I don’t want to spend days on a weird syntax problem that I can solve on the other side!

Thanks a lot for your help.