1. Wang Tom
  2. PowerBuilder
  3. Tuesday, 17 October 2023 06:16 AM UTC

Hello ,

I have a request to call web api to post data, here are some of the information of that web api:

accept Http post 

app_key = 'app_key'

method = 'testMethod'

URL='http://abc.com/inbond'

The 'testMethod' accepts data recrods from my PB program - a header table and it's details, the class definition like below:

 

 

testMethod

public class Inbound

{

pubic string MsgID {get;set;}='' ;

public string plandate {get;set;} = '' ;

public list<inbound.DetailItem>PlanDetail = new List<inbound.DetailItem>();

#region DetailItem class

public class DetailItem

{

public int32 LineNo {get;set;} = 0 ;

public string InvoiceNo {get;set;} = '' ;

public string Goodsno {get;set;} = ''

}

#endregion

}

 

So, i will have post the one header record and multiple detailed record to the testMethod with JSON format. So, how to do this in general? Using the httpclient or RESTclient ?

 

 

 

 

 

 

 

Kevin Ridley Accepted Answer Pending Moderation
  1. Tuesday, 17 October 2023 16:18 PM UTC
  2. PowerBuilder
  3. # 1

I always suggest the best way to access a new REST API is to get it working in Postman or SOAPUI then review the HTTP code.  Once you see the code that gets submitted for the API call, you can duplicate it using the HTTPClient.

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.