# 405 Method not allowed

**URL:** <https://community.hubspot.com/t/405-method-not-allowed/16293>\
**Category:** APIs & Integrations\
**Tags:** companies\
**Created:** [September 18, 2019, 11:49am UTC](https://community.hubspot.com/t/405-method-not-allowed/16293 "2019-09-18T11:49:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DaganRead](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/daganread/32/31851_2.png) [@DaganRead](https://community.hubspot.com/u/DaganRead)\
**Post date:** [September 18, 2019, 11:49am UTC](https://community.hubspot.com/t/405-method-not-allowed/16293/1 "2019-09-18T11:49:08Z")

</div>

In the method that’s failing i make a PUT request to [https://api.hubapi.com/companies/v2/companies/$id](https://api.hubapi.com/companies/v2/companies/)  
I’m using the ryanwinchester/hubspot-php library version ~1.2. We dynamically create the properties for the request based on the information in our website. We save the company id in our website so when we update the company we already have the id.  
I catch any errors and log them. The error i’m recieving is:  
2019/09/18 08:34:05 [error] 29889#0: \*49607 FastCGI sent in stderr: "PHP message: [HubspotHelper] CompanyUpdate HTTP/1.1 405 Method Not Allowed  
Date: Wed, 18 Sep 2019 08:34:05 GMT  
Content-Length: 0  
Connection: keep-alive  
Set-Cookie: \_\_cfduid=d5d95d054a0e70b0248bffdaf7d09bf821568795645; expires=Thu, 17-Sep-20 08:34:05 GMT; path=/; domain=.

> **[HubSpot Developers | Create tomorrow's solutions today on HubSpot's Developer...](https://developers.hubspot.com/)**
>
> Craft experiences with HubSpot’s Developer Platform—APIs, SDKs, tooling, and sample apps, plus a world-class builder community. Get started with a free account.

; HttpOnly  
X-Trace: 2B1558743E7AE095E83EE3B5492BBD281888B7A21A000000000000000000  
Allow: POST,GET,OPTIONS  
Access-Control-Allow-Credentials: false  
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload  
Expect-CT: max-age=604800, report-uri="

[https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct](https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct)

"  
Server: cloudflare  
CF-RAY: 5181fa905e2135fa-LHR" while reading response header from upstream, client: 172.16.10.115, server: gr5-api.guestrevuapp.internal, request: “POST /api/v1/property HTTP/1.1”, upstream: “fastcgi://unix:/var/run/php-fpm/www.sock:”, host: "

[my-api.guestrevuapp.com](http://my-api.guestrevuapp.com)

", referrer: "

[https://my.guestrevuapp.com/accountprofile/edit](https://my.guestrevuapp.com/accountprofile/edit)

"  
I’m struggling to reproduce this error in my local. It only happens on our live server.  
Thank you in advance!

---

<div class="post-metadata">

**Author:** ![lscanlan](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/lscanlan/32/66262_2.png) [@lscanlan](https://community.hubspot.com/u/lscanlan)\
**Post date:** [September 18, 2019, 5:11pm UTC](https://community.hubspot.com/t/405-method-not-allowed/16293/2 "2019-09-18T17:11:43Z")

</div>

Hi @DaganRead,

Do you have the request URL from that error log? I know you said you’re making a PUT to [https://api.hubapi.com/companies/v2/companies/{$id}](https://api.hubapi.com/companies/v2/companies/%7B$id%7D), but do you have an example URL for one of your requests? It should be possible to make a PUT request to that endpoint ([https://developers.hubspot.com/docs/methods/companies/update\_company](https://developers.hubspot.com/docs/methods/companies/update_company)), so I wonder if your request is just going somewhere else that doesn’t allow a PUT request. You could also try creating an issue for it here: [Issues · HubSpot/hubspot-php · GitHub](https://github.com/ryanwinchester/hubspot-php/issues). It seems like other people have posted questions specific to that API client as issues; maybe someone else has come across this. But if you have an example request URL, I’m happy to look a little closer at what’s going on here, because you shouldn’t be getting a 405 to that endpoint.

---

<div class="post-metadata">

**Author:** ![DaganRead](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/daganread/32/31851_2.png) [@DaganRead](https://community.hubspot.com/u/DaganRead)\
**Post date:** [September 19, 2019, 6:48am UTC](https://community.hubspot.com/t/405-method-not-allowed/16293/3 "2019-09-19T06:48:38Z")

</div>

The request is generated by the library. I have an example of the request that is being generated. Unfortunetly i can’t seem to reproduce the error on my local. And i don’t capture the request information in our live server.  
[19-Sep-2019 06:42:10 UTC] put

[19-Sep-2019 06:42:10 UTC] [https://api.hubapi.com/companies/v2/companies/148117427?hapikey=xxx](https://api.hubapi.com/companies/v2/companies/148117427?hapikey=xxx)

[19-Sep-2019 06:42:10 UTC] Array  
(  
[json] =\> Array  
(  
[properties] =\> Array  
(  
[0] =\> stdClass Object  
(  
[name] =\> name  
[value] =\> The Langdon  
)

[1] =\> stdClass Object  
(  
[name] =\> v5\_account\_id  
[value] =\> -1001-The Langdon  
)

[2] =\> stdClass Object  
(  
[name] =\> tripadvisor\_account\_id  
[value] =\> 6401202  
)

[3] =\> stdClass Object  
(  
[name] =\> property\_type  
[value] =\> Accommodation Provider  
)

[4] =\> stdClass Object  
(  
[name] =\> country  
[value] =\> ZA  
)

[5] =\> stdClass Object  
(  
[name] =\> phone  
[value] =\> +44 800 133 7023  
)

[6] =\> stdClass Object  
(  
[name] =\> website  
[value] =\> [www.guestrevu.com](http://www.guestrevu.com)  
)

[7] =\> stdClass Object  
(  
[name] =\> domain  
[value] =\> [guestrevu.com](http://guestrevu.com)  
)

[8] =\> stdClass Object  
(  
[name] =\> existing\_solution  
[value] =\> GuestRevu V5  
)

[9] =\> stdClass Object  
(  
[name] =\> rooms  
[value] =\> 14  
)

)

)

[headers] =\> Array  
(  
[User-Agent] =\> SevenShores\_Hubspot\_PHP/1.0.0-rc.1 ([GitHub - HubSpot/hubspot-php: HubSpot PHP API Client · GitHub](https://github.com/ryanwinchester/hubspot-php))  
)

)

---

<div class="post-metadata">

**Author:** ![DaganRead](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/daganread/32/31851_2.png) [@DaganRead](https://community.hubspot.com/u/DaganRead)\
**Post date:** [September 19, 2019, 2:46pm UTC](https://community.hubspot.com/t/405-method-not-allowed/16293/4 "2019-09-19T14:46:20Z")

</div>

The issue was with the library.
