Example 3 (using OAuthClient)
The OAuthClient object sends a request with a header
“Accept-Encoding:gzip” which informs the RESTFul Web service that the
client can extract data; then the Web service returns a compressed
package and a response header “Content-Encoding: gzip” which indicates
that the data is compressed.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
OAuthRequest loa_Request OAuthClient loa_Client ResourceResponse lrr_Response Integer li_rtn Long ll_rtn String ls_Body,ls_Response,ls_Token loa_Client = Create OAuthClient ls_Token = "eyJhbGciOiJSUz......" //Sets the auto-decompression request header to gzip loa_Request.SetHeader("Accept-Encoding", "gzip") li_rtn = loa_Request.SetAccessToken (ls_Token) loa_Request.Method = "GET" loa_Request.Url = "https://demo.appeon.com/pb/webapi_client/identity/departments" li_rtn =loa_Client.RequestResource( loa_Request, lrr_Response ) If li_rtn = 1 Then //Gets the response header ls_Response = lrr_Response.getheaders( ) messagebox("Responseheaders",ls_Response) //Gets the response body ll_rtn = lrr_Response.getbody( ls_Body) MessageBox( "Body", ls_Body ) Else MessageBox ( "RequestResource Failed","RequestResource Return:" + String ( li_Rtn ) ) End If If IsValid ( loa_Client ) Then Destroy ( loa_Client ) |
Document get from Powerbuilder help
Thank you for watching.
Subscribe
Login
0 Comments
Oldest