title: Multiple requests with retrofit to combine results
body: <p>Im using retrofit (1.9) and trying to work out how i can call 2 apis and merge the results.</p>
  
  <p>I guess the results should be merged when last api has finished returning a response...</p>
  
  <p>How can i do this?</p>
  
  <p>Udpate, as per Antons answer I have tried the following:</p>
  
  <p>added to gradle:</p>
  
  <pre><code>  compile 'io.reactivex:rxjava:1.0.+'
      compile 'io.reactivex:rxandroid:0.23.+'
  </code></pre>
  
  <p>Api interface</p>
  
  <pre><code> @GET("/maps/api/place/details/json")
      Observable&lt;PlaceDetailResult1&gt; getPlacesFrom1( @Query("key") String key,  @Query("placeid") String placeid);
  
  
  @GET("api/places/{id}/ratings")
  Observable&lt;PlaceDetailResult2&gt; getPlacesFrom2(@Path("id") String id);
  </code></pre>
  
  <p>In fragment</p>
  
  <pre><code>     IPlaces api = adapter.create(IPlaces.class); //endpoint1
       IPlaces api2 = adapter2.create(IPlaces.class); //endpoint2
  
      Observable.combineLatest(
              api.getPlacesFrom1("key", placeId),
              api2.getPlacesFrom2(placeId),
          new Func2&lt;PlaceDetailResult1, PlaceDetailResult2, MergedReviews&gt;() {
              @Override
              public MergedReviews call(PlaceDetailResult placeDetailResult1, PlaceDetailResult2 placeDetailResult2) {
                  // processToMerge(  placeDetailResult1, placeDetailResult2)
                  return mr;
              }
  
              })
              .subscribeOn(Schedulers.newThread())
              .observeOn(AndroidSchedulers.mainThread())
              .subscribe(new Observer&lt;MergedReviews&gt;() {
                  @Override
                  public void onCompleted() {
  
                  }
  
                  @Override
                  public void onError(Throwable e) {
  
                  }
  
                  @Override
                  public void onNext(MergedReviews mr) {
  
                      SetAdapter(mr.reviews);
                      SetPhotosAdapter(mr.photos);
                  }
              });
  </code></pre>
  
  <p>One thing maybe worth noting, when I added RxJava to gradle i was getting some error, which went away after I did <code>multiDexEnabled true</code> in the gradle file</p>