You need to sign in to do that
Don't have an account?
Qihao Guo
python to create case
import requests
import urllib3
from simple_salesforce import Salesforce
urllib3.disable_warnings()
sf = Salesforce( username='username', password = 'password', security_token='RjWJloN2hZi0V4vyA5ruSQs5')
access_token = sf.session_id
url = 'https://bell7-dev-ed.develop.my.salesforce.com/services/data/v55.0/sobjects/Case'
parms = {
"Status": "New",
"Origin": "Web",
"Subject": "Test case",
"Priority": "Medium",
"Description": "TO Test whether I can post the Case",
}
auth ={'Authorization' : 'Bearer ' + access_token, 'Content-type' : 'application/json'}
res = requests.post(url, headers = auth, params = parms)
print(res.text)
this is my python code, which I want to create a new case in salesforce, but it will give me "message":"The HTTP entity body is required, but this request has no entity body.","errorCode":"JSON_PARSER_ERROR"
so which part I made wrong?
import urllib3
from simple_salesforce import Salesforce
urllib3.disable_warnings()
sf = Salesforce( username='username', password = 'password', security_token='RjWJloN2hZi0V4vyA5ruSQs5')
access_token = sf.session_id
url = 'https://bell7-dev-ed.develop.my.salesforce.com/services/data/v55.0/sobjects/Case'
parms = {
"Status": "New",
"Origin": "Web",
"Subject": "Test case",
"Priority": "Medium",
"Description": "TO Test whether I can post the Case",
}
auth ={'Authorization' : 'Bearer ' + access_token, 'Content-type' : 'application/json'}
res = requests.post(url, headers = auth, params = parms)
print(res.text)
this is my python code, which I want to create a new case in salesforce, but it will give me "message":"The HTTP entity body is required, but this request has no entity body.","errorCode":"JSON_PARSER_ERROR"
so which part I made wrong?
This seem to be issue with python and not salesforce issue. however check below reference to create case in salesforce using python.
https://stackoverflow.com/questions/66367719/how-to-create-a-case-in-a-salesforce-using-python
Please mark as Best Answer if above information was helpful.
Thanks,