This is my first time down the API REST road. This is a function in my desktop client application. It appears that the format of the dates is the cause of the errors. Could anyone please see if there is a malformality in the string. Part A is the first attempt at it, part B is where I am at now.
Thanks.
Public Shared Function SearchCurrentIncidents(ByVal incidentTypeID As Int32, ByVal beginDate As DateTime, ByVal endDate As DateTime) As List(Of IncidentNotificationData)
Try
Dim uri As String = String.Format(My.MySettings.Default.Local &
"/IncidentNotificationRESTService.svc/SearchCurrentIncidents/{0}/{1}/{2}", incidentTypeID, beginDate, endDate)
uri is:
http://localhost:60420/IncidentNotificationRESTService.svc
/SearchCurrentIncidents/1/1/14/2013 11:11:55 AM/1/14/2016 11:11:55 AM
Dim uri As String = String.Format(My.MySettings.Default.Local &
"/IncidentNotificationRESTService.svc/SearchCurrentIncidents/{0}/{1}/{2}",
incidentTypeID,
HttpUtility.UrlEncode(beginDate.ToString("yyyy-MM-ddTHH:mm:ssZ")),
HttpUtility.UrlEncode(endDate.ToString("yyyy-MM-ddTHH:mm:ssZ")))
uri is:
http://localhost:60420/IncidentNotificationRESTService.svc/SearchCurrentIncidents/1/2014-0114T13%3a53%3a44Z/2016-01-14T13%3a53%3a44Z
Dim request As WebRequest = WebRequest.Create(uri)
throws exception on this call:
response = request.GetResponse()...