Goodreads Developers discussion

30 views
questions > Help! Can’t get books on a private member’s shelf (Swift)

Comments Showing 1-4 of 4 (4 new)    post a comment »
dateDown arrow    newest »

message 1: by Aaron (last edited Jun 09, 2018 12:04PM) (new)

Aaron (aaronct123) | 4 comments Currently trying to use reviews.list to list the names of books on a user’s shelf. This seems to work for public members, but I’m testing on my profile (which is visible to friends only) and can’t get it to work. The doc says it requires using OAuth, but I’ve already authorized access and have a working token. Is there an additional parameter I’m supposed to pass in in this case? This what the code looks like right now (I’m using OAuthSwift and Strongbox):


func showShelves(_ oauthswift: OAuth1Swift, userID: String) {
let _ = oauthswift.client.get(
"https://www.goodreads.com/shelf/list.xml",
parameters: ["key": developerKey, "id": userID],
success: { response in
let xml = SWXMLHash.parse(response.data)
for shelf in xml["GoodreadsResponse"]["shelves"]["user_shelf"].all {
print(shelf["name"].element!.text)
}
print(response)
},
failure: { error in
print(error)
})
}


Any help would be amazing!

EDIT: Just realized I posted the wrong snippet. 🤦‍♂️This is the function that isn’t working for profiles with limited visibility:

func showCurrentlyReading(_ oauthswift: OAuth1Swift, userID: String) {
let _ = oauthswift.client.get(
"https://www.goodreads.com/review/list",
parameters: ["id": userID, "key": developerKey, "v": "2"],
success: { response in
print(response)
},
failure: { error in
print(error)
})
}



message 2: by Oleg (new)

Oleg Linkin (maledictus) | 60 comments Works well for me, but I use c++.


message 3: by Marisa (new)

Marisa (moretta) | 13 comments It works for me in Python.


message 4: by Aaron (new)

Aaron (aaronct123) | 4 comments I named my functions poorly and posted the wrong snippet. This is the one that’s giving me the 403 error for profiles with limited visibility.


func showCurrentlyReading(_ oauthswift: OAuth1Swift, userID: String) {
let _ = oauthswift.client.get(
"https://www.goodreads.com/review/list...",
parameters: [:],
success: { response in
print(response)
},
failure: { error in
print(error)
})
}



back to top