Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Google Play Services Interacting with Your API Write a Retrofit interface

Challenge Task 3 of 4 Annotate the activeListings method so that it does a GET request on the "/listings/active" path.

Challenge Task 3 of 4 Annotate the activeListings method so that it does a GET request on the "/listings/active" path.

com/etsy/android/samples/sharesy/api/Api.java
package com.etsy.android.samples.sharesy.api;

import com.etsy.android.samples.sharesy.model.ActiveListings;

import retrofit.Callback;
import retrofit.http.GET;
import retrofit.http.Query;

// YOUR CODE HERE

  public interface Api {
    @GET("/listings/active") 
void activeListings(@Query("includes") String includes
                    , Callback<ActiveListings> callback);

}
private static Api getApi() {
                    return new RestAdapter.builder()
                      setEndpoint("https://openapi.etsy.com/v2"
                      .build()
                      .create(Api.class);
}

please help guys, i have been stuck here for a week, cant seem to figure what this code challenge task 3 is all about ?

3 Answers

Hi. We're doing exactly the same thing as in the lesson video here: setting up the query to the API. So your interface code is absolutely correct.

However, the challenge ends here, it's just about the query. We do not need to create an instance and deal with the results of the query here. So just remove the second part of your code (the getApi() method) and you will be fine.

Hope that helps :)

back again here, whats wrong again here

Challenge Task 2 of 4 Set the type of this Intent as plain text: "text/plain".

MY ANSWER

Intent shareIntent = new Intent(Intent.ACTION_SEND); Intent.putExtra(Intent.EXTRA_TEXT, textToShare); intent.setType("text/plain"); ​

i dont know what was happening, i reached that task 3 and i did exactly what you told me , and for the past 4 days its was giving me errors (bummer), this was the second time i was posting this question, dont know why they were giving me a wrong answer, 'but thanks a lot my friend you are a life saver, thank you so much

You're welcome :)

Sometimes having some lines commented out can trigger an error. Maybe it was your case?

yaa maybe, thanks a lot

import com.etsy.android.samples.sharesy.model.ActiveListings;

import retrofit.Callback; import retrofit.http.GET; import retrofit.http.Query;

// YOUR CODE HERE

public interface Api { @GET("/listings/active") void activeListings(@Query("includes") String includes , Callback<ActiveListings> callback);

}