Jump to content
X2Community Forums

Recommended Posts

I am having difficulties getting a POST to work through the API. I have several GET's working but seem to be doing something wrong with the POST. Here is what I am doing:

X2CRM version 8.3

Desktop application using Python 3.x

api_url for Post = https://www.mywebsite.com/x2crm/api2/Accounts

headerPost = {'Content-Type':'application/json'}

Sample Json = {"name": "Joe Schmoe", "type": "Prospect", "address": "213", "address2": "", "city": "Wala", "state": "WA", "zipcode": "12343", "country": "", "phone": "", "phone2": "", "website": "", "alternativeEmail": "", "annualRevenue": "", "assignedTo": "", "backgroundInfo": "", "businessEmail": "", "closedate": "", "c_creditscorealpha": "", "c_executivefirstname": "", "c_executivegender": "", "c_executivelastname": "", "c_executivetitle": "", "c_faxnumbercombined": "", "c_inactive": "0", "c_isuanumber": "", "c_locationemployeesizerange": "", "c_locationsalesvolumerange": "", "c_max_hours": "", "c_primarysiccode": "", "c_recordtype": "", "c_siccode1": "", "c_siccode1description": "", "c_subscriber": "", "c_subscriber_hours": "", "dealstatus": "", "dealvalue": "", "description": "", "doNotCall": "", "doNotEmail": "", "email": "", "employees": "", "expectedCloseDate": "", "facebook": "", "googleplus": "", "interest": "", "leadDate": "", "leadscore": "", "leadSource": "", "leadstatus": "", "leadtype": "", "linkedin": "", "modelName": "", "otherUrl": "", "parentAccount": "", "personalEmail": "", "preferredEmail": "", "primaryContact": "", "priority": "", "rating": "", "skype": "", "tickerSymbol": "", "timezone": "", "title": "", "trackingKey": "", "twitter": "", "visibility": "1"}

Python snippet:

response = requests.post(api_url, json=company_json, headers=headerPost,
                        auth=HTTPBasicAuth(apiUser, apiKey))

Any ideas what I am doing wrong?

Thanks for your help!!

Link to post
Share on other sites
19 hours ago, jack said:

Hi Maleman,
Can you post the response you are getting.
-Jack

Here is the response I am getting: Error 406 - An appropriate representation of the requested resource could not be found on this server. This error was generated by Mod_Security.

Thanks for your help!

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...