У меня есть перечисление в качестве одного из параметров в моем API отдыха.
Контракт конечной точки:
List<Transaction> GetTransactions(int employeeID, int recordOffset, int recordLimit, TransactionType transactionType = TransactionType.All);
InputJSON Запрос:
{
"employeeID":"123",
"recordOffset": 0,
"recordLimit": 80,
"transactionType":"All"
}
Я получаю 400 неверных запросов, когда я передаю этот входной JSON с ключом транзакции.
Пожалуйста, дайте мне знать, как я должен передавать значение ENUM вЗапрос json.
public enum TransactionType
{
All = 0,
Incoming = 1,
Outgoing = 2
}
Сообщение об исключении:
The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://Services/2015/03:transactionType. The InnerException message was 'There was an error deserializing the object of type Entities.TransactionType. The value 'All' cannot be parsed as the type 'Int64'.'. Please see InnerException for more details