How to add new Payment to Sales Invoice using Frappe API python lib?

Hello, I want to add new ‘Payment Entry’ to ‘Sales Invoice’ using Frappe Python lib. Can you help me with example?
Im trying to do something like this:

from frappeclient import FrappeClient

client = FrappeClient(‘URL’, ‘username’, ‘password’)
payment_ref = {
‘doctype’: ‘Payment Entry Reference’,
‘reference_doctype’: ‘Sales Invoice’,
‘reference_name’: ‘SINV-00002’,
‘bill_no’ : ‘12345’,
‘total_amount’: ‘50.0’,
‘outstanding_amount’: ‘50.0’,
‘allocated_amount’: ‘45.0’
}
client.insert(payment_ref)

payment = {
‘doctype’: ‘Payment Entry’,
‘payment_type’: ‘Receive’,
‘posting_date’: ‘2017-12-15’,
‘paid_to’: ‘bank1’,
‘paid_to_account_currency’: ‘USD’,
‘paid_amount’: ‘50’,
‘received_amount’: ‘50’,
‘reference_no’: ‘1234567’,
‘reference_date’: ‘2017-12-15’,
‘references’: ???
}
client.insert(payment)

It should be something like:

your_payment_reference_list = [{
‘bill_no’ : ‘12345’,
‘total_amount’: ‘50.0’,
‘outstanding_amount’: ‘50.0’,
‘allocated_amount’: ‘45.0’
}]

payment = {
‘doctype’: ‘Payment Entry’,
‘payment_type’: ‘Receive’,
‘posting_date’: ‘2017-12-15’,
‘paid_to’: ‘bank1’,
‘paid_to_account_currency’: ‘USD’,
‘paid_amount’: ‘50’,
‘received_amount’: ‘50’,
‘reference_no’: ‘1234567’,
‘reference_date’: ‘2017-12-15’,
‘references’: your_payment_reference_list
}

I’m new to ERPNext can u plz help me what is the rest api URL, method and request Parameters