Using RESTFul Web Services with JSON
PowerBuilder DataWindow/DataStore/DataWindowChild (except for
Composite, Crosstab, OLE 2.0, and RichText styles) can exchange JSON data
with RESTFul Web services.
The JSONGenerator object constructs the JSON objects by adding
values, objects, or arrays. JSONParser object loads the JSON data from a
string or from a TXT file into a JSON object. JSONPackage merges data in a
JSON object and extracts data from the JSON object. The data to be merged
can be from DataWindow/DataStore/DataWindowChild, or from an existing
JSON. The resulted JSON can be posted from the client to the server via
HTTPClient, or retrieved from the server to the client via RESTClient. And
to import JSON to or export JSON from the DataWindow control, DataStore
object, or DataWindowChild object, you can use the DataWindow
ImportJson/ImportJsonByKey/ExportJson functions.
The HTTPClient object sends HTTP requests and receives HTTP
responses from a resource identified by a URI. Compared to the Inet
object, HTTPClient is easier to use and supports more methods
(Get/Post/Put/Delete) and more SSL protocols (TLS 1.0, TLS 1.1, TLS 1.2,
SSL 2.0, and SSL 3.0). RESTClient object accesses the RESTful Web APIs and
loads the JSON string returned from the RESTful Web APIs into the
DataWindow object. The JSON string returned from the RESTFul Web Service
APIs must have no more than 2 levels, and the top-level must be arrays,
the second-level must be objects.
For more information about these objects and their
functions/events/properties, see
the section called “JSONPackage object” in Objects and Controls
the section called “JSONGenerator object” in Objects and Controls
the section called “JSONParser object” in Objects and Controls
the section called “HTTPClient object” in Objects and Controls
the section called “RESTClient object” in Objects and Controls
the section called “ImportJson” in DataWindow Reference
the section called “ImportJsonByKey” in DataWindow Reference
the section called “ExportJson” in DataWindow Reference
the section called “CompressorObject object” in Objects and Controls
the section called “ExtractorObject object” in Objects and Controls.