{"id":3359,"date":"2026-11-17T18:42:53","date_gmt":"2026-11-17T10:42:53","guid":{"rendered":"https:\/\/resource.fatek.com\/index.php\/2026\/11\/17\/p5hmi-fvd-en-17\/"},"modified":"2026-11-17T18:42:53","modified_gmt":"2026-11-17T10:42:53","slug":"p5hmi-fvd-en-17","status":"publish","type":"post","link":"https:\/\/resource.fatek.com\/index.php\/2026\/11\/17\/p5hmi-fvd-en-17\/","title":{"rendered":"Chapter 17 Web Service"},"content":{"rendered":"<p>REST API is a widely used interface architecture in network communication technology. It can be used to exchange data with third-party services. Its advantages are simple and convenient design and practicality, and it follows safe, reliable and efficient communication standards.<\/p>\n<p>The web application can use the REST API to send a request to the server, and then the server will send back a response to meet the needs of information exchange. The entire communication process is based on the standard rules designed and defined by the REST architecture, using standard HTTP methods, including GET, PUT, and POST.<\/p>\n<p>HMI can send a request  to an external network server through the REST API, and send the data of the devices\u2019 (HMI, PLC) register address to the server&#8217;s database through POST\/PUT, or gets data from the server through GET command and writes it into the register address.<\/p>\n<p>This chapter will explain the relevant pages and setting methods of the REST API.<\/p>\n<p>\u203bThis function only supports P5 series and FvRT.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/p5hmi-fvd-en-17\/p5hmi-fvd-en-17-001.png\" \/><\/p>\n<p>Figure 210 \u00a0REST APIApplication architecture diagram<\/p>\n<h3>17.1 REST API Client<\/h3>\n<p>Within \u3010Enable REST API\u3011checked, you can add a new REST request in\u3010Request List\u3011. You can add a new request by click\u3010Add\u3011, click\u3010Delete\u3011to delete the request that  you choose, click\u3010Edit\u3011or click the requst twiceto edit it.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/p5hmi-fvd-en-17\/p5hmi-fvd-en-17-002.png\" \/><\/p>\n<p>Figure 211 \u3010REST API Client\u3011setting page<\/p>\n<h4>17.1.1 REST API Client Setting<\/h4>\n<p>Following introduction is for setting interface<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/p5hmi-fvd-en-17\/p5hmi-fvd-en-17-003.png\" \/><\/p>\n<p>Figure 212 \u3010REST Request\u3011Editing Window<\/p>\n<p>Table 104 Edit Window Setting Properties of the \u3010REST Request\u3011<\/p>\n<div class=\"fatek-tw\">\n<table>\n<tr>\n<td>\n<p>Property<\/p>\n<\/td>\n<td>\n<p>Description<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u3010Name\u3011<\/p>\n<\/td>\n<td>\n<p>Set the name of request, which can be used as a description.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u3010URL\u3011<\/p>\n<\/td>\n<td>\n<p>URL for sending request to get data from server.<\/p>\n<p>\u3010Address\u3011<\/p>\n<p>When selected, you can dynamically adjust the theme.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u3010Send Mode\u3011<\/p>\n<\/td>\n<td>\n<p>\u3010Period\u3011<\/p>\n<p>You can set Time Interval to send request<\/p>\n<p>\u3010Triggered\u3011<\/p>\n<p>The request only will be sent when the value of the DataItem<\/p>\n<p>\uff08Notice\uff1aThe content of the message will only display items with value changes\uff09<\/p>\n<p>\u3010Control Bit\u3011<\/p>\n<p>Set a bit as the trigger condition.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u3010Method\u3011<\/p>\n<\/td>\n<td>\n<p>Common data transfer method, following description: <\/p>\n<div class=\"fatek-tw\">\n<table>\n<tr>\n<td>\n<p>Command<\/p>\n<\/td>\n<td>\n<p>description<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>POST<\/p>\n<\/td>\n<td>\n<p>Add<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>PUT<\/p>\n<\/td>\n<td>\n<p>Update<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>GET<\/p>\n<\/td>\n<td>\n<p>Read<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u3010Data Format\u3011<\/p>\n<\/td>\n<td>\n<p>\u3010JSON\u3011\uff1aCommonly used standard formats, example:<\/p>\n<p>{<\/p>\n<p>&quot;id&quot;: 111,<\/p>\n<p>&quot;name&quot;: &quot;fatek&quot;,<\/p>\n<p>&quot;url&quot;: &quot;https:\/\/www.fatek.com\/&quot;,<\/p>\n<p>&quot;status&quot;: 100<\/p>\n<p>}<\/p>\n<p>\uff08Notice\uff1aThis is only for the DataItem in first hierarchy of JSONformat, Besides, please choose\u3010Custom\u3011\uff09<\/p>\n<p>\u3010Custom\u3011\uff1aFormat that you can have your own definition, You need to know that custom is using\u3010Text\u3011 for type  format.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u3010Status Address\u3011<\/p>\n<\/td>\n<td>\n<p>The execution result can be displayed in the register here:<\/p>\n<div class=\"fatek-tw\">\n<table>\n<tr>\n<td>\n<p>Value(16Bit-INT)<\/p>\n<\/td>\n<td>\n<p>description<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>100 \u2013 199<\/p>\n<\/td>\n<td>\n<p>Informational<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>200 \u2013 299<\/p>\n<\/td>\n<td>\n<p>Success<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>300 \u2013 399<\/p>\n<\/td>\n<td>\n<p>Redirection<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>400 \u2013 499<\/p>\n<\/td>\n<td>\n<p>Client Error<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>500 \u2013 599<\/p>\n<\/td>\n<td>\n<p>Server Error<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>Others<\/p>\n<\/td>\n<td>\n<p>Invalid<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u3010DataItem Setting\u3011<\/p>\n<\/td>\n<td>\n<p>\u3010No. of DataItems\u3011<\/p>\n<p>Sets the number of data items for this request.<\/p>\n<p>\u3010Address Type\u3011<\/p>\n<ol>\n<li>\u3010Random\u3011<\/li>\n<\/ol>\n<p>Only the first item can set the address, the other item address will automatically generate, user cannot modify.<\/p>\n<ol>\n<li>\u3010Continuous\u3011<\/li>\n<\/ol>\n<p>The user can manually set the address for each data item.<\/p>\n<p>\u3010Address Type\u3011<\/p>\n<ol>\n<li>\u3010Name\u3011<\/li>\n<\/ol>\n<p>The name of the item cannot be blank and must be unique.<\/p>\n<ol>\n<li>\u3010Address\u3011<\/li>\n<\/ol>\n<p>Depending on the data type, the user can set the address for each data item.<\/p>\n<ol>\n<li>\u3010Length\u3011<\/li>\n<\/ol>\n<p>If the data type is 16-bit, it will occupy one word. A 32-bit data type will occupy two words. For ASCII-String types, the user can define how many words each item should use. Each word can store 2 characters.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<h4>17.1.2 REST API Example<\/h4>\n<p>Here is a demonstration project for retrieving the current temperature in Taipei. Please note that this is a sample based on the API from openweathermap.org, and it does not guarantee real-time data retrieval at all times.<\/p>\n<p>Step1. <\/p>\n<p>In the \u3010URL\u3011field, enter:<\/p>\n<p>http:\/\/api.openweathermap.org\/data\/2.5\/weather?lat=25.0481&#038;lon=121.5170&#038;appid=3ec3e04b911a8e4da5c834f60b00e580&#038;units=metric<\/p>\n<p>In the \u3010Length\u3011field, select \u301012\u3011.<br \/>In the \u3010Method\u3011field, select \u3010GET\u3011.<br \/>In the \u3010Data Format\u3011field, select \u3010Custom\u3011.<\/p>\n<p>Step2.<\/p>\n<p>Set up the data items:<br \/>Set \u3010No. of DataItems\u3011to 3.<br \/>%1 \u2192 select 32-bit float<br \/>%2 and %3 \u2192 select ASCII<br \/>Use the default values for lengths. Be sure the addresses do not overlap.<\/p>\n<p>Step3.<\/p>\n<p>In the Custom Data Format field, enter:<\/p>\n<div class=\"fatek-tw\">\n<table>\n<tr>\n<td>\n<p>%2,&quot;main&quot;:{&quot;temp&quot;:%1,%3<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>For details on the parameters, please refer to:<\/p>\n<p><a href=\"https:\/\/openweathermap.org\/api\/one-call-3\">https:\/\/openweathermap.org\/api\/one-call-3<\/a><\/p>\n<p>Step4.<\/p>\n<p>Place a numeric input object on the screen corresponding to the address linked with %1.<br \/>Compile the project and run it in online simulation or download it to the HMI to view the data.<\/p>\n<h3>17.2 REST API Server<\/h3>\n<p>By enabling\u3010REST API Server\u3011, you can configure the server properties and resources.<br \/>A resource refers to data or services within the server that can be uniquely identified and accessed (read or modified). Each resource corresponds to a specific URL..<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/p5hmi-fvd-en-17\/p5hmi-fvd-en-17-004.png\" \/><\/p>\n<p>Figure 213 \u3010REST API Server\u3011setting page<\/p>\n<p>Table 105\u3010REST API Server\u3011Edit Properties<\/p>\n<div class=\"fatek-tw\">\n<table>\n<tr>\n<td>\n<p>Property<\/p>\n<\/td>\n<td>\n<p>Description<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u3010Enable RESR API Server\u3011<\/p>\n<\/td>\n<td>\n<p>Enable or disable the \u3010Enable RESR API Server\u3011.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u3010Basic\u3011<\/p>\n<\/td>\n<td>\n<p>\u3010Port\u3011<\/p>\n<p>Set the server port, Default: 80<\/p>\n<p>\u3010Connection Timeout\u3011<\/p>\n<p>After the server establishes a connection with a client, if no complete request data is received or no further interaction occurs within the specified time, the connection will automatically be terminated.<\/p>\n<p>This prevents idle or abnormal connections from occupying system resources. Unit: seconds, Maximum: 300 seconds.<\/p>\n<p>\u3010Max Connections\u3011<\/p>\n<p>Defines the maximum number of client connections that the server can process simultaneously.<br \/>This prevents excessive connections from exhausting system resources. Maximum: 20 connections.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u3010Advanced\u3011<\/p>\n<\/td>\n<td>\n<p>\u3010Auto Start\u3011<\/p>\n<p>When enabled, the server will start automatically when the system boots.<\/p>\n<p>\u3010Status Address\u3011<\/p>\n<p>The server&#8217;s running status can be monitored using status addresses.<\/p>\n<p>The following is the status definition table, which can also be viewed directly by clicking<img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/p5hmi-fvd-en-17\/p5hmi-fvd-en-17-005.png\" \/>:<\/p>\n<div class=\"fatek-tw\">\n<table>\n<tr>\n<td>\n<p>Number<\/p>\n<\/td>\n<td>\n<p>Value(16Bit-INT)<\/p>\n<\/td>\n<td>\n<p>Definition<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>1<\/p>\n<\/td>\n<td>\n<p>0<\/p>\n<\/td>\n<td>\n<p>Disable<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>1<\/p>\n<\/td>\n<td>\n<p>Stopped<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>3<\/p>\n<\/td>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>Running<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>4<\/p>\n<\/td>\n<td>\n<p>-1<\/p>\n<\/td>\n<td>\n<p>Error<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>\u3010Control Address\u3011<\/p>\n<p>The server&#8217;s running status can be controled using status addresses.<\/p>\n<p>The following is the status definition table, which can also be viewed directly by clicking<img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/p5hmi-fvd-en-17\/p5hmi-fvd-en-17-006.png\" \/>:<\/p>\n<div class=\"fatek-tw\">\n<table>\n<tr>\n<td>\n<p>Number<\/p>\n<\/td>\n<td>\n<p>Value(16Bit-INT)<\/p>\n<\/td>\n<td>\n<p>Definition<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>1<\/p>\n<\/td>\n<td>\n<p>0<\/p>\n<\/td>\n<td>\n<p>None<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>1<\/p>\n<\/td>\n<td>\n<p>Stop<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>3<\/p>\n<\/td>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>Start<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u3010Enable Authentication\u3011<\/p>\n<\/td>\n<td>\n<p>Enable server authentication and configure the following settings:<\/p>\n<p>\u3010Username\u3011Login username<\/p>\n<p>\u3010Password\u3011The password will be stored in encrypted form.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u3010Enable TLS\u3011<\/p>\n<\/td>\n<td>\n<p>Enable TLS to encrypt communication between the client and server.<\/p>\n<p>\u3010TLS Version\u3011Currently, the server uses the HMI built-in self-signed certificate by default.<\/p>\n<p>(Support for importing external certificate\/private key files will be available in future versions.)<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<h4>17.2.1 Adding Resource Entries<\/h4>\n<p>Configure the resource URL, data items, supported methods, and response details that the server can handle.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/p5hmi-fvd-en-17\/p5hmi-fvd-en-17-007.png\" \/><\/p>\n<p>Figure 214 \u3010REST Resource\u3011\u3010Dataitem\u3011Editing Window<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/p5hmi-fvd-en-17\/p5hmi-fvd-en-17-008.png\" \/><\/p>\n<p>Figure 215 \u3010REST Resource\u3011\u3010File\u3011Editing Window<\/p>\n<p>Table 106\u3010REST Resource\u3011Edit Properties<\/p>\n<div class=\"fatek-tw\">\n<table>\n<tr>\n<td>\n<p>Property<\/p>\n<\/td>\n<td>\n<p>Description<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u3010Basic\u3011<\/p>\n<\/td>\n<td>\n<p>\u3010Name\u3011<\/p>\n<p>Set the resource name for description purposes.<\/p>\n<p>\u3010URL\u3011<\/p>\n<p>Define the resource path, for example : redfish\/v1\/Systems<\/p>\n<p>External clients can send requests using this URL.<\/p>\n<p>\uff0aNotice that the URL always starts with\u201chttp(s):\/\/HMI IP:Port\/\uff02<\/p>\n<ul>\n<li>when TLS is enabled, use https:\/\/ <\/li>\n<li>when TLS is disabled, use http:\/\/ <\/li>\n<li>HMI IP : HMI device IP address<\/li>\n<li>Port : server port number<\/li>\n<\/ul>\n<p>\u3010Content Type\u3011<\/p>\n<p>When clicked, a menu will appear to configure the data format used when receiving requests.<\/p>\n<p>\u3010Dataitem (application\/json)\u3011<\/p>\n<p>Allows reading and writing data items using JSON format.<\/p>\n<p>\u3010File (application\/octet-stream)\u3011<\/p>\n<p>Allows file uploads.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u3010DataItem Setting\u3011<\/p>\n<\/td>\n<td>\n<p>Only visible when\u3010Content Type\u3011is\u3010Dataitem (application\/json)\u3011.<\/p>\n<p>\u3010No. of DataItems\u3011<\/p>\n<p>Defines the number of dataitems in the resource.<\/p>\n<p>\u3010Address Type\u3011<\/p>\n<p>\u3010Continuous\u3011<\/p>\n<p>Only the first item address needs to be defined.Other item addresses are automatically generated and cannot be modified.<\/p>\n<p>\u3010Random\u3011<\/p>\n<p>Each data item address can be manually configured.<\/p>\n<p>The following are the instructions for setting up data items:<\/p>\n<p>\u3010Name\u3011The name must not be empty and must be unique.<\/p>\n<p>\u3010Data Type\u3011Select the data type.<\/p>\n<p>\u3010Address\u3011Configure the register address.<\/p>\n<p>\u3010Length\u3011Number of word units used (1 word = 2 characters).<\/p>\n<p>\u3010Writable\u3011Enable to allow modification; disabled = read-only.<\/p>\n<p>\u3010Comment\u3011Optional description.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u3010File Setting\u3011<\/p>\n<\/td>\n<td>\n<p>Only visible when\u3010Content Type\u3011is\u3010File (application\/octet-stream)\u3011.<\/p>\n<p>\u3010Location\u3011<\/p>\n<p>Defines where uploaded files are stored, including Internal, microSD Card, USB Storage.<\/p>\n<p>\u3010Default Name\u3011<\/p>\n<p>If the client does not specify a filename, this default filename will be used. Examples : file.bin, test.txt, img.jpg. The filename can be modified but <strong>cannot be empty<\/strong>.<\/p>\n<p>\u3010Duplicate Name Policy\u3011<\/p>\n<p>Defines how to handle files with the same name : <\/p>\n<p>\u3010Replace\u3011<\/p>\n<p>Overwrite the existing file.<\/p>\n<p>\u3010Skip\u3011<\/p>\n<p>Skip this step and do not upload new files.<\/p>\n<p>\u3010Rename with timestamp\u3011<\/p>\n<p>Rename the original file by adding a timestamp, then upload it as a new file. For example, the original file \uff02file.bin\uff02becomes\uff02file_2025-12-19T16-18-48.093.bin\uff02<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u3010Response Setting\u3011<\/p>\n<\/td>\n<td>\n<p>\u3010Method\u3011<\/p>\n<p>Supported request methods for this resource URL:<\/p>\n<div class=\"fatek-tw\">\n<table>\n<tr>\n<td>\n<p>Command<\/p>\n<\/td>\n<td>\n<p>definition<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>GET<\/p>\n<\/td>\n<td>\n<p>Read (all data items)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>PATCH<\/p>\n<\/td>\n<td>\n<p>Write to Part (can specify one or more data items)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>PUT<\/p>\n<\/td>\n<td>\n<p>Write All (must specify all writable items; missing will result in an error)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>POST<\/p>\n<\/td>\n<td>\n<p>Upload file<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>Multiple methods can be selected, but at least one method must be chosen.<\/p>\n<p>Selecting a method will enable a configuration page for editing the response message : <\/p>\n<p>\u3010GET\u3011<\/p>\n<div class=\"fatek-tw\">\n<table>\n<tr>\n<td>\n<p>Command<\/p>\n<\/td>\n<td>\n<p>description<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u3010Success Message\u3011<\/p>\n<\/td>\n<td>\n<p>HTTP Status Code : 200 <\/p>\n<p>Default JSON format : <\/p>\n<p>{&quot;DataItem0&quot;:%1,&quot;DataItem1&quot;:%2,&quot;DataItem2&quot;:%3,&quot;DataItem3&quot;:%4,&quot;DataItem4&quot;:%5}<\/p>\n<p>(*The variable keyword represents the data item value: %n, where n can be 1, 2, or 3, and so on.) You can also customize more complex multi-level data formats as needed, as long as they conform to JSON format.<\/p>\n<p>If you check &quot;Automatically update messages after data item editing,&quot; the message content will be automatically updated according to the basic single-level JSON format when the data item name or quantity is edited.<\/p>\n<p>(*It is recommended not to check this option if you want to customize the format, otherwise it will revert to the default single-level JSON format.)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u3010Reset\u3011<\/p>\n<\/td>\n<td>\n<p>Based on the current data project settings, revert the messages to the basic single-layer JSON format.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u3010Preview\u3011<\/p>\n<\/td>\n<td>\n<p>Display a complete message example based on the data type. It must conform to JSON format to display correctly.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u3010Error Message\u3011<\/p>\n<\/td>\n<td>\n<p>HTTP Status Code : 4XX<\/p>\n<p>Currently, all error messages are fixed by default:<\/p>\n<p>{&quot;message&quot;:&quot;Reject Request&quot;}<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>\u3010PATCH\u3011<\/p>\n<div class=\"fatek-tw\">\n<table>\n<tr>\n<td>\n<p>Command<\/p>\n<\/td>\n<td colspan=\"2\">\n<p>description<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">\n<p>\u3010Success Message\u3011<\/p>\n<\/td>\n<td>\n<p>HTTP Status Code: <strong>200<\/strong><\/p>\n<p>Default JSON format:<\/p>\n<p>{&quot;message&quot;:&quot; Updated Successfully&quot;}<\/p>\n<p>The message can be customized but must follow JSON format.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">\n<p>\u3010Reset\u3011<\/p>\n<\/td>\n<td>\n<p>Restore the default message.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">\n<p>\u3010Preview\u3011<\/p>\n<\/td>\n<td>\n<p>Display a complete message example based on the data type. It must conform to JSON format to display correctly.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">\n<p>\u3010Error Message\u3011<\/p>\n<\/td>\n<td>\n<p>HTTP Status Code : 4XX<\/p>\n<p>Currently, all error messages are fixed by default:<\/p>\n<p>{&quot;message&quot;:&quot;Reject Request&quot;}<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>\u3010PUT\u3011<\/p>\n<div class=\"fatek-tw\">\n<table>\n<tr>\n<td>\n<p>Command<\/p>\n<\/td>\n<td colspan=\"2\">\n<p>description<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">\n<p>\u3010Success Message\u3011<\/p>\n<\/td>\n<td>\n<p>HTTP Status Code: <strong>200<\/strong><\/p>\n<p>Default JSON format:<\/p>\n<p>{&quot;message&quot;:&quot; Updated Successfully&quot;}<\/p>\n<p>The message can be customized but must follow JSON format.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">\n<p>\u3010Reset\u3011<\/p>\n<\/td>\n<td>\n<p>Restore the default message.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">\n<p>\u3010Preview\u3011<\/p>\n<\/td>\n<td>\n<p>Display a complete message example based on the data type. It must conform to JSON format to display correctly.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">\n<p>\u3010Error Message\u3011<\/p>\n<\/td>\n<td>\n<p>HTTP Status Code : 4XX<\/p>\n<p>Currently, all error messages are fixed by default:<\/p>\n<p>{&quot;message&quot;:&quot;Reject Request&quot;}<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>\u3010POST\u3011<\/p>\n<div class=\"fatek-tw\">\n<table>\n<tr>\n<td>\n<p>Command<\/p>\n<\/td>\n<td colspan=\"2\">\n<p>description<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">\n<p>\u3010Success Message\u3011<\/p>\n<\/td>\n<td>\n<p>HTTP Status Code: <strong>200<\/strong><\/p>\n<p>Default JSON format:<\/p>\n<p>{&quot;message&quot;:&quot; Updated Successfully&quot;}<\/p>\n<p>The message can be customized but must follow JSON format.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">\n<p>\u3010Reset\u3011<\/p>\n<\/td>\n<td>\n<p>Restore the default message.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">\n<p>\u3010Preview\u3011<\/p>\n<\/td>\n<td>\n<p>Display a complete message example based on the data type. It must conform to JSON format to display correctly.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">\n<p>\u3010Error Message\u3011<\/p>\n<\/td>\n<td>\n<p>HTTP Status Code : 4XX<\/p>\n<p>Currently, all error messages are fixed by default:<\/p>\n<p>{&quot;message&quot;:&quot;Reject Request&quot;}<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<h4>17.2.2 Common Test Tools<\/h4>\n<p><strong>-curl Command<\/strong><\/p>\n<p>curl is a built-in command-line network tool used to send REST requests to the server.<\/p>\n<p><strong>Basic Syntax<\/strong><\/p>\n<p>curl -X [METHOD] [URL]<\/p>\n<p><strong>Common Test Examples<\/strong><\/p>\n<ol>\n<li><strong>GET (Read Data)<\/strong><\/li>\n<\/ol>\n<p>curl -X <strong>GET<\/strong> http:\/\/192.168.0.100:8000\/data<\/p>\n<p>Used to confirm that the server responds correctly.<\/p>\n<ol>\n<li><strong>PATCH (Update Partial Data)<\/strong><\/li>\n<\/ol>\n<p>curl -X <strong>PATCH<\/strong> http:\/\/192.168.0.100:8000\/data \\<\/p>\n<p>    -H &quot;Content-Type: application\/json&quot; \\<\/p>\n<p>    <strong>-d<\/strong> &quot;{\\&quot;status\\&quot;:\\&quot;on\\&quot;}&quot;<\/p>\n<p>You can use the -d option to send JSON data to the server to test the write function.<\/p>\n<ol>\n<li><strong>PUT (Update All Data)<\/strong><\/li>\n<\/ol>\n<p>curl -X <strong>PUT <\/strong>http:\/\/192.168.0.100:8000\/data \\<\/p>\n<p>    -H &quot;Content-Type: application\/json&quot; \\<\/p>\n<p>    <strong>-d<\/strong> &quot;{\\&quot;status\\&quot;:\\&quot;on\\&quot; ,\\&quot;level\\&quot;:3,\\&quot;enabled\\&quot;:true}&quot;<\/p>\n<p>You can use the -d option to send JSON formatted data to the server to test the ability to write everything at once.<\/p>\n<ol>\n<li><strong>POST (Upload File)<\/strong><\/li>\n<\/ol>\n<p>curl -X <strong>POST <\/strong>http:\/\/192.168.0.100:8000\/file \\<\/p>\n<p>    -H &quot;Content-Type: application\/octet-stream&quot; \\<\/p>\n<p>    <strong>&#8211;data-binary<\/strong> &quot;@C:\\test.bin&quot; \\<\/p>\n<p><strong>-H &quot;X-Filename:<\/strong> test_upload.bin&quot;<\/p>\n<p>You can use &#8211;data-binary to specify the file to upload, and you can use -H &quot;X-Filename&quot; to specify the file name.<\/p>\n<ol>\n<li><strong>Basic Authentication<\/strong><\/li>\n<\/ol>\n<p>curl <strong>-u<\/strong> username:password -X GET http:\/\/192.168.0.100:8000\/data<\/p>\n<p>If the server has enabled account and password verification, you can use -u to pass in login information.<\/p>\n<ol>\n<li><strong>HTTPS (TLS)<\/strong><\/li>\n<\/ol>\n<p>curl <strong>-k<\/strong> -X GET <strong>https<\/strong>:\/\/192.168.0.100:8000\/data<\/p>\n<p>The -k parameter is used to trust the server&#8217;s self-signed credentials, which is convenient for use during the testing phase.<\/p>\n<p><strong>-Postman<\/strong><\/p>\n<p>Postman is a commonly used <strong>API testing tool<\/strong> for sending REST requests and viewing server responses.<\/p>\n<ol>\n<li>Enter the request URL. Example: https:\/\/192.168.0.100:8000\/test<\/li>\n<li>Select the request method (Example : GET or PATCH).<\/li>\n<li>If authentication is required. Go to <strong>Authorization page, <\/strong>Select <strong>Basic Auth, and e<\/strong>nter <strong>Username<\/strong> and <strong>Password<\/strong><\/li>\n<li>If TLS is enabled using the HMI self-signed certificate. Go to Settings page, turn OFF \u201cEnable SSL certificate verification\u201d .<\/li>\n<li>If sending data (Example : PATCH request). Go to Body page, select Raw and JSON as data type, enter JSON content<\/li>\n<li>If uploading files ((Example : POST request). Go to Body page, select Binary and upload the file, Go to Headers page, and set \u201cKey\/Value\u201d as below.<\/li>\n<\/ol>\n<div class=\"fatek-tw\">\n<table>\n<tr>\n<td>\n<p><strong>Key<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>Value<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>Content-Type<\/p>\n<\/td>\n<td>\n<p>application\/octet-stream<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>X-Filename<\/p>\n<\/td>\n<td>\n<p>\u6307\u5b9a\u6a94\u540d\uff08\u4f8b\u5982\uff1afile.bin, test.txt, img.jpg\uff09<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>(If Content-Type is not specified, Postman may automatically convert it and cause errors.)<\/p>\n<ol>\n<li>Click Send to view the server response and status code.<\/li>\n<\/ol>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/p5hmi-fvd-en-17\/p5hmi-fvd-en-17-009.jpg\" \/><\/p>\n<p>Figure 216 \u3010REST Resource\u3011\u3010Dataitem\u3011Editing Window<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/resource.fatek.com\/wp-content\/uploads\/fatek\/p5hmi-fvd-en-17\/p5hmi-fvd-en-17-010.jpg\" \/>Figure 217 \u3010REST Resource\u3011\u3010Dataitem\u3011Editing Window<\/p>\n","protected":false},"excerpt":{"rendered":"<p>REST API is a widely used interface architecture in net [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[57],"tags":[],"class_list":["post-3359","post","type-post","status-publish","format-standard","hentry","category-en-p5hmi-fvd"],"_links":{"self":[{"href":"https:\/\/resource.fatek.com\/index.php\/wp-json\/wp\/v2\/posts\/3359","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/resource.fatek.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/resource.fatek.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/resource.fatek.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/resource.fatek.com\/index.php\/wp-json\/wp\/v2\/comments?post=3359"}],"version-history":[{"count":0,"href":"https:\/\/resource.fatek.com\/index.php\/wp-json\/wp\/v2\/posts\/3359\/revisions"}],"wp:attachment":[{"href":"https:\/\/resource.fatek.com\/index.php\/wp-json\/wp\/v2\/media?parent=3359"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/resource.fatek.com\/index.php\/wp-json\/wp\/v2\/categories?post=3359"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/resource.fatek.com\/index.php\/wp-json\/wp\/v2\/tags?post=3359"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}