title: How to upload file using RoboSpice Google Http Java Client module with JSON Data
body: <p>I'm using <code>RoboSpice Google Http Java Client module</code> and I'm successfully executing <code>POST</code> request using <code>JSON</code> data. </p>
  
  <p><strong>Problem :</strong>  My problem is now I've to attach <code>byte[]</code> data in <code>POST</code> request but I'm unable to find any way to do this with <code>RoboSpice Google Http Java Client module</code>.</p>
  
  <p><strong>Here is my code snippet :</strong></p>
  
  <pre><code>public class SaveUserProfile_Request extends GoogleHttpClientSpiceRequest&lt;SaveUserProfile&gt; {
      private String apiUrl;
      private JSONObject mJsonObject;
      private String filePath;
  
      public SaveUserProfile_Request(JSONObject mJsonObject, String filePath) {
      super(SaveUserProfile.class);
      this.apiUrl = AppConstants.GLOBAL_API_BASE_ADDRESS + AppConstants.API_SAVE_PROFILE;
      this.mJsonObject = mJsonObject;
      this.filePath = filePath;
      }
  
      @Override
      public SaveUserProfile loadDataFromNetwork() throws IOException {
      Ln.d("Call web service " + apiUrl);
  
      HttpRequest request = getHttpRequestFactory().buildPostRequest(new GenericUrl(apiUrl),
          ByteArrayContent.fromString("application/json", mJsonObject.toString()));
  
      request.setParser(new JacksonFactory().createJsonObjectParser());
  
      return request.execute().parseAs(getResultType());
      }
  
  }
  </code></pre>
  
  <p>I tried using <code>Multipart HTTP Requests</code> but it doesn't work.</p>