shad5951 / android-market-api

Automatically exported from code.google.com/p/android-market-api
0 stars 0 forks source link

RuntimeException with "Bad request 400" for certain start index #13

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

Market API throws bad request "Response code = 400, msg = Bad Request" for
certain indexes. 
    private static MarketSession newSession() {
        MarketSession session = new MarketSession();
        session.login("########", "#####");
        return session;
    }

    public static void main(String[] args) throws Exception {
        MarketSession session = newSession();
        MarketSession.Callback callback = new MarketSession.Callback() {
            public void onResult(ResponseContext context, Object response) {
                showCount();
            }
        };
        AppsRequest appsRequest =
AppsRequest.newBuilder().setStartIndex(190).setEntriesCount(

10).setAppType(AppType.APPLICATION).setWithExtendedInfo(false).build();
        session.append(appsRequest, callback);
        session.flush();
    }

What is the expected output? What do you see instead?

Expected: List some applications, or useful message.
Actual: RuntimeException with bad request. 

What version of the product are you using? On what operating system?
The latest API.

Please provide any additional information below.

Original issue reported on code.google.com by quickboo...@gmail.com on 16 Apr 2010 at 7:03

GoogleCodeExporter commented 8 years ago
"Expected: List some applications, or useful message."

The request your making isn't valid.

Since this api doesn't perform validation prior to submitting the request, the 
market
is rejecting the request and only giving a 400 as a response. It doesn't 
actually
return useful information, so there is nothing for this api to tell you other 
than
that :)

Original comment by strazz@gmail.com on 16 Apr 2010 at 5:06

GoogleCodeExporter commented 8 years ago
Is there any way to list all applications? Thank you!

Original comment by quickboo...@gmail.com on 17 Apr 2010 at 2:29

GoogleCodeExporter commented 8 years ago
how can i download the query app's .apk file? Thank you very much!

Original comment by greenmao...@gmail.com on 27 Apr 2010 at 3:36

GoogleCodeExporter commented 8 years ago
I would also like to know how to download the query app's .apk file!

Original comment by lber...@gmail.com on 2 May 2010 at 6:08

GoogleCodeExporter commented 8 years ago
@quickbook123

Not it one request, you must make multiple requests to do so

@greenmaomao @lberger

That's out of scope of this issue - and it requires more work than this api 
currently
has done.

Original comment by strazz@gmail.com on 4 May 2010 at 3:45

GoogleCodeExporter commented 8 years ago
I perform the same query with different indexes (less than 800) and sometimes i 
get response code 400. I couldn't find a pattern that generates this error and 
there is not much info returned by API. Do you have an idea about the market 
limitations? Like number of requests allowed ...

Original comment by cars...@gmail.com on 3 Aug 2010 at 7:00

GoogleCodeExporter commented 8 years ago
In MarketSession.executeRawHttpQuery(byte[] request){
    ....
    String request64 = Base64.encodeBytes(request);
    ....
}

This "request64" sometimes contains a '/' character.
If you replace this '/' to '-', bug will be fixed.

Original comment by debug1984213@gmail.com on 15 Sep 2010 at 2:15

GoogleCodeExporter commented 8 years ago
debug1984213, thank you so much,

just encode the bytes with options URL_SAFE, 
now everything works fine. 

String request64 = Base64.encodeBytes(request, Base64.URL_SAFE);

Original comment by changma...@gmail.com on 16 Sep 2010 at 4:32

GoogleCodeExporter commented 8 years ago

Original comment by thiel.al...@gmail.com on 7 Dec 2010 at 7:36