Difference between revisions of "Management API config"

From i2Rest
Jump to: navigation, search
 
(7 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
:Register two users on IBM i.
 
:Register two users on IBM i.
 
;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, user (must be a regestered IBM i user) and client (must be a regestered IBM i user) with appropriate values.
+
: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). Сopy and paste the snippet bellow. Replace with appropriate values highlighted with <b>bold</b> parts: host_name, ports, user (resource owner) and client.
[[I2Rest_quick_config|Basic configuration]] management API variant (differences are highlighted in <span style="background:#e3f6d0;">green</span>):
+
For clarity, differences with [[I2Rest_quick_config|Basic configuration]] are highlighted in <span style="background:#D3D3D3;">gray</span>:
 +
 
  
 
  {
 
  {
 
     "gates":
 
     "gates":
 
     {
 
     {
       <span style="background:#D3D3D3;">"main"      : {"url":"http://'''<host_name>[:port] (for example api.i2rest.com:1234)'''"},</span>
+
       "main"      : {"url":"http://'''<host_name>[:port] (for example api.i2rest.com:1234)'''"},
       <span style="background:#D3D3D3;">"management" : {"url":"http://'''<host_name>[:port] (for example api.i2rest.com:4321)'''"}</span>
+
       "management" : {"url":"http://'''<host_name>[:port] (for example api.i2rest.com:4321)'''"}
 
     },
 
     },
 
  <span style="background:#D3D3D3;">  "OAuth2":
 
  <span style="background:#D3D3D3;">  "OAuth2":
Line 20: Line 21:
 
       "users":
 
       "users":
 
       {
 
       {
         "<span style="color:#22d3d3;">USRX</span>":{"description":"<span style="color:#22d3d3;">John Johnes</span>","valid_clients":{"<span style="color:#22d3d3;">TSTCLNT</span>":{"scopes":["management_functions"]}}}
+
         "'''USRX'''":{"description":"'''John Johnes'''","valid_clients":{"'''TSTCLNT'''":{"scopes":["management_functions"]}}}
 
       },
 
       },
 
       "clients":
 
       "clients":
 
       {
 
       {
         "<span style="color:#22d3d3;">TSTCLNT</span>":{"redirect_uri":"<span style="color:#22d3d3;"><main gate URL></span>/oauth2/redirect",  
+
         "'''TSTCLNT'''":{"redirect_uri":"'''<main gate URL>'''/oauth2/redirect",  
 
                     "description":"Test client",  
 
                     "description":"Test client",  
 
                     "valid_scopes":["management_functions"],
 
                     "valid_scopes":["management_functions"],

Latest revision as of 14:26, 9 July 2020

Management APIs includes functions that can be used to do some management stuff - change runtime parameters, query current status of server instance, etc. OAuth2 token with management_functions scope is required for any management Api call.

Step 1
Register two users on IBM i.
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). Сopy and paste the snippet bellow. Replace with appropriate values highlighted with bold parts: host_name, ports, user (resource owner) and client.

For clarity, differences with Basic configuration are highlighted in gray:


{
   "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)"}
   },
   "OAuth2":
   {
     "scopes": {"management_functions" : {"description":"i2Rest management APIs call"}
     },
     "users":
     {
        "USRX":{"description":"John Johnes","valid_clients":{"TSTCLNT":{"scopes":["management_functions"]}}}
     },
     "clients":
     {
        "TSTCLNT":{"redirect_uri":"<main gate URL>/oauth2/redirect", 
                   "description":"Test client", 
                   "valid_scopes":["management_functions"],
                   "valid_grant_types":["authorization_code"]}
     },
     "tokens": {"type":"token"},"codes":{"type":"code"}
   } 
}
 

Please take a look how to obtain Oauth2 token from i2Rest Server with SoapUI, and than proceed to Management api authorized call.