User Manual

10.04.2024

MANUAL

Developer Function: Server Script: httpClient

## Overview Used when using an HTTP client to connect to an external service in a "[Server Script](/en/manual/table-management-server-script)". ## Supported Versions #### RequestHeaders Pleasanter 1.3.9.0 or later #### HttpClient Pleasanter 1.2.16.0 or later #### HttpClient Patch Method Pleasanter 1.3.50.0 or later ## Properties |No|Name|Get|Set|Type|Description| |:----|:----|:----|:----|:----|:----| |1|RequestUri|Yes|Yes|string|The URI of the destination| |2|Content|Yes|Yes|string|Data to send| |3|Encoding|Yes|Yes|string|Encoding (default is "utf-8")| |4|MediaType|Yes|Yes|string|Media type (default is "application/json")| |5|RequestHeaders|Yes|No|Dictionary<string,string>|Request header. See below for more details.| |6|IsSuccess|Yes|No|bool|Get whether the most recent request was successful. Returns True if the StatusCode is within the range of 200-299.| |7|StatusCode|Yes|No|int|Status code of the response message for the most recent request.| ### Example Usage of RequestHeaders Property You can add any request header by using the Add method of the RequestHeaders property as shown below. ```javascript httpClient.RequestHeaders.Add({Header name}, {Value}); ``` #### Basic Authentication with Authorization Header ```javascript let base64 = utilities.ConvertToBase64String('userName:password'); httpClient.RequestHeaders.Add("Authorization", "Basic " + base64); httpClient.RequestUri= "https://servername/api/....."; let result = httpClient.Get(); ``` *To convert a string to Base64, you can use the ["utilities.ConvertToBase64String"](server-script-utilities-convert-to-base64-string) method. Also, if you want to set another header and send it subsequently, reset the header content with the Clear method. ```javascript httpClient.RequestHeaders.Clear(); httpClient.RequestHeaders.Add("Authorization", "Bearer " + "X2kKRHGI495Y......."); ``` ## Method |No|Name|Description| |:----|:----|:----| |1|[Get](/manual/server-script-http-client-get)|Issue the GET method and receive the results. | |2|[Post](/manual/server-script-http-client-post)|Issue the POST method and receive the results. | |3|[Put](/manual/server-script-http-client-put)|Issue the PUT method and receive the results. | |4|[Delete](/manual/server-script-http-client-delete)|Issue the DELETE method and receive the results. | |5|[Patch](/manual/server-script-http-client-patch)|Issue the PATCH method and receive the results. | ## Related Information <div id="ManualList"><ul><li><a href="/en/manual/table-management-server-script">Table Management: Server Script</a><span>08.13.2024 up</span></li></ul></article> <ul><li><a href="/en/manual/server-script-http-client-get">Developer Function: Server Script: httpClient.Get</a><span>08.14.2024 up</span></li> <li><a href="/en/manual/server-script-http-client-post">Developer Function: Server Script: httpClient.Post</a><span>10.04.2024 up</span></li> <li><a href="/en/manual/server-script-http-client-put">Developer Function: Server Script: httpClient.Put</a><span>10.04.2024 up</span></li> <li><a href="/en/manual/server-script-http-client-delete">Developer Function: Server Script: httpClient.Delete</a><span>08.14.2024 up</span></li></ul></article></div><input id="SearchTextHidden" type="hidden" value="" />
TOP
このページをシェアする
記載された商品名、各製品名は各社の登録商標または商標です。 © Implem Inc.