Skip to main content

Hi, I have the same problem as 

, but that issue doesn’t have a resolution despite being marked as solved.

We do a lot of profile updates from our website to klaviyo to maintain custom data about user purchases, ie, what shoe size they bought. This lives in custom fields in profiles and all was well.

I recently updated this to use the new API endpoint /api/profiles/lPROFILEID], wrote a bunch of unit tests to check that, as the documentation states, I’m getting a 200 in the response. That happens so I thought I was done.

Today I added a new method to update just one custom field, ‘hs_bought_shoes_but_never_size_8_to_10’. The value is either 1 or 0.

There is dump (below the fold) of a successful call from the Klaviyo developer log, it shows that I got a 200 OK response, and the request and response body is there too.

It returns 200, but the response body does not contain the new property field, and when I check the profile manually it does not have the updated property value.

What am I doing wrong?

Many thanks,

Gareth

---- **** ----

Details

Close

Date:

Jul 17, 2024, 3:24 PM GMT+1

Call ID:

 

b8438a9c-be4e-477d-a285-7ae995401f0d

Copy

Status code:

 

200

Method:

PATCH

Request path:

 

/api/profiles/01G6QD19757JMKZ7PAD150SYMR

Copy

Source:

*674b69

Revision:

2024-05-15

User agent:

Unknown

Header:

Cf-Ray: 8a4ae575c6df76c0-LHR
Content-Length: 201
Content-Type: application/json
Cf-Ipcountry: GB
Cf-Ew-Via: 15
X-Real-Ip: <masked>
Revision: 2024-05-15
Cf-Connecting-Ip: 92.207.214.98
Cf-Visitor: {"scheme":"https"}
Host: a.klaviyo.com
Accept-Encoding: gzip
X-Forwarded-For: 92.207.214.98, <masked>
X-Klaviyo-Forwarded-Proto: https
Accept: application/json
Cf-Worker: klaviyo.com
Authorization: Klaviyo-API-Key 674b69
X-Forwarded-Port: 80
Cdn-Loop: cloudflare; subreqs=1
X-Forwarded-Proto: http

The request body is:

{
  "data": {
    "type": "profile",
    "id": "01G6QD19757JMKZ7PAD150SYMR",
    "attributes": {
      "email": "gArethDart24@HOtmail.cOm"
    },
    "properties": {
      "hs_bought_shoes_but_never_size_8_to_10": 1,
      "updated": "2024-07-17 15:24:33"
    }
  }
}

The response body is:

{
  "data": {
    "type": "profile",
    "id": "01G6QD19757JMKZ7PAD150SYMR",
    "attributes": {
      "email": "garethdart24@hotmail.com",
      "phone_number": null,
      "external_id": null,
      "anonymous_id": null,
      "first_name": "Gareth",
      "last_name": "Dart",
      "organization": null,
      "locale": null,
      "title": "Mr",
      "image": null,
      "created": "2022-06-29T09:35:18+00:00",
      "updated": "2024-07-17T14:20:41+00:00",
      "last_event_date": "2024-07-17T14:20:41+00:00",
      "location": {
        "country": null,
        "address1": null,
        "city": "London",
        "region": null,
        "longitude": null,
        "latitude": null,
        "address2": null,
        "zip": "WC1N3LJ",
        "timezone": null,
        "ip": null
      },
      "properties": {
        "active": "1",
        "updated": "2022-03-17 14:20:11",
        "$consent": }
          "email"
        ],
        "$consent_timestamp": "2024-07-17T14:20:31.891Z",
        "hs_cust_id": 91642,
        "hs_contact_type": "ml",
        "hs_subscribed_date": "2024-01-01 00:00:00",
        "hs_no_of_orders": "1",
        "hs_order_total_gbp": "1",
        "hs_last_ordered_datetime": "2024-01-01 00:00:00",
        "hs_marked_as_fraud": "0",
        "hs_date_of_last_return": "2024-01-01 00:00:00",
        "hs_returned_product_ids": "-1",
        "hs_last_shoe_size_bought": "8.5",
        "hs_last_non_shoe_size_bought": "M",
        "orphan": "0",
        "is_uk": true,
        "is_row": false,
        " is_ml": true,
        "$source": "profile-subscription-bulk-create-job call on site",
        "hs_bought_shoes_but_never_size_8_to_10": 0
      }
    },
    "relationships": {
      "lists": {
        "links": {
          "self": "https://a.klaviyo.com/api/profiles/01G6QD19757JMKZ7PAD150SYMR/relationships/lists/",
          "related": "https://a.klaviyo.com/api/profiles/01G6QD19757JMKZ7PAD150SYMR/lists/"
        }
      },
      "segments": {
        "links": {
          "self": "https://a.klaviyo.com/api/profiles/01G6QD19757JMKZ7PAD150SYMR/relationships/segments/",
          "related": "https://a.klaviyo.com/api/profiles/01G6QD19757JMKZ7PAD150SYMR/segments/"
        }
      },
      "conversation": {
        "links": {
          "self": "https://a.klaviyo.com/api/profiles/01G6QD19757JMKZ7PAD150SYMR/relationships/conversation/",
          "related": "https://a.klaviyo.com/api/profiles/01G6QD19757JMKZ7PAD150SYMR/conversation/"
        }
      }
    },
    "links": {
      "self": "https://a.klaviyo.com/api/profiles/01G6QD19757JMKZ7PAD150SYMR/"
    }
  }
}

Hello @dartacus 

 

There is an issue with the payload. The properties should be inside attributes object.

Try this payload:

 {
    "type": "profile",
    "id": "01G6QD19757JMKZ7PAD150SYMR",
    "attributes": {
      "email": "gArethDart24@HOtmail.cOm",
      "properties": {
        "hs_bought_shoes_but_never_size_8_to_10": "1"
      }
    }
  }

 

 


@Maxbuzz THANK YOU! I just could not see that in the documentation (eyes too old I suppose), and since the response didn’t flag a formatting error of any kind (other API calls have flagged similar errors) I didn’t think to double check that.

It’d be nice if a 200 OK response actually meant it was all...OK.

Lesson learned I suppose. Thank you again.


Reply