Difference between revisions of "I2Rest Advanced Setup"
Pavel.lobko (talk | contribs) |
Pavel.lobko (talk | contribs) |
||
Line 11: | Line 11: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== run_program API call== | == run_program API call== |
Revision as of 14:04, 29 June 2020
This section describes configuration options of i2Rest Server. Basic configuration allows only demo server functionality, and must be extended to supply full functional server instancence. Combining examples bellow you can achieve server functionality that suits your requirements.
- SSL conections secure
- i2Rest Gate URL definition using unix socket
- How to require OAuth2 authentication (тут только *LOCAL сессии и минимальную настройку юзера, клиента и скоупа для run_program, pcml для echo)
- How to allow command call API (тут только *LOCAL сессии и минимальную настройку юзера, клиента и скоупа для run_command)
- How to allow calls to management API
- How to call API located on remote IBM i server
- Custom scopes Это на будущее, сейчас можно не описывать. Мы с тобой как-то обсуждали про то, что можно добавить собственный скоуп, использовать его в настройке полномочий и передавать его в сессию
- API configuration examples
run_program API call
Unlike anonimous API call we performed in our basic guide, authorized API call requires Oauth2 token with "run_program" scope and *local
Session System defined.
So that's how we will change your basic server configuration (with or without ssl protection) to perform authorized run_program API call:
- a) Add the snippet bellow to the session systems object:
{ "name": "*LOCAL", "submit": SBMJOB JOB(I2RESTS) USER(${user}) CMD(CALL I2REST PARM( '-session' '-url' '${surl}' '-uid' '${uid}' '-user' '${user}' '-init' 'ADDLIBLE I2REST')) '-dcm_client_id' 'MYCLIENT'))" },
- b) Register two users on IBM i - one for a "сlient" parameter and one for a "user" parameter.
- c) Fill the OAuth2 object template above with IBM i users values and add to your *.json.
- d) Add the "run_program" scope to scopes object.
- e) Change the pscms object as follows:
"pcmls":
[
{
"pcml_mount" : "echo",
"pcml_file" : "<complete name of i2restecho.pcml on IFS (for example /tmp/PCML/i2restecho.pcml)>",
"valid_in_anonymous" : false
}
]
- f) Restart server to apply your new configuration *.json.
Now you can update your SoapUI ECHO test project with Authorization profile and perform your authorized API call.