- Necmettin Urkmez
- SnapObjects
- Wednesday, 27 November 2019 02:18 PM UTC
I have seen some code in "orderdemo" project.
---------------------
PB client side code that consumes web api....
--------------------------
String ls_url
String ls_response
String ls_json
JsonPackage lnv_package
Int li_return
lnv_package = Create JsonPackage
lnv_package.SetValueByDataWindow("order", adw_order, true)
lnv_package.SetValueByDataWindow("orderitems", adw_orderitems, true)
ls_url = gn_RESTClient.of_get_url("WOrderNew", "UeSave")
If gn_RESTClient.of_post(ls_url, lnv_package) > 0 Then
li_return = 1
Else
li_return = -1
End If
Destroy lnv_package
Return li_return
----------------------------------------------------------------------------
------------------
Web api side
------------------
// POST api/WOrderNew/UeSave
[HttpPost]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public ActionResult UeSave(IDataUnpacker dataUnpacker)
{
// Declare and initialize local .NET DataStore variables
// By getting the Packaged DataStores
IDataStore order = dataUnpacker.GetDataStore("order");
IDataStore orderItems = dataUnpacker.GetDataStore("orderitems");
// Check if the modification was successful
if (_service.UeSave(order, orderItems))
{
// Return Status Code 200
return Ok();
}
else
{
// Return a Status Code 500 for Internal Server Error
return StatusCode(StatusCodes.Status500InternalServerError);
}
}
My question is that,
Is it possible to use JSONPackage object non-PB clients? Or how can I consume UeSave API any other type client such as java script or mobile client?
Regards and Thanks
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.