Difference between revisions of "I2Rest quick config"

From i2Rest
Jump to: navigation, search
 
(27 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:i2Rest Server quickstart}}
+
{{DISPLAYTITLE:i2Rest configuration in two steps}}
Our done-in-three-steps 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 echo program.
+
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>
;step1
+
In this configuration, none of the user authentication models are used, that is, the API call is performed in anonymous mode.
:Contact to your System administrator for available host and port for "main" and "management" gates of the server, and set up appropriate settings.
+
 
;step2
+
;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:
;step3
 
:
 
 
<pre>
 
<pre>
{
+
<pcml version="1.0">
  "gates":
+
 
   {
+
   <program name="echo" path="/QSYS.LIB/%LIBL%.LIB/I2RESTECHO.PGM">
      "main"       : {"url":"http://<host_name>[:port]"},
+
       <data name="echo" usage="inputoutput" type="char" length="10" trim="both"/>
       "management" : {"url":"http://<host_name>[:port]"}
+
  </program>
  },
+
 
  "session_systems":
+
</pcml>
  [
+
</pre>
        {"name": "*LOCAL",    "submit":"SBMJOB JOB(I2RESTS) USER(${user}) CMD(CALL JPCML/I2REST PARM('-session' '-url' '${surl}' '-uid' '${uid}'
 
            '-user' '${user}' '-init' 'ADDLIBLE JPCML' )) INLLIBL(KAPBASELIB QGPL)"},
 
        {"name": "*ANONYMOUS", "submit":"SBMJOB JOB(I2RESTA) USER(${user}) CMD(CALL JPCML/I2REST PARM('-session' '-url' '${surl}' '-uid' '${uid}'
 
            '-user' '${user}' '-init' 'ADDLIBLE JPCML' )) INLLIBL(KAPBASELIB QGPL)"}
 
  ],
 
  
  "pcmls":
+
;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:  
      {"pcml_mount":"echo",     "pcml_file":"/i2rest/Server1/echo.pcml", "valid_in_anonymous":true},
 
  ],
 
  
  "OAuth2":
+
{
  {
+
    "gates":
      "scopes": {"run_program"         : {"description":"Run *PGM and *SRVPGM"},  
+
    {
                "management_functions" : {"description":"Invoke i2Rest manager APIs"}},
+
      "main"       : {"url":"http://<span style="color:red;"><host_name>[:port] (for example api.i2rest.com:1234)</span>"},
      "clients":
+
      "management" : {"url":"http://<span style="color:red;"><host_name>[:port] (for example api.i2rest.com:4321)</span>"}
      {
+
    },
        "OAUTH21":{"redirect_uri":<main gate>/oauth2/redirect",  
+
    "session_systems":
                    "description":"Test client",  
+
    [
                    "valid_scopes":["run_program", "management_functions"],
+
      { "name"   : "*ANONYMOUS",  
                    "valid_grant_types":["authorization_code", "urn:ietf:params:oauth:grant-type:device_code", "refresh_token", "client_credentials"]}
+
          "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
 +
      }
 +
    ]
 +
}
  
      "tokens": {"type":"token"},"refresh_tokens":{"type":"refresh_token"},"codes":{"type":"code"},"device_codes":{"type":"user_code"},
 
  
      "login_page"            : "/pages/Login/index.html",
+
Now you are ready to [[I2Rest_Start|start your i2Rest Server instance]].<br>
      "decision_page"        : "/pages/user_decide.html",
+
 
      "bad_auth_page"        : "/pages/bad_auth.html",
+
If you would like to go deeper, please explore [[I2Rest_Advanced_Setup|advanced details]] how to configure different features of your i2Rest Server.<br/>
      "enter_code_page"      : "/pages/enter_code.html",
+
Complete reference of i2Rest Server configuration options is provided [[I2Rest_Config|here]]
      "device_connected_page" : "/pages/device_connected.html"
 
  }
 
 
 
}
 
</pre>
 
Now save your config.json on IFS and you are ready to [[I2Rest_Start|start your i2Rest Server instance]].<br>
 
Please explore [[I2Rest_Basic_Setup|more details]] how to configure your i2Rest server.
 

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