Difference between revisions of "Device flow usecase 1"

From i2Rest
Jump to: navigation, search
Line 9: Line 9:
 
;step 1
 
;step 1
 
:Execute command  
 
:Execute command  
   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)
+
   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')
  AUTHPW(oauth21) AUTHURL('http://i2rest.com:22088/oauth2/device') TOKENURL('http://i2rest. com:22088/oauth2/access') SCOPE(manager_functions)
+
  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
 
;step 2

Revision as of 14:21, 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
User Accept
step 3
check the result