GET request syntax

With GET requests, memory areas to be read or written can be specified in the URL string.

Basic GET syntax

GET requests begin with the IP address, port number, and plcget? command and include all required parameters in the URL string.

To read data from the PLC, specify the memory area to read, e.g. DT100. To write data, specify the memory area and the value to write, e.g. DT100=122.

To send the request to the service control interface set in the FP-I4C Web interface, simply use this command: http://IP_OF_DEVICE:API_PORT/plcget?DATA

To send the request to another interface, you must specify the COM interface of the PLC and the station number: http://IP_OF_DEVICE:API_PORT/plcget?DATA&I=INTERFACE&A=STATION NUMBER

Example

Read DT100 via the service control interface:

http://192.168.100.155:2000/plcget?dt100

Read DT100 via COM2 of station number 2:

http://192.168.100.155:2000/plcget?dt100&I=1&A=3

Read LD100 and set R1F to TRUE via COM3 of station number 0:

http://192.168.100.155:2000/plcget?I=2&A=0&ld100&R1F=1

Parameters

IP_OF_DEVICE

IP address of the FP-I4C unit

API_PORT

The server port set on the REST API/HTTP Server page

DATA

The data specified in the read or write request, e.g. DT100 or R1F=1.

Valid areas: DT, DDT, FL (for FP2SH only), DFL (for FP2SH only), LD, DLD, WR, WX, WY, WL, R, X, Y, L

INTERFACE (optional)

COM interface of the PLC

  • 0: COM1 (RS232)
  • 1: COM2 (RS232/RS485)
  • 2: COM3 (USB)
  • 3: INTERN (internal memory of FP-I4C unit)
  • 4: COM4 (Ethernet)

Make sure the specified interface has been enabled on the COM Interface page and a port has been opened for this interface on the Port page.

If the parameter is omitted, the interface set under COM Interface > Service control interface > COM interface to control device (PLC) will be used. Always include both the INTERFACE and the STATION NUMBER parameter because one alone will be ignored.

STATION NUMBER (optional)

Station number: 0 to 99 (use 0 for 1:1 connections via COM1 or COM3)

If the parameter is omitted, the station number set under COM Interface > Service control interface > COM interface to control device (PLC) > Station number of control device (PLC) will be used. Always include both the INTERFACE and the STATION NUMBER parameter because one alone will be ignored.

GET read request

To read data from the PLC, use the basic syntax for GET requests together with the memory area to read (e.g. DT100, R1A, Y10).

Syntax

To read multiple memory areas in one request, join the memory areas with "&".

http://IP_OF_DEVICE:API_PORT/plcget?MEMORY AREA(&MEMORY AREA...&MEMORY AREA)

Example

Read DT100:

http://192.168.100.155:2000/plcget?dt100

Read DDT100, R10, and Y1B:

http://192.168.100.155:2000/plcget?ddt100&R10&Y1B

Parameters

IP_OF_DEVICE

IP address of the FP-I4C unit

API_PORT

The API port set on the REST API/HTTP Server page

MEMORY AREA

Memory area of the PLC

Response to GET read request

The response to a GET read request is a JSON string that contains error information and the data of the request.

Each response contains the err, err_msg, and data property. The err property is TRUE if an error occurred and FALSE if no error occurred. The err_msg property contains the error message if the err property is TRUE or it is empty if the err property is FALSE. The data property is an array that contains the data in the same order as in the request.

Example

Response to read request for DT100:

{"err":false,"err_msg":"","data":[{"err":false,"err_code":0,"int":[100],"uint":[100],"udint":[],"dint":[],"hex":["0064"],"real":[],"string":"d\u0000","request":"DT100"}]}

Response to read request for DDT100, R10, and Y1B:

{"err":false,"err_msg":"","data":[{"err":false,"err_code":0,"int":[100,23],"uint":[100,23],"udint":[1507428],"dint":[1507428],"hex":["0064","0017"],"real":[6.933650024851553e-39],"string":"d\u0000\u0017\u0000","request":"DDT100"},{"err":false,"err_code":0,"state":0,"request":"R10"},{"err":false,"err_code":0,"state":0,"request":"Y1B"}]}

Properties for 16-bit memory areas

The data array of the response contains the following properties.

  • err (BOOL), TRUE if an error occurred
  • err_code (16-bit hex value in string format), a hex error code (see "Related topics")
  • int (integer, array of number)
  • uint (unsigned integer, array of number)
  • udint (unsigned double integer, array of number), for two or more registers only (e.g. DDT, DFL)
  • dint (double integer, array of number), for two or more registers only (e.g. DDT, DFL)
  • hex (array of 16-bit hex values in string format)
  • real (array of floating point number), for two or more registers only (e.g. DDT, DFL)
  • string
  • request, contains the requested address

Properties for 1-bit memory areas

  • err (BOOL), TRUE if an error occurred
  • err_code (16-bit hex value in string format), a hex error code (see "Related topics")
  • state, 0 = FALSE, 1 = TRUE
  • request, contains the requested address
Related topics:

GET write request

To write data to the PLC, use the basic syntax for GET requests together with the memory area to write (e.g. DT100, R1A, Y10).

Syntax

Introduce each set value with "=". To write multiple memory areas in one request, join the memory areas with "&".

The set value must be a decimal number. Make sure it is within the permissible range. Otherwise the value is cut and a wrong value is set.

http://IP_OF_DEVICE:API_PORT/plcget?MEMORY AREA=VALUE(&MEMORY AREA=VALUE...&MEMORY AREA=VALUE)

Example

Write 122 to DT100:

http://192.168.100.155:2000/plcget?dt100=122

Write 19202 to DDT100, TRUE to R10, and FALSE to Y1B:

http://192.168.100.155:2000/plcget?ddt100=19202&R10=1&Y1B=0

You can also combine read and write requests:

Read DT200 and write TRUE to Y10:

http://192.168.100.155:2000/plcget?dt200&Y10=1

Parameters

IP_OF_DEVICE

IP address of the FP-I4C unit

API_PORT

The API port set on the REST API/HTTP Server page

MEMORY AREA

Memory area of the PLC

VALUE

Set value

Response to GET write request

The response to a GET write request is a JSON string that contains error information and the data of the request.

Each response contains the err, err_msg, and data property. The err property is TRUE if an error occurred and FALSE if no error occurred. The err_msg property contains the error message if the err property is TRUE or it is empty if the err property is FALSE. The data property is an array that contains the data in the same order as in the request.

Example

Response to write request for DT100:

{"err":false,"err_msg":"","data":[{"err":false,"err_code":0,"request":"DT100"}]}

Response to write request for DDT100, R10, and Y1B:

{"err":false,"err_msg":"","data":[{"err":false,"err_code":0,"request":"DDT100"},{"err":false,"err_code":0,"request":"R10"},{"err":false,"err_code":0,"request":"Y1B"}]}

Response to read request for DT200 and write request for Y10:

{"err":false,"err_msg":"","data":[{"err":false,"err_code":0,"int":[0],"uint":[0],"udint":[],"dint":[],"hex":["0000"],"string":"\u0000\u0000","request":"DT200"},{"err":false,"err_code":0,"request":"Y10"}]}

Properties

The data array of the response contains the following properties.

  • err (BOOL), TRUE if an error occurred
  • err_code (16-bit hex value in string format), a hex error code (see "Related topics")
  • request, contains the requested address
Related topics:

Modified on: 2022-07-27Feedback on this pagePanasonic hotline