# Unable to create deal - Getting Status code - 415

**URL:** <https://community.hubspot.com/t/unable-to-create-deal-getting-status-code-415/25848>\
**Category:** APIs & Integrations\
**Tags:** object\
**Created:** [September 23, 2020, 12:21pm UTC](https://community.hubspot.com/t/unable-to-create-deal-getting-status-code-415/25848 "2020-09-23T12:21:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![testuser27](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/testuser27/32/35493_2.png) [@testuser27](https://community.hubspot.com/u/testuser27)\
**Post date:** [September 23, 2020, 12:21pm UTC](https://community.hubspot.com/t/unable-to-create-deal-getting-status-code-415/25848/1 "2020-09-23T12:21:39Z")

</div>

I tried to search in community for get same issue but didn’t get solutions for my issue.  
While creating deal or contact i’m getting 415 status code while it get success using postman api call . Below i mention my curl call please help me asap to resolve it.

$headers = array(‘Content-Type: application/json’,‘Cache-Control: no-cache’);  
if (count($extraHeader)){  
$headers = array\_merge($headers, $extraHeader);  
}

$ch = @curl\_init();  
@curl\_setopt($ch, CURLOPT\_SSL\_VERIFYPEER, false);  
if ($type == ‘post’) {  
@curl\_setopt($ch, CURLOPT\_POST, TRUE);  
@curl\_setopt($ch, CURLOPT\_POSTFIELDS, $data);  
} else if ($type == ‘put’) {  
@curl\_setopt($ch, CURLOPT\_CUSTOMREQUEST, “PUT”);  
@curl\_setopt($ch, CURLOPT\_POSTFIELDS, $data);  
} else {  
@curl\_setopt($ch, CURLOPT\_POST, FALSE);  
}  
@curl\_setopt($ch, CURLOPT\_URL, $endpoint);  
@curl\_setopt($ch, CURLOPT\_HEADER, true);  
@curl\_setopt($ch, CURLOPT\_HTTPHEADER, $headers);  
@curl\_setopt($ch, CURLOPT\_FRESH\_CONNECT, 1);  
// if (in\_array($\_SERVER[‘REMOTE\_ADDR’], array(‘127.0.0.1’))) {  
// curl\_setopt($ch, CURLOPT\_PROXY, ‘192.168.10.5:8080’);  
// }  
@curl\_setopt($ch, CURLOPT\_RETURNTRANSFER, true);  
$response = @curl\_exec($ch);  
$status\_code = @curl\_getinfo($ch, CURLINFO\_HTTP\_CODE);  
$curl\_errors = curl\_error($ch);  
createLog(‘Curl Error’, $curl\_errors, $logObj);  
createLog(‘Curl Status code’, $status\_code, $logObj);  
@curl\_close($ch);  
$response = json\_decode($response);  
createLog(‘RESPONSE’, $response, $logObj);

return json\_encode(array(“response” =\> $response, “status” =\> $status\_code));

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [September 24, 2020, 6:23pm UTC](https://community.hubspot.com/t/unable-to-create-deal-getting-status-code-415/25848/2 "2020-09-24T18:23:57Z")

</div>

Hey @testuser27 ,

Thanks for adding your question here!

Could you please let us know what the endpoint you are trying to reach is as well as the complete URL that you are using (xxx for hapikey if necessary!).

Also, I realize you said it is working in postman, but could you also include an example of the json body that you are using?

@himanshurauthan , @Jsum !

Do you have any thoughts on where the error is in this cURL script

Thanks!!

d
