I want to pass a value stored in a variable to a dateopen / datemodified filter but for some reason no data is returned.
Here is part of my sample C# code:
DateTime targetDate = DateTime.Now.AddDays(-3);
HttpWebRequest request = WebRequest.Create("https://api.myintervals.com/task/?dateopen=targetDate") as HttpWebRequest;
Please anyone assist.
I've noticed a few issues that might be impeding your progress.
1. My C# is not very good, but I believe that if you want to use a variable within a string, you have to concatenate the string. Furthermore, since targetDate is an object of type DateTime, to use it in a string you may have to explicitly convert it to a string to be used as part of a URL. I belive your second line should be
HttpWebRequest request =
WebRequest.Create("https://api.myintervals.com/task/?dateopen=" + targetDate.ToString())
as HttpWebRequest;
2. Furthermore, you need to ensure that your targetDate gets sent to the URL in ISO-8601 format.
3. Finally, the dateopen filter only returns tasks that were opened on that particular date, so for items to be returned, please ensure that your Intervals account actually has at least one task that was opened/started three days prior to the date on which you run the code. Otherwise, the list will be empty.
I hope that is enough to get you started. Please let me know if you have any further questions.
1 to 2 of 2
Comments are closed.
For more Intervals help documentation, please visit help.myintervals.com