Starting i2Rest Server instance

From i2Rest
Jump to: navigation, search

To start i2Rest Server instance, you need JSON configuration file . See instructions how to prepare simplest config.
There are two ways to start i2Rest Server instance:

  1. Using SBMJOB
    ADDLIBLE I2REST
    SBMJOB CMD(CALL PGM(I2REST) PARM('-start' '-config' '<path to *.json config file>')) ALWMLTTHD(*YES)
  2. From QShell terminal:
    STRQSH
    liblist -a I2REST
    export QIBM_MULTI_THREADED=Y
    /QSYS.LIB/I2REST.LIB/I2REST.PGM -start -config <path to *.json config file>

With first option, you can define any additional options for submitting job. Only two things are required - ALWMLTTHD(*YES) and I2REST library in library list of submitted job.
Second option is useful when there is no "syslog" parameter defined in json config file. In this case, all output messages will be printed in qshell console. Note that if qshell console will be closed, server instance will be stopped automatically. To leave qshell console without closing it, use F12 and execute STRQSH again to return back. Job that serving this i2Rest Server instance under QShell will have name nnnnnn/<your_user_id>/QP0ZSPWT.
Now, with your own i2Rest Server instance running, you can proceed to test API call.

Required authority

If your server is used to process only anonymous services, then the authorization of the user who starts the server must be sufficient to execute programs registered as services.
If the server is supposed to handle any kind of the OAuth2 flows, then the user who will run the server must have *USE authority to user profiles of i2Rest Server Users and Clients.

Troubleshooting

If something went wrong and you don't know what is going on, here is a sequence of places to look out for:

  • NETSTAT *CNN - use this command to ensure that your server is running and listening for client connections on the port(s) specified in the config file
  • WRKUSRJOB <user who submitted i2Rest> *ACTIVE - to view the list of active jobs of the user who started the i2Rest Server. Find the i2Rest Server job here, open it with "5" and look at its job log ("10"), spool files ("4"), call stack ("11") and threads ("20")
  • WRKSPLF SELECT(<user who submitted i2Rest>) - to view spooled files for completed jobs
  • If you configured logging of server events in syslog file, use the command WRKLNK '<the name of syslog file>' to look at its content
  • If you are stuck and cannot move on - contact us, we will certainly help. Attach a description of the problem, config file, screens of the above commands, we'll figure something out!