How to pass array query string parameter in http request

Hi.

I am developing custom n8n node and i am struggling to send array query search parameter to http call.
This is my code:

        keyword_ids = iExecuteFunctions.getNodeParameter('keyword_ids', i) as string;

        options = {
            method: 'GET',
            uri: `${baseUri}/series`,
            json: true,
            qs: { keyword_ids: keyword_ids.split(",") }
        };
        responseData = await iExecuteFunctions.helpers.requestWithAuthentication.call(
            iExecuteFunctions,
            'nightwatchApi',
            options,
        );

Endpoint i am hitting expects this query parameter: url?url_ids[]=313593

Hi @Matej_Pesjak - welcome to the community! :tada:

Maybe our resident custom node builder @marcus (or even @Jon ) could help you out with this one :bowing_man:

Hi, just solved the mistery by going to source code. This solves it:

    options = {
        method: 'GET',
        uri: `${baseUri}/series`,
        json: true,
        qs: { keyword_ids: keyword_ids.split(",") }
        qsStringifyOptions: { arrayFormat: "brackets" }
    };
3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.