# add contact data to mautic Oauth 2 rest api

**URL:** https://forum.mautic.org/t/add-contact-data-to-mautic-oauth-2-rest-api/9250
**Category:** Development
**Created:** [August 16, 2017, 1:55pm UTC](https://forum.mautic.org/t/add-contact-data-to-mautic-oauth-2-rest-api/9250 "2017-08-16T13:55:04Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![webdev](https://avatars.discourse-cdn.com/v4/letter/w/b2d939/32.png) [@webdev](https://forum.mautic.org/u/webdev)
#### Post date: [August 16, 2017, 1:55pm UTC](https://forum.mautic.org/t/add-contact-data-to-mautic-oauth-2-rest-api/9250/1 "2017-08-16T13:55:04Z")

</div>

Code:

Hi, 

I have used Oauth 2 rest api on my site.  
I am trying to add the contacts on mautic but getting follwing error :-

{“errors”:[{“message”:“Looks like I encountered an error (error #404). If I do it again, please report me to the system administrator!”,“code”:404,“type”:null}],“error”:{“message”:“Looks like I encountered an error (error #404). If I do it again, please report me to the system administrator! (`error` is deprecated as of 2.6.0 and will be removed in 3.0. Use the `errors` array instead.)”,“code”:404}}

here is my code :-  
$contact\_data = array(  
‘firstname’ =\> $first\_name,  
‘lastname’ =\> $last\_name,  
‘email’ =\> $email  
);  
$data\_json = json\_encode($contact\_data);

```
	echo $data_json;
	//echo $url_con="https://ecomhorizons.taurosmail.com/api/contacts/new?firstname=John&lastname=Smith&access_token=".$access_token;
	
   $url_con	=	"https://ecomhorizons.taurosmail.com/api/contacts/new/?access_token=".$access_token;
	$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url_con);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$data_json);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
	 print_r($response); 

```

please help me .

Thanks

---

<div class="post-metadata">

### Author: ![webdev](https://avatars.discourse-cdn.com/v4/letter/w/b2d939/32.png) [@webdev](https://forum.mautic.org/u/webdev)
#### Post date: [August 16, 2017, 1:55pm UTC](https://forum.mautic.org/t/add-contact-data-to-mautic-oauth-2-rest-api/9250/2 "2017-08-16T13:55:04Z")

</div>

[code]Hi,

I have used Oauth 2 rest api on my site.  
I am trying to add the contacts on mautic but getting follwing error :-

{“errors”:[{“message”:“Looks like I encountered an error (error #404). If I do it again, please report me to the system administrator!”,“code”:404,“type”:null}],“error”:{“message”:“Looks like I encountered an error (error #404). If I do it again, please report me to the system administrator! (`error` is deprecated as of 2.6.0 and will be removed in 3.0. Use the `errors` array instead.)”,“code”:404}}

here is my code :-  
$contact\_data = array(  
‘firstname’ =\> $first\_name,  
‘lastname’ =\> $last\_name,  
‘email’ =\> $email  
);  
$data\_json = json\_encode($contact\_data);

```
	echo $data_json;
	//echo $url_con="https://ecomhorizons.taurosmail.com/api/contacts/new?firstname=John&lastname=Smith&access_token=".$access_token;
	
   $url_con	=	"https://ecomhorizons.taurosmail.com/api/contacts/new/?access_token=".$access_token;
	$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url_con);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$data_json);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
	 print_r($response); 

```

please help me .

Thanks[/code]
