API date issue - parameter

ukerandi
ukerandi used Ask the Experts™
on
Hi Experts,

see python code below. i have converted to C#. but i'm getting bad request error.
Same way i did for other request all are working fine.But i think something problem with Date parameters.
Any idea where i'm doing mistake?

Python code is wworking fine
Python code
import requests

url = "https://api.bamboohr.com/api/gateway.php/test/v1/time_off/requests/"

querystring = {"start":"2019-12-01","end":"2020-01-15"}

headers = {
    'accept': "application/json",
    'authorization': "Basic 4YWNhYzUxMjY3MmFlYWIxNzQ3MzZjMDY0ZA=="
    }

response = requests.request("GET", url, headers=headers, params=querystring)

print(response.text)

Open in new window


See my C# Code
 var request = new RestRequest(whourl, Method.GET);
            request.AddHeader("Content-Type", "application/json");
           
            request.AddParameter("start","2019/12/01");
            request.AddParameter("end","2020/01/15");
            
            IRestResponse response;
            RestClient _iRestClient = new RestClient(Config.ApiUrl);
            _iRestClient.Authenticator = new HttpBasicAuthenticator(Config.ApiKey, "x");
            try
            {
                response = await _iRestClient.ExecuteTaskAsync(request);
            }
            catch (Exception ex)
            {
                throw new Exception("Error executing Bamboo request to " + whourl, ex);
            }

Open in new window


Response URI like this

{https://api.bamboohr.com/api/gateway.php/abc/v1/time_off/requests/?start=2019%2f12%2f03&end=2020%2f01%2f05}


Any idea much appriciated
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Architect - Coder - Mentor
Commented:
Hi!
Have you checked if the request issued by the python script is identical with the one issued by the c# code? For sure that are some differences. Check this first and we can start from there.

Author

Commented:
@Eduard Ghergu
Thank you very much.Yes you are right. Date format is changed
then it's worked.

Author

Commented:
Thank you very much for your help.really appreciated.
Eduard GherguArchitect - Coder - Mentor

Commented:
Hi! My pleasure! Please, let me know if you need more help.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial