restReqPostKey (Function)

Top  Previous  Next

Architecture:

NX32L

Firmware version:

2.10.00


This function will read the name of a post parameter in a request.

By calling this multiple times with incrementing index, it is possible to list all the post parameters in the request.

Note: Transferring files as post parameters is not currently supported.

 

Input:

req : SYSHANDLE

A handle to the request.

 

idx : INT (Default 0)

The index of the post parameter to read the name of.

 

 

Output:

name : STRING

The name of the parameter.

 

 

Returns: INT

1


- Success

0


- Not supported

-1


- Invalid request

-2


- The post parameter was not found

 

Declaration:

FUNCTION restReqPostKey : INT;
VAR_INPUT
   req            : SYSHANDLE;
   idx            : INT;
   name           : ACCESS STRING;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM example;
VAR
   rc        : INT;
   strname : STRING;
   i         : INT;
   req       : SYSHANDLE;
END_VAR
BEGIN
   ...
 
   i:=0;
   // Get name of post parameter
   rc := restReqPostKey(req:=reqidx:=iname:=name);
   WHILE rc > 0 DO
      // Get value of post parameter
      restReqPostGet(req:=reqname:=namevalue:=str);
      DebugMsg(message:=" "+name+"="+str);
      i:=i+1;
      // Get name of next post parameter
      rc := restReqPostKey(req:=reqidx:=iname:=name);
   END_WHILE;
   ...
END;
END_PROGRAM;