POST and PATCH - X-HTTP-Method-Override

Hello,

I have problems sending a PATCH request to the hubapi. I can send POST requests and X-HTTP-Method-Override=POST in header.

I always get

Error 405 Method Not Allowed

Any suggestion to this?

Thanks a lot

Michael

Hey, @MGlöckner. Welcome to the community. It’s tough to say without more information. Can you share a simple request, response, and error body, please?

Thanks! — Jaycee

Hello, here is the code send by our integration software, when I use PATCH:

POST /crm/v3/objects/companies/xxxxxxxxx HTTP/1.1

Host: api.hubapi.com

Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2

Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxx

Connection: keep-alive

Content-Length: 48

Content-Type: application/json; charset=UTF-8

User-Agent: Java/17.0.10

X-Http-Method: PATCH

X-Http-Method-Override: PATCH

{"properties":{"sap_geschaeftspartner":"12345"}}

As you can see, it is no standard PATCH. It is a POST request with some override instructions i the header.

I think it is a bug in the software I use for integration, but I cannot change it. The question is, is there any possibility to PATCH objects in Hubspot using POST request.

(the problem ist not the body - this is accepted fine, when I send a PATCH request from Postman)

Hi @MGlöckner

It looks like you are trying to update a company property and you are not able to do that. doc link -

here is a curl of API to update the company property -

curl --request PATCH \
 --url https://api.hubapi.com/crm/v3/objects/companies/companyId \
 --header 'authorization: Bearer YOUR_ACCESS_TOKEN' \
 --header 'content-type: application/json' \
 --data '{
 "objectWriteTraceId": "string",
 "properties": {
 "property_date": "1572480000000",
 "property_radio": "option_1",
 "property_number": "17",
 "property_string": "value",
 "property_checkbox": "false",
 "property_dropdown": "choice_b",
 "property_multiple_checkboxes": "chocolate;strawberry"
 }
}'

I hope this will help you out. Please mark it as Solution Accepted and upvote to help another Community member.
Thanks!

Hello, please read carefully what i wrote. I cannot send PATCH requests, only POST.

Finally i solved it with a batch request. A batch request is POST (not PATCH):

curl --location ‘https://api.hubapi.com/crm/v3/objects/companies/batch/update’ \

--header ‘Content-Type: application/json’ \

--header ‘Authorization: ••••••’ \

--data '{

"inputs":\[

    {

        "id":"1700029xxxxx",

        "properties":

        {

            "sap\_geschaeftspartner": "654321123456"

        }

    }

]

}’

Thanks to the Huspot Support Team!