我连接一个REST
从C#API。 我Json
用不同的名字几个错误对象的反应,但所有的对象都具有相同的变量:标题,信息,和显示。
对象的数量与每个请求到API(REST)的变化,对象的响应的名称是根据请求不同。 但每个错误的变量与上述相同。
我从这种反应需要的信息仅仅是消息文本,但它是可以接受的,如果我得到错误的对象列表,所以我可以通过从错误信息读取。
这里是JSON响应:
{
"errors": {
"missingparameter_general_paymenttype": {
"title": "",
"message": "You must enter 'general_paymenttype'.",
"display": ""
},
"missingparameter_contact_title": {
"title": "",
"message": "You must enter 'contact_title'.",
"display": ""
},
"missingparameter_contact_firstname": {
"title": "",
"message": "You must enter 'contact_firstname'.",
"display": ""
},
"missingparameter_contact_lastname": {
"title": "",
"message": "You must enter 'contact_lastname'.",
"display": ""
},
"missingparameter_contact_email": {
"title": "",
"message": "You must enter 'contact_email'.",
"display": ""
},
"missingparameter_contact_telephone": {
"title": "",
"message": "You must enter 'contact_telephone'.",
"display": ""
},
"invalidparameter_pricing_currency": {
"title": "",
"message": "Invalid value for 'pricing_currency'.",
"display": ""
},
"missingparameter_pricing_saleprice": {
"title": "",
"message": "You must enter 'pricing_saleprice'.",
"display": ""
},
"missingparameter_transfers": {
"title": "",
"message": "You must enter 'transfers'.",
"display": ""
}
}
}