Difference between revisions of "I2Rest Gate URL definition using Unix socket"

From i2Rest
Jump to: navigation, search
Line 14: Line 14:
  
 
;Step 2
 
;Step 2
:Contact your system administrator for your IBM i server host name (or IP) and ''two'' available ports for "main" and "management" gates of your first i2Rest Server instance. Create file config.json (you can name it with any name and put it into any available IFS folder). Enter following text, replace host_name, ports and pcml_file with appropriate values. We will start with simplest non-encrypted connections, so please leave http as a protocol:  
+
:Contact your system administrator for your IBM i server host name (or IP) and ''two'' available ports for "main" and "management" gates of your first i2Rest Server instance. Create file config.json (you can name it with any name and put it into any available IFS folder). Enter following text, replace host_name, ports and pcml_file with appropriate values.
 +
[[I2Rest_quick_config|Basic configuration]] with Unix socket defined gate (differences are highlighted in <span style="background:#00FFFF;">blue</span>):
  
 
  {
 
  {
Line 21: Line 22:
 
       "main"      : {"url":"http://<span style="color:red;"><host_name>[:port] (for example api.i2rest.com:1234)</span>"},
 
       "main"      : {"url":"http://<span style="color:red;"><host_name>[:port] (for example api.i2rest.com:1234)</span>"},
 
       "management" : {"url":"http://<span style="color:red;"><host_name>[:port] (for example api.i2rest.com:4321)</span>"},
 
       "management" : {"url":"http://<span style="color:red;"><host_name>[:port] (for example api.i2rest.com:4321)</span>"},
       <span style="background:red;">"session"    : {file://<span style="color:#0033CC;"><IFS file>(for example i2Rest/Session)</span>", "dcm_server_id":"<span style="color:red;"><dcm server id>(for example MYSERVER)</span>"}</span>
+
       <span style="background:#00FFFF;">"session"    : {file://<span style="color:red;"><IFS file>(for example i2Rest/Session)</span>", "dcm_server_id":"<span style="color:red;"><dcm server id>(for example MYSERVER)</span>"}</span>
 
     },
 
     },
 
     "session_systems":
 
     "session_systems":

Revision as of 13:13, 30 June 2020

When your i2Rest Server instance and its clients both located on the same IBM i server, it is reasonable to use file: protocol. For example, you can use this protocol for management gate, to perform management functions using local i2Rest Client. i2Rest Server is able to listen incoming requests at some unix socket defined as a file at IFS. In this case, the server will not be accessible externally. i2Rest Server uses temporary file: endpoints when it can't find configuration for some gate. Temporary file: endpoints are created at /tmp folder, for example /tmp/AS5WRD7DCJ

Step 1
Create text file named I2RESTECHO.PCML anywhere on IFS, for example "/tmp/PCML/i2restecho.pcml". Copy and paste following code. It represents a description for the sample program I2RESTECHO, that is included into i2Rest Server installation for demonstration purposes:
<pcml version="1.0">

   <program name="echo" path="/QSYS.LIB/%LIBL%.LIB/I2RESTECHO.PGM">
      <data name="echo" usage="inputoutput" type="char" length="10" trim="both"/>
   </program>

</pcml>
Step 2
Contact your system administrator for your IBM i server host name (or IP) and two available ports for "main" and "management" gates of your first i2Rest Server instance. Create file config.json (you can name it with any name and put it into any available IFS folder). Enter following text, replace host_name, ports and pcml_file with appropriate values.

Basic configuration with Unix socket defined gate (differences are highlighted in blue):

{
   "gates":
   {
      "main"       : {"url":"http://<host_name>[:port] (for example api.i2rest.com:1234)"},
      "management" : {"url":"http://<host_name>[:port] (for example api.i2rest.com:4321)"},
      "session"    : {file://<IFS file>(for example i2Rest/Session)", "dcm_server_id":"<dcm server id>(for example MYSERVER)"}
   },
   "session_systems":
   [
      {  "name"   : "*ANONYMOUS", 
         "submit" : "SBMJOB JOB(I2RESTA)                \
                            USER(${user})               \
                            CMD(CALL I2REST             \
                               PARM('-session'          \
                                    '-url' '${surl}'    \
                                    '-uid' '${uid}'     \
                                    '-user' '${user}')) \
                            INLLIBL(I2REST)"
      }
   ],
   "pcmls":
   [
      {
         "pcml_mount"         : "echo",
         "pcml_file"          : "<complete name of i2restecho.pcml on IFS (for example /tmp/PCML/i2restecho.pcml)>", 
         "valid_in_anonymous" : true
      }
   ]
}

Gate_object