P2P Forum

Lending Club Discussion => Foliofn - LC => Topic started by: hdsouza on November 26, 2017, 12:00:00 AM

Title: Buy notes on the secondary market with API
Post by: hdsouza on November 26, 2017, 12:00:00 AM
Hi
If I try to buy a NOTE from the SECONDARY market using the PHP script below, I get "Internal Server Error 1510609349610".

I know that My ID and API Key are correct, because I can use them and successfully get the balance and  Notes I currently own, using the same script.
For example here is a note I was trying to buy: https://www.lendingclub.com/foliofn/browseNotesLoanPerf.action?showfoliofn=true&loan_id=80600463&order_id=117950693&note_id=130430010

Any ideas. Please help
Thanks

Code: [Select]
Title: Buy notes on the secondary market with API
Post by: TravelingPennies on December 09, 2017, 12:00:00 AM
Hi,  Can anyone please help?
Title: Buy notes on the secondary market with API
Post by: Fred93 on December 10, 2017, 12:00:00 AM
Any time you get a "server error", I would ask LC.  That means something went wrong inside their server, likely something unusual you did that was not checked at the right spot to give you a decent error message.
Title: Buy notes on the secondary market with API
Post by: AnilG on December 10, 2017, 12:00:00 AM
Have you been able to successfully make simple Folio API buy call first? The best practice for using API calls is to first make the simplest API call, capture the received errors and responses and then incorporate rest of the logic. Have you captured the complete response received from your curl API buy call? Have you inserted debugging statements to see where your program craps out?
Title: Buy notes on the secondary market with API
Post by: Rob L on December 10, 2017, 12:00:00 AM
You might try to talk to the API using the program SoapUI first. It's an excellent tool.
An open source free download is at: https://www.soapui.org/

Here's an example of a Folio API sell in C using libcurl. If I remember (its been a while), the transfer and accept encoding setopts are very important. Probably why I commented those lines. I doubt its changed but this code hasn't been run in over a year. No guarantees, use this code at your own risk.

Code: [Select]
Title: Buy notes on the secondary market with API
Post by: TravelingPennies on December 10, 2017, 12:00:00 AM
Thanks Anil, Fred.
I am able to get the OWNED NOTES and BALANCE with the script, so i believe the api call is correct
Only wen I execute the BUY part of the script, it gives the "Internal Server Error"
What would the syntax be for a "simple Folio API buy call"? Do you have any examples I can use.
I tried going over the LC docs too.
Unfortunately the script was written by someone else and is not longer available, so I am trying to get it to work.

Thanks
Hil
Title: Buy notes on the secondary market with API
Post by: apc3161 on December 10, 2017, 12:00:00 AM
You can try emailing LC directly, they've been pretty supportive in my experience.
Title: Buy notes on the secondary market with API
Post by: TravelingPennies on December 22, 2017, 12:00:00 AM
After lots of back and forth with LC support they are now telling me that there is a different Key to buy Notes off the secondary market (other than the Api). They mention that, its the reason why my script (above) is not working. I do not find any key other than my API.
Is that true or are they just yanking my chain?
Title: Buy notes on the secondary market with API
Post by: TravelingPennies on December 22, 2017, 12:00:00 AM
from: hdsouza on December 22, 2017, 12:21:39 PM
Title: Buy notes on the secondary market with API
Post by: TravelingPennies on December 23, 2017, 12:00:00 AM
I thought so too. But here is the email I received from support
Quote
Title: Buy notes on the secondary market with API
Post by: TravelingPennies on December 23, 2017, 12:00:00 AM
from: hdsouza on December 23, 2017, 09:31:44 AM
Title: Buy notes on the secondary market with API
Post by: TravelingPennies on December 29, 2017, 12:00:00 AM
Thanks Fred for the details.

I modified the script with the authorization header and key and I still get the "Internal server error". 
I have debugged the code further and I see the error appears on line $server_output .

Code: [Select]
Title: Buy notes on the secondary market with API
Post by: TravelingPennies on December 29, 2017, 12:00:00 AM
Quote
Title: Buy notes on the secondary market with API
Post by: TravelingPennies on December 29, 2017, 12:00:00 AM
Thanks Fred. That did it!!!!
I finally got a "SUCCESS_PENDING_SETTLEMENT"
Title: Buy notes on the secondary market with API
Post by: TravelingPennies on December 29, 2017, 12:00:00 AM
Now you get to learn the joys of "PENDING SETTLEMENT", and how many don't make it thru this step.
Title: Buy notes on the secondary market with API
Post by: hdsouza on December 29, 2017, 12:00:00 AM
Yes i have encountered a few of those already :)

In my research of getting this script to work I had opened numerous requests, one of which was lendingclub support. They mentioned an interesting tool, which could write the code for you. So for some of us who are not technically savvy that would be a good starting point.
It is https://www.getpostman.com/. You download the software and its free for the most part.
So to get you balance you could do something like this. They have a CODE option to the right where can save the resulting code.. They have several  nice options, like php, ruby, java, etc, etc

I could not get the Buys to work via postman, but lending club support mentioned that their developer would be back after the holidays and would assist then
Title: Buy notes on the secondary market with API
Post by: jheizer on December 29, 2017, 12:00:00 AM
HA! Yes. What maybe like 50%?  My folio buyer always drove me mad.
Title: Buy notes on the secondary market with API
Post by: Fred93 on December 29, 2017, 12:00:00 AM
from: jheizer on December 29, 2017, 07:06:15 PM
Title: Buy notes on the secondary market with API
Post by: TravelingPennies on December 29, 2017, 12:00:00 AM
Lol that your data was even close to my annoyance feeling.  I finally just turned it off between that and just wanting to shift to away from having even more of the same vintage I already had.
Title: Buy notes on the secondary market with API
Post by: TravelingPennies on December 29, 2017, 12:00:00 AM
I just sent LC another Fred93-0-gram asking them to tell us why so many secondary note purchases fail.  ... with excerpts from my log, asking about specific note failures, etc.  So... starting this dialog once again.
Title: Buy notes on the secondary market with API
Post by: TravelingPennies on January 08, 2018, 12:00:00 AM
Does anyone have an automated  way to get the list of notes available on the secondary market. I am not referring to the DOWNLOAD FULL INVENTORY but a list based on selection criteria - DOWNLOAD SEARCH RESULTS.?
I dont believe LC had Oath or some kind of authentication other than using the brower and loggin in manually, correct?
Title: Buy notes on the secondary market with API
Post by: TravelingPennies on January 08, 2018, 12:00:00 AM
from: hdsouza on January 08, 2018, 05:48:10 PM
Title: Buy notes on the secondary market with API
Post by: apc3161 on January 09, 2018, 12:00:00 AM
from: hdsouza on January 08, 2018, 05:48:10 PM
Title: Buy notes on the secondary market with API
Post by: TravelingPennies on January 12, 2018, 12:00:00 AM
Thanks Fred. That is great info.
I have already reached out to LC investor support. I finally pointed them to what you mentioned as far as an API for the specific usage, and they did provide the API.

Although the only query parameters they have with the API is "updatedSince". I was expecting they would have queries based on credit score and several other filters. Did you have the same experience?
Title: Buy notes on the secondary market with API
Post by: Dave101 on January 12, 2018, 12:00:00 AM
from: hdsouza on January 12, 2018, 07:04:32 PM
Title: Buy notes on the secondary market with API
Post by: TravelingPennies on January 12, 2018, 12:00:00 AM
Appreciate the response, but that was not my question. I was not looking at "updated since".
 I was looking for query based on credit scrore, ask price, ytm.. all the options that they already have on the buy notes site to filter notes.  Any experience in combining these options with the API URL?

Maybe I will shoot LC support another email
Title: Buy notes on the secondary market with API
Post by: TravelingPennies on January 12, 2018, 12:00:00 AM
from: hdsouza on January 12, 2018, 07:33:32 PM
Title: Buy notes on the secondary market with API
Post by: TravelingPennies on January 12, 2018, 12:00:00 AM
from: hdsouza on January 12, 2018, 07:04:32 PM
Title: Buy notes on the secondary market with API
Post by: TravelingPennies on January 12, 2018, 12:00:00 AM
from: Dave101 on January 12, 2018, 07:15:31 PM
Title: Buy notes on the secondary market with API
Post by: TravelingPennies on January 13, 2018, 12:00:00 AM
from: Fred93 on January 12, 2018, 09:07:13 PM
Title: Buy notes on the secondary market with API
Post by: Rob L on January 13, 2018, 12:00:00 AM
Quote"> from: Dave101 on January 13, 2018, 02:32:21 AM
Title: Buy notes on the secondary market with API
Post by: Dave101 on January 14, 2018, 12:00:00 AM
from: Rob L on January 13, 2018, 11:29:42 AM
Title: Buy notes on the secondary market with API
Post by: TravelingPennies on January 14, 2018, 12:00:00 AM
from: Dave101 on January 14, 2018, 10:56:53 AM