title: Google Drive Rest API on Android
body: <p>I'm developing an app for a company and I need to integrate it with Google Drive. I can't use the native API because the company has files not created by the application that needs to be handled, I need the full drive scope, so the REST API is what I must use.</p>
  
  <p>Here's the problem, the tutorials are not basic enough for me to get started since I only have a very basic understanding of JSON and REST.</p>
  
  <p>The tutorial: <a href="https://developers.google.com/drive/web/integrate-create" rel="nofollow">https://developers.google.com/drive/web/integrate-create</a></p>
  
  <p>As I understand it I need to create JSON in my Java code and then pass that through the example code?</p>
  
  <p>JSON</p>
  
  <pre><code>{
    "action":"create",
    "folderId":"0ADK06pfg",
    "userId":"103354693083460731603"
  }
  </code></pre>
  
  <p>JAVA</p>
  
  <pre><code>public class State {
    /**
     * Action intended by the state.
     */
    public String action;
  
    /**
     * IDs of files on which to take action.
     */
    public Collection&lt;String&gt; ids;
  
    /**
     * Parent ID related to the given action.
     */
    public String parentId;
  
    /**
     * Empty constructor required by Gson.
     */
    public State() {}
  
    /**
     * Create a new State given its JSON representation.
     *
     * @param json Serialized representation of a State.
     */
  
    public State(String json) {
      GsonBuilder builder = new GsonBuilder();
      Gson gson = builder.create();
      State other = gson.fromJson(json, State.class);
      this.action = other.action;
      this.ids = other.ids;
      this.parentId = other.parentId;
    }
  }
  </code></pre>
  
  <p>The problem is that I have no idea how to create JSON nor do I quite understand how to use the JSON when created to do things like create files and query for files.</p>
  
  <p>If someone can get me as far as creating an empty file in a users root folder then I can probably take it from there, but I could really use a nudge in the right direction!</p>