Closed Sheppsu closed 3 years ago
Just to make sure, are you specifying _id=1556076
or cursor[_id]=1556076
? you're supposed to do the latter.
Just to make sure, are you specifying
_id=1556076
orcursor[_id]=1556076
? you're supposed to do the latter.
when I tried to do the latter I got an error from Python:
requests.exceptions.HTTPError: 422 Client Error: Unprocessable Entity for url: https://osu.ppy.sh/api/v2/beatmapsets/search?sort=ranked&m=osu&cursor%5B_id%5D=1556076
so I tried just _id which didn't cause an error but it didn't grab the next page. So I tried page and that worked. I didn't really experiment much with trying to get rid of the error while using "cursor[_id]=1556076" though.
You must supply all cursor parameters to the query, not just _id
(eg in this case you also need an approved_date
). The cursor object you received previously should have had this attribute, all you need to do is forward it to the next api call.
You must supply all cursor parameters to the query, not just
_id
. In this case you also need anapproved_date
. The cursor object you received previously should have had this attribute, all you need to do is forward it to the next api call.
Ok I'll try this when I get back to playing around with it. I had no idea the cursor had such an attribute.
Cursor parameter is not supposed to be built manually. You should forward the one from previous result as is.
If you think you need to know what should go inside cursor parameter, you're doing it wrong.
Cursor parameter is not supposed to be built manually. You should forward the one from previous result as is.
If you think you need to know what should go inside cursor parameter, you're doing it wrong.
The way I had my objects built unloaded the data (in this case 'cursor': {'approved_date': '1596234279000', '_id': '1189904'}
) into class attributes, such as cursor._id, since this is what I did with all the other objects. Though now I realize I can just supply {'approved_date': '1596234279000', '_id': '1189904'}
to the request function as query parameters and there's really no need for a class lol
Thanks for the help!
Just make sure it's not passing the original json as string...
For example in php
// $previousResult = ['beatmapsets' => [...], 'cursor' => [...], ...]
http_build_query(['cursor' => $previousResult['cursor'], ... other parameters ...])
or jquery
// previousResult = { beatmapsets: [...], cursor: {...}, ... }
$.param({ cursor: previousResult.cursor, ... other parameters ... })
The cursor returned from /beatmapsets/search has an _id attribute, but in order to query the next page of search results I have to use "page=2" in the url query rather than "_id=1556076". Am I doing something wrong or is the cursor supposed to return page rather than _id?