How to Get Multiple Select from Array in Notion?

Hi,

I’m trying to fill out a multi select field in Notion from a piece of JSON, received from an HTTP GET request. The JSON I’m getting from the GET request, looks like this:

"items": [
{
  "resourceURI": "http://gateway.marvel.com/v1/public/characters/1009220",
  "name": "Black Cat"
},
{
  "resourceURI": "http://gateway.marvel.com/v1/public/characters/1009262",
  "name": "Spider-Man (Ben Reilly)"
}]

So I’m using an Iterator and an Array Aggregator to reduce that JSON to just the part I need, which is the name.

The output of that looks like this:

[
    {
        "array": [
            {
                "__IMTKEY__": "Black Cat"
            },
            {
                "__IMTKEY__": "Spider-Man (Ben Reilly)"
            }
        ],
        "__IMTAGGLENGTH__": 2
    }
]

In Notion, I’m mapping this to the Tags field of my DB, but I’m getting a 400 error:


The setup of the two modules.

In Notion, “Tags” is a Multi-Select field.

The operation failed with an error. [400] body failed validation. Fix one: body.properties.Tags.multi_select[0].id should be defined, instead was `undefined`. body.properties.Tags.multi_select[0].name should be a string, instead was `{"__IMTKEY__":"Black Cat"}`.

This is not a connection issue with the DB, I’m modifying a number of other properties in this same DB within this scenario.

The end result I’m looking for would look like this in Notion:

I’ve looked around the forums and found a number of similar questions, but no answers.

Thanks!

1 Like

Same issue here. 400 each time

Hi @Lukas,

In your array aggregator select your Notion field in the “Target structure type” field and map your values directly in the aggregator. Then you just map your array in Notion.


wiseflow.co
Our Blog
Need Make expert support quickly? Book a session

1 Like

Hi @loic.wiseflow,

Thanks for your reply! I’m not seeing any options in that dropdown. Here’s my full structure, in case you’re curious:

Thanks,
Lukas

Hi @Lukas,

It looks like the module is not functioning correctly. I tried everything and I could not find something that output the right thing.

I was able to get it to work with an API call:

  • url: /v1/pages

  • method: POST

  • body:
    the call below populates the “Name” field and the “tags” field.

{
“parent”: {
“database_id”: “a70576f4a8074887859111a9fb212cd6”
},
“properties”: {
“Name”: {
“title”: [
{
“text”: {
“content”: “test API call”
}
}
]
},
“Tags”: {
“multi_select”: [
{“name”: “test1”},
{“name”: “test2”}

        ]
    }
}

}


1 Like

Thank you! This didn’t quite solve it, since I was updating pages rather than creating new ones, but it put me on the right track. I wound up having to do a Patch request, with the URL:

/v1/pages/PAGE-ID

and the Body:

{
    "properties": {
        "Tags": {
            "multi_select": TEXT
        }
    }
}

Where TEXT was the result of a Replace module pulling the results of the array aggregator and replacing every instance of __IMTKEY__ with name.

1 Like

Ah yeah sorry it was just easier for me to go POST. Good job taking this across the finish line. You should submit a ticket so Make can fix that module. It is way harder than it should be

1 Like