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