PageRenderTime 49ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/plus-serviceaccount-cmdline-sample/instructions.html

https://gitlab.com/udarnick/google-api-java-client-samples
HTML | 103 lines | 91 code | 12 blank | 0 comment | 0 complexity | 23236954c05e88ad9a0c38206b4ba512 MD5 | raw file
  1. <html>
  2. <title>plus-serviceaccount-cmdline-sample</title>
  3. <body>
  4. <h2>Instructions for the Google+ V1 Service Accounts Command-Line Sample</h2>
  5. <h3>Browse Online</h3>
  6. <ul>
  7. <li><a
  8. href="http://code.google.com/p/google-api-java-client/source/browse?repo=samples#hg/plus-serviceaccount-cmdline-sample">Browse
  9. Source</a>, or main file <a
  10. href="http://code.google.com/p/google-api-java-client/source/browse/plus-serviceaccount-cmdline-sample/src/main/java/com/google/api/services/samples/plus/serviceaccount/cmdline/PlusServiceAccountSample.java?repo=samples">PlusServiceAccountSample.java</a>
  11. </li>
  12. </ul>
  13. <h3>Register Your Application</h3>
  14. <ul>
  15. <li>Visit the <a href="https://code.google.com/apis/console/?api=plus">Google
  16. apis console</a>
  17. </li>
  18. <li>If this is your first time, click "Create project..."</li>
  19. <li>Otherwise, click on the drop down under the "Google apis" logo at
  20. the top left, and click "Create..." under "Other projects"</li>
  21. <li>Click on "API Access", and then on "Create an OAuth 2.0 Client
  22. ID...".</li>
  23. <li>Enter a product name and click "Next".</li>
  24. <li>Select "Service Account" and click "Create client ID".</li>
  25. <li>Click "Download private key" and close the window.</li>
  26. <li>Entry the "Email address" shown under "Service account" into <a
  27. href="src/main/java/com/google/api/services/samples/plus/serviceaccount/cmdline/PlusServiceAccountSample.java">src/main/java/com/google/api/services/samples/plus/serviceaccount/cmdline/PlusServiceAccountSample.java</a>.
  28. </li>
  29. </ul>
  30. <h3>Checkout Instructions</h3>
  31. <p>
  32. <b>Prerequisites:</b> install <a href="http://java.com">Java 6</a>, <a
  33. href="http://mercurial.selenic.com/">Mercurial</a>, and <a
  34. href="http://maven.apache.org/download.html">Maven</a>. You may need to
  35. set your
  36. <code>JAVA_HOME</code>
  37. .
  38. </p>
  39. <pre>
  40. cd <i>[someDirectory]</i>
  41. hg clone https://code.google.com/p/google-api-java-client.samples/ google-api-java-client-samples
  42. cd google-api-java-client-samples/plus-serviceaccount-cmdline-sample
  43. <i>update key.p12 file</i>
  44. <i>[editor]</i> src/main/java/com/google/api/services/samples/plus/serviceaccount/cmdline/PlusServiceAccountSample.java
  45. mvn compile
  46. mvn -q exec:java
  47. </pre>
  48. <p>To enable logging of HTTP requests and responses (highly recommended
  49. when developing), please take a look at <a href="logging.properties">logging.properties</a>.</p>
  50. <h3>Setup Project in Eclipse</h3>
  51. <p>
  52. <b>Prerequisites:</b> install <a href="http://www.eclipse.org/downloads/">Eclipse</a>,
  53. the <a href="http://javaforge.com/project/HGE">Mercurial plugin</a>, and the
  54. <a href="http://m2eclipse.sonatype.org/installing-m2eclipse.html">Maven
  55. plugin</a>.
  56. </p>
  57. <ul>
  58. <li>Setup Eclipse Preferences
  59. <ul>
  60. <li>Window &gt; Preferences... (or on Mac, Eclipse &gt;
  61. Preferences...)</li>
  62. <li>Select Maven
  63. <ul>
  64. <li>check on "Download Artifact Sources"</li>
  65. <li>check on "Download Artifact JavaDoc"</li>
  66. </ul>
  67. </li>
  68. </ul>
  69. </li>
  70. <li>Import <code>plus-serviceaccount-cmdline-sample</code> project
  71. <ul>
  72. <li>File &gt; Import...</li>
  73. <li>Select "General &gt; Existing Project into Workspace" and click
  74. "Next"</li>
  75. <li>Click "Browse" next to "Select root directory", find <code>
  76. <i>[someDirectory]</i>/google-api-java-client-samples/plus-serviceaccount-cmdline-sample
  77. </code> and click "Next"
  78. </li>
  79. <li>Click "Finish"</li>
  80. </ul>
  81. </li>
  82. <li>Run
  83. <ul>
  84. <li>Right-click on project plus-serviceaccount-cmdline-sample</li>
  85. <li>Run As &gt; Java Application</li>
  86. <li>If asked, type "PlusServiceAccountSample" and click OK</li>
  87. </ul>
  88. </li>
  89. </ul>
  90. </body>
  91. </html>