Hi,
I have a third party rest api to get bank details.
When calling the API it response is json format.
I need to add response details into my sales order screen.In SOOrderEntry Graph extension I have created a action and calling the API below like that.
public PXAction<SOOrder> MyAction;
[PXUIField(DisplayName = "ADD ORDER", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
[PXButton(CommitChanges = true)]
public virtual IEnumerable myAction(PXAdapter adapter)
{
var URL = "https://sandbox.corporate-api.hsbc.com/mock/v2/transactions";
var httpRequest = (HttpWebRequest)WebRequest.Create(URL);
httpRequest.Method = "POST";
httpRequest.ContentLength = 0;
var httpResponse = (HttpWebResponse)httpRequest.GetResponse();
SOOrder order = Base.Document.Current;
order.OrderDesc = httpResponse.StatusCode.ToString();
return adapter.Get();
}
When clicking the ADD ORDER button description field is updated with response code.Then I need to set the Reponse Body’s StatusDesc with my description field. How I do that?
Best answer by jinin
View original