This topic contains 3 replies, has 2 voices, and was last updated by dzakharov 6 years, 7 months ago.
- Topic
Hi,
I have an installation of orocrm 2.0.
I created a third party form to create contact in orocrm. As many doc available to generate api key
and wsse authentication and i done these .
But i want to create contacts in orocrm from a third party form and code is here to do this-
1234567891011121314151617181920212223242526272829303132333435363738394041<?php ?><!DOCTYPE html><html><head><title>Rest api </title></head><body><form id="contactForm" method="POST" name="contactForm"><input type="text" name="firstname" /><input type="submit" name="submit"></form><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.0/jquery.min.js" type="text/javascript"></script><script type="text/javascript">$(function(){$("#contactForm").on('submit', function(event){var $this = $(this);event.preventDefault();var values = {};$.each($this.serializeArray(), function(i, field) {values[field.name] = field.value;});$.ajax('http://localhost:8000/app_dev.php/api/rest/latest/contacts', {type: "POST",beforeSend: function(xhrObj){xhrObj.setRequestHeader('Authorization: WSSE profile="UsernameToken" X-WSSE: UsernameToken Username="hotel", PasswordDigest="07zx7Dq7Qx3rkIuIE7FwN8Y6Gyg=", Nonce="NWM3NDY4MjFhMDk3ODY4NQ==", Created="2017-07-27T10:59:27+01:00"');}}).done(function( data ) {console.log(data);});});});</script></body></html>This gives error-
123GET http://localhost:8000/app_dev.php/api/rest/latest/contacts?firstname=kusum curl.php:1XMLHttpRequest cannot load http://localhost:8000/app_dev.php/api/rest/latest/contacts?firstname=kusum. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access. The response had HTTP status code 401.I don’t understand how to do this. Please give me any suggestion.
Thank you in advance.
The forum ‘OroCRM’ is closed to new topics and replies.