Update not working. . .

Hi everyone.

I just joined here, and thought I’d start with a stupid question.
Below is my code on a PHP page (to update an existing test record in Hubspot). I’m sure the “x” (below in x=" + myJSON) needs to be something else for Hubspot to properly read my POST, but I’m not finding it in the documentation. The API works, it finds the contact, and I get no errors, but the Contact doesn’t update.

My code:

var myJSON = {

“properties”: [
{
“property”: “firstname”,
“value”: “Datta54321”
}
]
}
window.location = “https://api.hubapi.com/contacts/v1/contact/email/dgroover@AOL.com/profile?hapikey=“.$API.”,x=” + myJSON”

I got that endpoint from this page:
https://legacydocs.hubspot.com/docs/methods/contacts/update_contact-by-email

Your thoughts?

Hey @DattaGroover,

Have you checked out the php resource available on the HubSpot GitHub, found here.

Also, it’s worth mentioning that our new v3 endpoints provide some sample php snippets that you can work with, take a look here.

I hope this helps!

Are you referring the JSON and Curl snippets at that 2nd link, Matthew?

Sorry, nevermind- I see the PHP tabs now.

The documentation for PHP in that page is not correct:

This is not a valid PHP array.

We have the same or similar issue. When doing the call in PHP, we get a 200 response with ‘complete’, but without the values that have been updated, checking HS shows the contacts are not updated. If we dump the request body and use that to send it to the api with Postman, the update does work, the response is also 200 ok, but the response body contains the updated values.

Any suggestions?