Data processing, and code enhancements

I’m trying to set up an integration using the YouTube Data API. Here are my specific needs:

  1. Looping: The API returns a maximum of 50 items per call. I want to retrieve 100 items by making two calls. I’ve managed to chain two HTTP modules using the nextPage token, but is this the only way? Can I achieve this in a more automated manner, perhaps with a script?

  2. Merging Responses: I need to merge 16 responses collected over various weeks (current week, 2 weeks ago, 4 weeks ago, 8 weeks ago) into a single array. How can I do this effectively?

  3. Adding Fields to Dictionaries: I want to add a category field to each item in the response lists, indicating which week’s data they belong to. How can I implement this?

  4. JavaScript or Python Code: I see there is a “Custom JS” module, but it’s paid. Are there free options available? While I’m using a no-code tool, I feel some simple solutions might be more feasible with code.

  5. Set Variable: I’m finding it cumbersome to store variables by creating individual modules. Can I use a dictionary to streamline this process? Perhaps by referencing module values in the JSON creation process and making it accessible through drag-and-drop or similar means?

Welcome to the Make community!

Nope, you’ll need to make two HTTP calls either way, unless the API allows you to increase the limit or page size. For more information, refer to the API Documentation for the endpoint you are trying to call.

samliewrequest private consultation

1 Like

You can use the built-in function merge, which merges more than one array.

e.g.:

merge(array1; array2; array3; array4; array5)

For more information, see https://www.make.com/en/help/functions/array-functions.html#merge--array1--array2------

samliewrequest private consultation

2 Likes

You can use the 0CodeKit “Run JavaScript JS-Code” or “Run JS Scripts hosted on 0CodeKit” modules

Screenshot_2024-04-30_180449

Website: Services and Products

Pricing: 0CodeKit Pricing

samliewrequest private consultation

1 Like

You can use the Tools “Set Multiple Variables” module for this

Screenshot_2024-04-30_180413

I’m not sure what you mean by this. Perhaps provide some screenshots of what you are trying to achieve?

If you need further assistance, please provide the following:

1. Screenshots of module fields and filters

Please share screenshots of relevant module fields and filters in question? It would really help other community members to see what you’re looking at.

You can upload images here using the Upload icon in the text editor:
Screenshot_2023-10-07_111039

2. Scenario blueprint

Please export the scenario blueprint file to allow others to view the mappings and settings. At the bottom of the scenario editor, you can click on the three dots to find the Export Blueprint menu item.

Screenshot_2023-08-24_230826
(Note: Exporting your scenario will not include private information or keys to your connections)

Uploading it here will look like this:

blueprint.json (12.3 KB)

3. And most importantly, Input/Output bundles

Please provide the input and output bundles of the modules by running the scenario (or get from the scenario History tab), then click the white speech bubble on the top-right of each module and select “Download input/output bundles”.
Screenshot_2023-10-06_141025

A.

Save each bundle contents in your text editor as a bundle.txt file, and upload it here into this discussion thread.

Uploading them here will look like this:

module-1-input-bundle.txt (12.3 KB)
module-1-output-bundle.txt (12.3 KB)

B.

If you are unable to upload files on this forum, alternatively you can paste the formatted bundles in this manner:

  • Either add three backticks ``` before and after the code, like this:

    ```
    input/output bundle content goes here
    ```

  • Or use the format code button in the editor:
    Screenshot_2023-10-02_191027

Providing the input/output bundles will allow others to replicate what is going on in the scenario even if they do not use the external service.

Following these steps will allow others to assist you here. Thanks!

samliewrequest private consultation

2 Likes

1. Additional Questions:

  • Increasing API Calls in Multiples:

I understand you’re making repeated calls to retrieve data for different time periods (previous week, next week, etc.), but as this extends further into the future, you’re faced with an ever-increasing number of calls. Is there a way to manage this efficiently, without exponential growth?

  • Dynamic Module Reference:

To retrieve 100 items, you’re performing two calls in sequence by passing the nextPageToken to the second call. Can this process be automated using a loop, where the module references are dynamically assigned?


3. Additional Question:

  • Processing Items Array:

You’ve received an array of items. How can you add a new “category” field to each item, indicating its respective week? How can this data be processed effectively?

@Hyungmo_Kang

This will be helpful:
Transform your YouTube Channel with Make:

1 Like

YouTube integration is not important, but I would like to know about support from make.com to see if it is possible to intervene in data communication and the received data dictionary.