Created
May 16, 2022 10:54
-
-
Save dubeyji10/7e778f7eadd09df9c842591639cca51f to your computer and use it in GitHub Desktop.
# for insertion of lead to zoho crm using v2 api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
update access token after running refresh token api request