Integrating customer references into user profiles using Frappe's APIs

Hello everyone
I hope you’re doing well. I’m currently working on integrating customer references into user profiles using Frappe’s APIs. While I’ve made progress with user creation and customer creation through APIs, I’m facing challenges adding reference customer to user.
def create_connection(self, customer, email):
connection_url = “https:///api/resource/Connection/”
payload = {
“customer_name”: customer,
“email”: email
headers = {‘Authorization’: f"token {token}",
‘Content-Type’: ‘application/json’,
response =, headers=headers, json=payload)
return response
If anyone has experience with Frappe APIs or similar integrations, I would greatly appreciate your advice or insights.
Thanks for your time!