0

I am writing a C# program for my son's class (that will be used by several students from different computers and external IPs). The app basically uploads an assignment the students wrote to their own personal Google Drive account.

I am trying to get the external IP of their PC, without using any 3rd party services such as whatismyip.com etc.

I have done research about this for a few hours, and I know that 'Google Apps Unlimited' basically allows paying customers (aka not me) and organizations to pay 10$/month and find out who uploaded each file to the google drive account.

My question is how, using the API, I can view the IP address of the PC that uploaded the file?

Thanks.

pinoyyid
  • 21,499
  • 14
  • 64
  • 115
  • 1
    Using the Drive API, you can't. You'll need to use some other service that reflects the IP back to the sender. – pinoyyid Sep 05 '16 at 06:47
  • A Google service/API request? – Jimmy Warner Sep 05 '16 at 07:02
  • I wouldn't bother. It would pollute the API, and create potentially large maintenance issues (remember Google's infrastructure is massively distributed), all to implement a feature which, strictly speaking, has nothing to do with the storage and retrieval of files in Google Drive. – pinoyyid Sep 06 '16 at 14:26

1 Answers1

0

Since uploading files still uses either the create API or update API (which both returns a File resource), it doesn't indicate that there's a way to know the IP address using the API.

You may have to check it using a 3rd party library (I believe whatsmyip has a C# library as indicated in this question; which you might have been referring to from the start).

Community
  • 1
  • 1
adjuremods
  • 2,938
  • 2
  • 12
  • 17
  • I came across this: https://developers.google.com/drive/v3/web/query-parameters but I couldn't find any examples. This contains the userIp parameter which might solve my problem – Jimmy Warner Sep 05 '16 at 08:50
  • I believe that's more of you supplying the user's IP which can help you "per-user-quotas" and capping usage, but still not get the user's IP address itself unfortunately – adjuremods Sep 05 '16 at 09:09