Difference between revisions of "I2Rest Client command"
Pavel.lobko (talk | contribs) |
Pavel.lobko (talk | contribs) |
||
Line 8: | Line 8: | ||
|style="color: #8080FF; font-weight: bold;»|URL || API endpoint || Path name || Required || | |style="color: #8080FF; font-weight: bold;»|URL || API endpoint || Path name || Required || | ||
|- | |- | ||
− | |style="color: #8080FF; font-weight: bold;»|rowspan="5" BODY || Stream file || Path name ||rowspan="5"| Optional|| | + | |style="color: #8080FF; font-weight: bold;»|rowspan="5"| BODY || Stream file || Path name ||rowspan="5"| Optional|| |
|- | |- | ||
| or Body string || Character value || | | or Body string || Character value || | ||
Line 18: | Line 18: | ||
| To CCSID || Number || | | To CCSID || Number || | ||
|- | |- | ||
− | |style="color: | + | |style="color: #8080FF; font-weight: bold;"| rowspan="2"| HEADERS || Name || Character value ||rowspan="2"| Optional || |
|- | |- | ||
| Value || Character value || | | Value || Character value || | ||
|- | |- | ||
− | |style="color: #8080FF; font-weight: bold; | + | |style="color: #8080FF; font-weight: bold;"|rowspan=7| ATTACH || Attachments || Character value ||rowspan="7"| Optional || |
|- | |- | ||
| Stream file || Path name || | | Stream file || Path name || |
Revision as of 14:38, 1 April 2020
I2rest command description
Parameters
Keyword | Description | Choices | Notes | |
---|---|---|---|---|
COMAND | Comand | *POST, *GET, *PUT, *DEL | Required | |
URL | API endpoint | Path name | Required | |
rowspan="5"| BODY | Stream file | Path name | Optional | |
or Body string | Character value | |||
MIME type | Character value | |||
Convert? | *YES, *NO | |||
To CCSID | Number | |||
rowspan="2"| HEADERS | Name | Character value | Optional | |
Value | Character value | |||
rowspan=7| ATTACH | Attachments | Character value | Optional | |
Stream file | Path name | |||
or Body string | Character value | |||
ID | Character value, *Same | |||
MIME type | Character value | |||
Convert? | *YES, *NO | |||
To CCSID | Number | |||
style="color: #8080FF; font-weight: bold;"TOSTMF | Save response to stream file | Path name | Optional | |
style="color: #8080FF; font-weight: bold;"REPLACE | Replace stream file? | *YES, *NO | Optional | |
style="color: #8080FF; font-weight: bold;"STMFCCSID | Stream file CCSID | Number | Optional | |
CONVERT | Convert output data? | *YES, *NO | Optional | |
OUTPUT | Output log events to | *NONE, *PRINT, *JOBLOG, *BOTH | Optional | |
DCMCLIENT | DCM client application ID | Character value | Optional | |
RECVLOG | Log recv messages | Character value | Optional | |
SENTLOG | Log sent messages | Character value | Optional | |
AUTHMETHOD | Authentication method | *OAUTH2D, *OAUTH2C, *BASIC, *NONE | Required | |
TOKENS | Tokens storage | Character value | Optional | |
REUSE | Try to use saved token | *YES, *NO | Optional | |
REFRESH | Try to use refresh token | *YES, *NO | Optional | |
ASK | Ask for authorization | Character value, *REQUESTER, *NONE | Optional | |
PROMPT | Show authorization screen? | *REQUESTER, *BOTH, *REMOTE, *NONE, *READONLY | Optional | |
WAIT | Time to wait authorization | Number | Optional | |
RMTUSRLEN | Length of Authorizer field | 10, Number | Optional | |
RMTAUTPGM | Program to send remote request | Name, *DFT | Optional | |
AUTHID | User/OAuth2 client/device ID | Character value | Optional | |
AUTHPW | User/OAuth2 client/dev passwd | Character value | Optional | |
AUTHURL | OAuth2 authorization endpoint | Character value | Optional | |
TOKENURL | OAuth2 token endpoint | Character value | Optional | |
SCOPE | OAuth2 authorization scopes | Character value | Optional |
Comand (COMAND)
Specify the request method used for the URI request.
This is a required parameter.
API endpoint (URL)
Enter the URI that will be requested.
This is a required parameter.
Body (BODY)
Specify request body details (if any).
Qualifier 1: Stream file
Specify location of the stream file that you will be uploaded. Should be entered if "or Body string" parameter is blanks.
Qualifier 2: or Body string
Specify attributes of the stream file that you will be uploaded. Should be entered if "Stream file" parameter is blanks.
Qualifier 3: MIME type
Specify MIME-type of a request body.
Qualifier 4: Convert?
Specifies whether a request body data should be converted to another CCSID.
Qualifier 5: To CCSID?
Specifies CCSID request body data should be converted to. Must be entered, if *YES specified for the "Convert?" parameter.
Additional Headers (HEADERS)
Specify Additional headers for request (if any).
Qualifier 1: Name
Specify the name of an Additional header.
Qualifier 2: Value
Specify the value of an Additional header.
Attachments (ATTACH)
Specify request attachments details (if any).
This is an optional parameter.
Qualifier 1: Stream file
Specify location of the stream file that you will be uploaded. Should be entered if "or Body string" parameter is blanks.
Qualifier 2: or Body string
Specify attributes of the stream file that you will be uploaded. Should be entered if "Stream file" parameter is blanks.
Qualifier 3: MIME type
Specify MIME-type of the attachment.
Qualifier 4: ID
Specify stream file name for server upload.
*Same - to use "Stream file" parameter
Qualifier 5: Convert?
Specifies whether attachment data should be converted to another CCSID.
Qualifier 6: To CCSID?
Specifies CCSID attachment data should be converted to. Must be entered, if *YES specified for the "Convert?" parameter.
Save response to stream file (TOSTMF)
Specify whether responce data should be saved to stream file.
Replace stream file? (REPLACE)
Specify whether straeam file data should be overridden.
Stream file CCSID? (STMFCCSID)
Specify CCSID of a stream file.
Convert output data? (CONVERT)
Specifies whether attachment data should be converted to another CCSID.
Output log events to (OUTPUT)
Specify logging destination
Log recv messages (RECVLOG)
Path to log file. Either IFS or LIB file system approach (ex. - '/qsys.lib/qtemp.lib/recv.log') could be applied.
Log sent messages (SENTLOG)
Path to log file. Either IFS or LIB file system approach (ex. - '/qsys.lib/qtemp.lib/sent.log') could be applied.
Authentication method (AUTHMETHOD)
Specifies authentification method for the request.
*OAUTH2D - stands for OAuth2 Device flow *OAUTH2C - stands for OAuth2 Client flow *BASIC - a method for an HTTP user agent to provide a user name and password when making a request *NONE - no authentification method used.
Tokens storage (TOKENS)
Path to token storage file. Either IFS or LIB file system approach (ex. - '/qsys.lib/qtemp.lib/tokens.usrspc') could be applied.
Try to use saved token (REUSE)
Specifies either saved token should be used with request
Try to use saved token (REFRESH)
Specifies either refresh token flow should be used with request
Ask for authorization (ASK)
Specify either authorization request should be performed.
Show authorization screen? (PROMPT) Specifies roles to be familiarized with authorization screen
*REQUESTER - User perfoming request *BOTH - requester and remote user *REMOTE - some other IBM I user *NONE *READONLY
Program to send remote request (RMTAUTPGM) Specify application to be used to pole authorization server.
*DFT - built-in I2rest application
User/OAuth2 client/device ID (AUTHID)
Specify OAuth2 client/device ID to be authentificated with authorization server.
User/OAuth2 client/dev passwd (AUTHPW)
Specify OAuth2 client/device password to be authentificated with authorization server.
OAuth2 authorization endpoint (AUTHURL)
Specify URI to be requested for OAuth2 client/device authorization.
OAuth2 token endpoint (TOKENURL)
Specify URI to be requested for a OAuth2 flow token.
OAuth2 authorization scopes (SCOPE)
Specifies authorization scopes should be used with request. Used with *OAUTH2D or *OAUTH2C authentification method
Examples
Example 1 Device flow<
>
I2REST COMMAND(*POST) URL('http://192.168.0.233:8080') BODY(*N '{"command"
- "STATUS"}' 'application/json' *YES 1208) OUTPUT(*BOTH) TOKENS('/qsys.lib/qtemp.
lib/tokens.usrspc') ASK(*REQUESTER) PROMPT(*REQUESTER) AUTHID(OAUTH21) AUTHPW(oa uth21) AUTHURL('http://i2rest.com:22088/oauth2/device') TOKENURL('http://i2rest. com:22088/oauth2/access') SCOPE(manager_functions)