custom_date field for timesheets

custom_date field for timesheets

Hello everyone, I would appriciate it a lot if someone can help me solve this issue, the custom_date field is not working for me and I always get the following error:
{'error': {'code': 6831, 'message': 'Input Parameter Missing'}}

and I always encode the custom date properly but it's not working out, I searched a lot for an answer but found nothing.
Here is my code, if anyone can help with that, I really appriciate it:


import requests
import json
import urllib.parse

def run_timesheets():


    custom_date = {"start_date": "09-01-2024", "end_date": "10-16-2024"}

    custom_date_json = json.dumps(custom_date)

    encoded_custom_date = urllib.parse.quote(custom_date_json)

    # Construct the URL with the encoded custom_date
    url = f"{BASE_URL}/portal/{PORTAL}/logs?users_list=all&view_type=custom_date&custom_date={encoded_custom_date}&bill_status=all&component_type=task"

    headers = {
        'Authorization': f'Bearer {ACCESS_TOKEN}',
        'Content-Type': 'application/json'
    }

    response = requests.get(url, headers=headers)

    # Handle the response
    try:
        data = response.json()  # Parse the response as JSON
    except json.JSONDecodeError:
        data = {"timelogs": {"date": []}}
        print(f"Response error {response.status_code}: {response.text}")

    # Process the time logs
    timesheets = []
    if 'timelogs' in data:
        timesheets = data['timelogs']

    return timesheets

    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


                                                                          • Tips

                                                                            Tips

                                                                          • 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