Difference between revisions of "Device flow usecase 1"
Pavel.lobko (talk | contribs) |
Pavel.lobko (talk | contribs) |
||
Line 7: | Line 7: | ||
:[[Add SSL]] sertificate “google.com” to your DCM CLIENT. | :[[Add SSL]] sertificate “google.com” to your DCM CLIENT. | ||
− | Step 1 | + | ;Step 1 |
:Execute command | :Execute command | ||
I2REST COMMAND(*POST) URL('https://www.googleapis.com/drive/v3/files') BODY(*N '{"name":"i2rest.doc"}' 'application/json' *YES 1208) OUTPUT(*BOTH) DCMCLIENT(MYCLIENT) RECVLOG('/home/btpl/recv.log') SENTLOG('/home/btpl/sent.log') | I2REST COMMAND(*POST) URL('https://www.googleapis.com/drive/v3/files') BODY(*N '{"name":"i2rest.doc"}' 'application/json' *YES 1208) OUTPUT(*BOTH) DCMCLIENT(MYCLIENT) RECVLOG('/home/btpl/recv.log') SENTLOG('/home/btpl/sent.log') | ||
Line 16: | Line 16: | ||
:i2rest client (it's built-in program for sending requests) provide you with link - go ahead and follow it. | :i2rest client (it's built-in program for sending requests) provide you with link - go ahead and follow it. | ||
:[[File:Device-flow-usecase1.png]] <br> | :[[File:Device-flow-usecase1.png]] <br> | ||
− | Find youself on device connection page. Proceed with "Next" button. | + | :Find youself on device connection page. Proceed with "Next" button. |
:[[File:Device-flow-usecase2.png]] | :[[File:Device-flow-usecase2.png]] | ||
− | Grant access to requested scope. | + | :Grant access to requested scope. |
:[[File:Device-flow-usecase3.png]] | :[[File:Device-flow-usecase3.png]] | ||
− | Here we are! | + | :Here we are! |
:[[File:Device-flow-usecase4.png]] | :[[File:Device-flow-usecase4.png]] | ||
;Step 3 | ;Step 3 |
Revision as of 18:02, 6 April 2020
Google drive API
Lets walk step by step through our example with creating "i2rest.doc" file on "i2restexample" user's Google Drive
- Preparations
- At the very begining your application should be registrated as a client (obtaining Device ID and Device Password) on Google.
- Add SSL sertificate “google.com” to your DCM CLIENT.
- Step 1
- Execute command
I2REST COMMAND(*POST) URL('https://www.googleapis.com/drive/v3/files') BODY(*N '{"name":"i2rest.doc"}' 'application/json' *YES 1208) OUTPUT(*BOTH) DCMCLIENT(MYCLIENT) RECVLOG('/home/btpl/recv.log') SENTLOG('/home/btpl/sent.log') TOKENS('/qsys.lib/qtemp.lib/tokens.usrspc') AUTHID('677815701888-dfa6i6tcrvqpvmc1acii98ij32h7lc3j.apps.googleusercontent.com') AUTHPW('2Rstk_A-u4rbLcm6OFcclMz5') AUTHURL('https://oauth2.googleapis.com/device/code') TOKENURL('https://oauth2.googleapis.com/token') SCOPE('https://www.googleapis.com/auth/drive.file')
- Step 2
- i2rest client (it's built-in program for sending requests) provide you with link - go ahead and follow it.
- Find youself on device connection page. Proceed with "Next" button.
- Grant access to requested scope.
- Here we are!
- Step 3
- Сheck the result. We didn't make a screenshot with i2rest.doc on our example Google Drive, you can check your own file right now. And some proofs from JobLog.
- As you can see, Authorization Token was obtain, and servers responded with Status 200 to our POST request.