Author Topic: listing API error?  (Read 446 times)

mikedev10

  • Newbie
  • *
  • Posts: 37
    • View Profile
    • Email
listing API error?
« on: December 31, 2018, 12:03:13 PM »
curl -v -i --header "Authorization:Eq9d5t24343243423" --header "Accept:text/plain" --header "Content-Type:text/plain" -XGET https://api.lendingclub.com/api/investor/v1/secondarymarket/listings?updatedSince=10

if i do this i get a 401 unauthorized, with my fake auth code above; i assume everything else is valid; looks like it to me.  when i put my actual auth code in, i get a 500 internal server error.  am i doing something wrong here?

Fred93

  • Hero Member
  • *****
  • Posts: 2129
    • View Profile
Re: listing API error?
« Reply #1 on: December 31, 2018, 06:21:46 PM »
curl -v -i --header "Authorization:Eq9d5t24343243423" --header "Accept:text/plain" --header "Content-Type:text/plain" -XGET https://api.lendingclub.com/api/investor/v1/secondarymarket/listings?updatedSince=10

if i do this i get a 401 unauthorized, with my fake auth code above; i assume everything else is valid; looks like it to me.

It is a general security principle that authorization should be tested FIRST, and no other actions taken if authorization fails.  Presuming that the LC programmers followed this principle, you should not judge anything to be correct just because authorization failed.  Only after authorization succeeds are other parameters tested.


Quote
when i put my actual auth code in, i get a 500 internal server error.  am i doing something wrong here?

Change the accept header to Accept:text/csv .  That works for me.  Yes, I do realize that the documentation doesn't tell you this, but that's the way it is.

I also don't use a content-type header on this command, but I don't know whether that matters.

mikedev10

  • Newbie
  • *
  • Posts: 37
    • View Profile
    • Email
Re: listing API error?
« Reply #2 on: January 01, 2019, 08:57:10 PM »
awesome thanks!

liquidp2p_dev

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: listing API error?
« Reply #3 on: January 01, 2019, 09:54:51 PM »
I remember encountering this issue when setting up 2M listing retrieval. Fred93 is correct that changing the Accept header is the key.