Issue with Zoho Analytics API when adding rows using Postman

Issue with Zoho Analytics API when adding rows using Postman

Dear Zoho Support,

 

I have been encountering an issue while attempting to add rows to a table using the Zoho Analytics API through Postman.

 

My goal is to iterate over all Postman global variables that end with '_Managed_Devices' or '_Managed_Computers', and add a row for each distinct customer to a Zoho Analytics table. The customer name is derived from the prefix of the variable name before '_Managed'. For each customer, I need to add the values of the variables ending with '_Managed_Devices' and '_Managed_Computers' to the 'Managed Devices' and 'Managed Computers' columns, respectively.

 

However, when I attempt to send a POST request to the API endpoint (https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/views/<view-id>/rows), I receive a 400 status code with the following error message:

{

  1.     "status":"failure",

        "summary":"LESS_THAN_MIN_OCCURANCE",

        "data":{

            "errorCode":8504,

            "errorMessage":"The parameter CONFIG is not proper(Has not been sent or is less than required count)"

        }

    }

Here's the JavaScript code I have been using in Postman:

  1. let variables = Object.entries(pm.globals.toObject());

     

    let customerData = {};

     

    variables.forEach(([key, value]) => {

        if (key.endsWith('_Managed_Devices') || key.endsWith('_Managed_Computers')) {

            let customerName = key.split('_Managed')[0];

            let column = key.endsWith('_Managed_Devices') ? 'Managed Devices' : 'Managed Computers';

            if (!customerData[customerName]) {

                customerData[customerName] = {};

            }

            customerData[customerName][column] = value;

        }

    });

     

    let index = 0;

    let customers = Object.keys(customerData);

     

    function sendRequest() {

        if (index >= customers.length) {

            return;

        }

     

        let customerName = customers[index];

        let data = customerData[customerName];

        let row = {

            "columns": {

                "CustomerName": customerName,

                ...data

            }

        };

     

        let url = `https://analyticsapi.zoho.com/restapi/v2/workspaces/1932361000000233498/views/1932361000003095084/rows`;

        let headers = {

            'Content-Type': 'application/json',

            'ZANALYTICS-ORGID': '686374358',

            'Authorization': 'Bearer 1000.7bff9da5ed925ea251a9484825181773.af524e4bc307b17446b6a9f4f88e29c2'

        };

        let requestBody = {

            data: [row]

        };

     

        pm.sendRequest({ url: url, method: 'POST', headers: headers, body: JSON.stringify(requestBody) }, function (err, res) {

            if (err) {

                console.log(err);

            } else {

                console.log(res.json());

            }

            index++;

            sendRequest();

        });

    }

     

    sendRequest();

Could you please help me understand what is causing this error and how I can resolve it? I want to ensure that the CONFIG parameter is being used correctly.

 

Thank you for your assistance.

 

Best Regards,


    Access your files securely from anywhere

        Zoho Developer Community




                                  Zoho Desk Resources

                                  • Desk Community Learning Series


                                  • Digest


                                  • Functions


                                  • Meetups


                                  • Kbase


                                  • Resources


                                  • Glossary


                                  • Desk Marketplace


                                  • MVP Corner


                                  • Word of the Day



                                      Zoho Marketing Automation
                                              • Sticky Posts

                                              • Announcing Zoho Analytics 6.0 Beta!

                                                We are delighted to open up the next major version, Zoho Analytics 6.0 Beta! The new version comes packed with a wide range of functionalities for all persona, namely business users, data analysts, data engineers, and data scientists. Zoho Analytics team
                                              • What's New in Zoho Analytics - August 2024

                                                Hello Users! We are back with the latest updates and enhancements made to Zoho Analytics. Keep reading to learn more about them. Connect to the data hosted in the cloud without allow-listing the IP addresses Utilize Zoho Databridge to connect to the data
                                              • We are coming to your city! Zoho Analytics Community Meetup

                                                Hello, business leaders and data enthusiasts! We are delighted to announce that registrations are now open for the ZUG meetups, and we can't wait for you to be a part of them. Our in-house analytics experts are geared up to lead discussions on constructing
                                              • Zoho Analytics: 2021 Look Back

                                                As we start a new year in 2022, here's some of our top moments from 2021. Zoho Analytics in 2021
                                              • [Customer Talk] PREMO Group's Analyst Interview at Zoho Day 2022

                                                Premo Group, a 50 year old Spanish Manufacturing Company, has been our long-standing customer with #ZohoAnalytics. They've been using our platform for their end-to-end, unified business analytics solution.  Hear more from Claudio Cabeza, Director at PREMO


                                              Manage your brands on social media



                                                    Zoho TeamInbox Resources

                                                      Zoho DataPrep Resources



                                                        Zoho CRM Plus Resources

                                                          Zoho Books Resources


                                                            Zoho Subscriptions Resources

                                                              Zoho Projects Resources


                                                                Zoho Sprints Resources


                                                                  Qntrl Resources


                                                                    Zoho Creator Resources



                                                                        Zoho Campaigns Resources


                                                                          Zoho CRM Resources

                                                                          • CRM Community Learning Series

                                                                            CRM Community Learning Series


                                                                          • Kaizen

                                                                            Kaizen

                                                                          • Functions

                                                                            Functions

                                                                          • Meetups

                                                                            Meetups

                                                                          • Kbase

                                                                            Kbase

                                                                          • Resources

                                                                            Resources

                                                                          • Digest

                                                                            Digest

                                                                          • CRM Marketplace

                                                                            CRM Marketplace

                                                                          • MVP Corner

                                                                            MVP Corner





                                                                              Design. Discuss. Deliver.

                                                                              Create visually engaging stories with Zoho Show.

                                                                              Get Started Now