Enhanced RESTClient object

The following functions are added to the RESTClient object:

  • Submit can not only send data from the application client to the RESTful web service but also get the response body from the RESTful web service.

    The data to be submitted may be from either a DataWindow, DataStore, DataWindowChild, or JSONPackage. You can specify one or multiple DataWindow buffers, and also the range in the DataWindow, from which to submit the data. The request supports OAuth 2.0 authorization.

    objectname.Submit(string urlName, ref string response, DWControl dwObject{, boolean format})
    
    objectname.Submit(string urlName, ref string response, DWControl dwObject {,DWBuffer dwbuffer}, boolean changedonly, boolean format)
    objectname.Submit(string urlName, ref string response, DWControl dwObject, boolean primarydata, boolean filterdata, boolean deletedata, boolean dwcdata {, boolean format})
    objectname.Submit(string urlName, ref string response, DWControl dwObject, DWBuffer dwbuffer{,long startrow{, long endrow{, long startcol{, long endcol}}}} {, boolean format})
    objectname.Submit(string urlName, ref string response, ref JsonPackage package)
  • SendDeleteRequest: Sends the HTTP DELETE request to the server and then gets the content of the server response.

    Previously only the HTTPClient object supports sending a request to the RESTful web service. Now you can directly send a request from the RESTClient object, and the request supports OAuth 2.0 authorization.

    SendDeleteRequest(string urlName{, string data }, ref string response)
  • SendGetRequest: Sends the HTTP GET request to the server and then gets the content of the server response.

    SendGetRequest(string urlName, ref string response)
  • SendPatchRequest: Sends the HTTP PATCH request to the server and then gets the content of the server response.

    SendPatchRequest(string urlName, string data, ref string response)
  • SendPostRequest: Sends the HTTP POST request to the server and then gets the content of the server response.

    SendPostRequest(string urlName, string data, ref string response)
  • SendPutRequest: Sends the HTTP PUT request to the server and then gets the content of the server response.

    SendPutRequest(string urlName, string data, ref string response)
  • GetJWTToken: Gets the JWT token using the POST method.

    GetJWTToken (string urlName, string data, ref string token)
  • SetJWTToken: Sets the JWT token string to the HTTP request header which will be sent to the server.

    SetJWTToken(string jwtToken)
  • GetOAuthToken: Gets the OAuth 2.0 access token.

    GetOAuthToken (TokenRequest tokenRequest, ref string token)
  • SetOAuthToken: Sets the OAuth 2.0 token string to the HTTP request header which will be sent to the server.

    SetOAuthToken(string token)
  • RetrieveOne: Retrieves one data row to the DataWindow, DataWindowChild, or DataStore from the RESTFul Web service.

    RetrieveOne (DWControl dwObject, string urlName {,string data})

The following functions for the RESTClient object are modified:

  • Retrieve - Retrieves data to the DataWindow, DataWindowChild, or DataStore from the RESTFul Web service.

    If the data received from the RESTful web service is compressed as gzip, it will be automatically decompressed. Only gzip compression format is supported at this moment. You can use the SetRequestHeader function to set the Accept-Encoding header to allow only the gzip compression format.

  • SetRequestHeader - Supports to add a request header or add/replace the value in the existing request header if the header already exists.

    SetRequestHeader ( string headerName, string headerValue{, Boolean replace } )

For more details about these functions, refer to the section called “RESTClient object” in Objects and Controls.