Toni Perätalo
7 posts
Registered:
08 Feb 2019
10 May 2019
Link to this post
Hi,
I was curious to know how the http response payload (json) looks like, when a I try to create a record with business entity using REST interface and it fails for validation error. Especially how those errors are shown. I'll try to explain more detailed.
I try to create a sales order record using REST (using http client like Postman, not our real "frontend". For just an example):
POST server/web/salesorders
(this uses SalesOrderBusinessEntity).
There are some validations done using Validate class of SmartComponentLibrary. When validation fails, those routines in Validation class set the error flag of dataset true and also set error-string of dataset buffer.
Now the backend returns the response to frontend.
I'd like to know how the http response payload looks like in this case. Especially how those error messages from error-string of dataset buffer are shown in response payload in case of REST call.
If I would have used JSDO call (POST server/web/Foo.Sales.SalesOrderBusinessEntity etc.) the response looks like:
{
"dsSalesOrder": {
"prods:hasChanges": true,
"eSalesOrder": [
{
"prods:id": "eSalesOrder205056",
"prods:rowState": "created",
"prods:hasErrors": true,
"OrderNum": 0,
"OrdCustNum": 1,
"OrdAddrNum": 0,
"PayTerm": "",
"DlvCustNum": 0,
"DlvAddrNum": 0,
"InvCustNum": 0,
"InvAddrNum": 0,
"DlvTerm": "",
"TraMode": "",
"Currency": "",
"SlsType": "",
"OrderDate": null
}
],
"prods:before": {},
"prods:errors": {
"eSalesOrder": [
{
"prods:id": "eSalesOrder205056",
"prods:error": "Sales Type must be given (SlsType)\u0004SlsType\u0004eSalesOrder\u0003Payment term must be given (PayTerm)\u0004PayTerm\u0004eSalesOrder\u0003This is error that cannot be targetted to specific field"
}
]
}
}
}
But how the response payload looks like if I'd have used REST call to create a record? Reason why I'm asking is that we have something wrong with our REST setup and I cannot test right know it by myself.
Hope that make the question more clear.
Toni
Last modified on 10 May 2019 04:05 by Toni Perätalo