UPDATE. Never mind, solved it by passing yyyy-mm-dd instead.
Hi everybody,
I'm trying to pass the following:
api/maxKeysOnServer/purgeFingerprintData/20161228/false
The method is defined in API Controller this way:
[Route("purgeFingerprintData/{cutoffDate}/{purgeExpiredPasses}")]
[HttpGet]
public IHttpActionResult PurgeFingerprintData(DateTime cutoffDate, Boolean purgeExpiredPasses)
{
When I try to send this to my web api, I am getting this error
Error>
<Message>An error has occurred.</Message>
<ExceptionMessage>
The 'ObjectContent`1' type failed to serialize the response body for content type 'text/xml; charset=utf-8'.
</ExceptionMessage>
<ExceptionType>System.InvalidOperationException</ExceptionType>
<StackTrace/>
<InnerException>
<Message>An error has occurred.</Message>
<ExceptionMessage>
Type '<>f__AnonymousType106`2[System.String,System.String]' cannot be serialized. Consider marking it with the DataContractAttribute attribute,
and marking all of its members you want serialized with the DataMemberAttribute attribute.
If the type is a collection,
consider marking it with the CollectionDataContractAttribute. See the Microsoft .NET
Framework documentation for other supported types.
</ExceptionMessage>
<ExceptionType>
System.Runtime.Serialization.InvalidDataContractException
</ExceptionType>
I am not sure what should I do to make this work. Do I pass my date in the wrong format?
Thanks in advance.
If it's not broken, fix it until it is.
My Blog