Skip to content

Instantly share code, notes, and snippets.

@dubeyji10
Created May 16, 2022 10:54
Show Gist options
  • Save dubeyji10/7e778f7eadd09df9c842591639cca51f to your computer and use it in GitHub Desktop.
Save dubeyji10/7e778f7eadd09df9c842591639cca51f to your computer and use it in GitHub Desktop.
# for insertion of lead to zoho crm using v2 api
from pprint import pprint
import requests
import json
url = "https://www.zohoapis.in/crm/v2/Leads"
# trying to insert a lead using api and requests
'''
this is just a sample dummy input to the crm
'''
payload = json.dumps({
"data": [
{
"Company": "Test Company",
"First_Name":"Samplefirstname",
"Last_Name":"Lastname",
"Lead_Source": "advertisement 1",
"Email": "[email protected]",
"Title": "a sample title",
"Mobile": "9292131399",
"Skype_ID": "@iamskype2"
}
],
"trigger": [
"approval",
"workflow",
"blueprint"
]
})
headers = {
'Authorization': 'Bearer access_token_generated_from_oauth_request',
'Content-Type': 'application/json',
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
@dubeyji10
Copy link
Author

update access token after running refresh token api request

@dubeyji10
Copy link
Author

python code inserts data into zoho crm

success_insert_record

changes reflected on zoho crm

success_insert_lead_1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment