Difference between revisions of "I2Rest quick config"

From i2Rest
Jump to: navigation, search
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{DISPLAYTITLE:i2Rest configuration in two steps}}
 
{{DISPLAYTITLE:i2Rest configuration in two steps}}
Our i2Rest Server configuration template will help you to set up you server in a minutes. With this minimal configuration your server instance will be able to process request to test I2RESTECHO program.<br>
+
Our [[i2Rest_Server|i2Rest Server]] configuration template will help you to set up you server in a minutes. With this minimal configuration your server instance will be able to process request to test I2RESTECHO program.<br>
Create *.json (you can name your file any you like, config.json for example) file and copy-paste to it the next lines:
+
In this configuration, none of the user authentication models are used, that is, the API call is performed in anonymous mode.
  
<pre>
 
{
 
  "gates":
 
  {
 
      "main"      : {"url":"http://<host_name>[:port]"},
 
      "management" : {"url":"http://<host_name>[:port]"}
 
  },
 
  "session_systems":
 
  [
 
      {
 
        "name"  : "*LOCAL",   
 
        "submit" : "SBMJOB JOB(I2RESTS) USER(${user}) CMD(CALL I2REST PARM('-session' '-url' '${surl}' '-uid' '${uid}' '-user' '${user}')) INLLIBL(I2REST)"
 
      },
 
      {
 
        "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"          : "<path to i2restecho.pcml on IFS>/i2restecho.pcml",
 
        "valid_in_anonymous" : true
 
      }
 
  ]
 
}
 
</pre>
 
 
;Step 1
 
;Step 1
:Contact your system administrator for available host and port for "main" and "management" gates of your first i2Rest Server instance, and set up appropriate settings.<br>
+
: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:
;Step 2
 
:The next thing we have to do to is to set up "pcmls" object that provides program call parameters formal description. Look at such a description for the I2RESTECHO:
 
 
<pre>
 
<pre>
 
<pcml version="1.0">
 
<pcml version="1.0">
Line 45: Line 14:
 
</pcml>
 
</pcml>
 
</pre>
 
</pre>
:Create I2RESTECHO.PCML file and copy-paste the lines above to it, then save file anywhere your like on IFS, for example "/temp/PCML/i2restecho.pcml"  
+
 
:At last make sure you specify the path to your I2RESTECHO.PCML file in config.json correctly.<br>
+
;Step 2
Now save your config.json on IFS (for example in i2Rest folder, but it's up to you) and you are ready to [[I2Rest_Start|start your i2Rest Server instance]].<br>
+
: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:
Please explore [[I2Rest_Basic_Setup|more details]] how to configure your i2Rest server.
+
 
 +
  {
 +
    "gates":
 +
    {
 +
      "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>"}
 +
    },
 +
    "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"          : "<span style="color:red;"><complete name of i2restecho.pcml on IFS (for example /tmp/PCML/i2restecho.pcml)></span>",  
 +
          "valid_in_anonymous" : true
 +
      }
 +
    ]
 +
}
 +
 
 +
 
 +
Now you are ready to [[I2Rest_Start|start your i2Rest Server instance]].<br>
 +
 
 +
If you would like to go deeper, please explore [[I2Rest_Advanced_Setup|advanced details]] how to configure different features of your i2Rest Server.<br/>
 +
Complete reference of i2Rest Server configuration options is provided [[I2Rest_Config|here]]

Latest revision as of 16:21, 22 July 2020

Our i2Rest Server configuration template will help you to set up you server in a minutes. With this minimal configuration your server instance will be able to process request to test I2RESTECHO program.
In this configuration, none of the user authentication models are used, that is, the API call is performed in anonymous mode.

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. We will start with simplest non-encrypted connections, so please leave http as a protocol:
{
   "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_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
      }
   ]
}


Now you are ready to start your i2Rest Server instance.

If you would like to go deeper, please explore advanced details how to configure different features of your i2Rest Server.
Complete reference of i2Rest Server configuration options is provided here