This topic contains 1 reply, has 2 voices, and was last updated by Andrey Yatsenko 5 years, 8 months ago.
- Topic
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-
<?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-
I don’t understand how to do this. Please give me any suggestion.Thanks.
The forum ‘OroCRM’ is closed to new topics and replies.