0

I am monitoring a sensor network through Etherios, a cloud based sensor network server. They have a PUSH MONITOR service. The service takes a username and password:

<Monitor>
  <monTopic>DeviceCore,XbeeCore</monTopic>
  <monTransportType>http</monTransportType>
  <monTransportUrl>your website url</monTransportUrl>
  <monTransportToken>username:password</monTransportToken>
  <monFormatType>json</monFormatType>
  <monBatchSize>100</monBatchSize>
  <monCompression>none</monCompression>
  <monBatchDuration>10</monBatchDuration>
</Monitor>

Is it possible to have data PUSHed directly to Google Drive? Will Drive accept the username:password for authorization? Or do I need to have the data PUSHed to an App and then put into another form that includes an authorization token specific to Goole Drive?:

POST https://www.googleapis.com/upload/drive/v2/files?uploadType=media

OR

POST /upload/drive/v2/files?uploadType=media HTTP/1.1
Host: www.googleapis.com
Content-Type: image/jpeg
Content-Length: number_of_bytes_in_JPEG_file
Authorization: Bearer your_auth_token

1 Answers1

0

Is it possible to have data PUSHed directly to Google Drive?

No

Will Drive accept the username:password for authorization?

No

Or do I need to have the data PUSHed to an App and then put into another form that includes an authorization token specific to Goole Drive?:

Yes. It's not too difficult. Briefly your steps are:-

  1. Register an app on the Google cloud console https://cloud.google.com/console/project
  2. Use the app client id in Oauth2 Playground to generate a refresh token (which is the oauth equivalent of a username/password) How do I authorise an app (web or installed) without user intervention? (canonical ?)
  3. Write an app for Appenegine that has the embedded refresh token.
  4. Your app will:-
    1. Accept the post from Etherios
    2. Use the refresh token to get an access token (default token duration is one hour) https://developers.google.com/accounts/docs/OAuth2WebServer#refresh
    3. Create a Drive post request as in your question to create a Drive file using the etherios data and the access token
Community
  • 1
  • 1
pinoyyid
  • 21,499
  • 14
  • 64
  • 115