how to get more than 2000 records using COQL?

how to get more than 2000 records using COQL?

I am using this query below to get the first 2000 records using COQL:

  1. SELECT Deal_Name, id from Deals WHERE Created_Time between '2024-08-06T00:00:00+07:00' and '2024-10-07T23:59:59+07:00'LIMIT 2000

I send request using this code
var data = {
'select_query': query,
};

var headers = {
'Authorization': "Zoho-oauthtoken " + accessToken
}

var options = {
'method' : 'post',
'contentType': 'application/json',
'payload' : JSON.stringify(data),
'muteHttpExceptions': true,
'headers': headers
};
var response = UrlFetchApp.fetch(url, options);
var responseCode = response.getResponseCode();

and then I check if it has more records available or not using the code below:
var json = JSON.parse(response.getContentText());
var hasMoreRecords = json.info.more_records;

if hasMoreRecords == true then I need to fetch the next 2000 records using the query below:
  1. SELECT Deal_Name, id from Deals WHERE Created_Time between '2024-08-06T00:00:00+07:00' and '2024-10-07T23:59:59+07:00'LIMIT 4000, 2000

but I got 204 as response code, which means I don't have any other record available even though I actually have more than 2000 records.

so how to get the next 2000 records using COQL? I suspect I write the query wrong

    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


                                              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