APIs & Integrations

udayapitchika
Member

Getting 204 No Content response in /sync-messages API

Hello HubSpot team,
I have the following questions/comments on ECommerce Bridge API document

  1. In the settings API, PUT & GET are not symmetric. To the list of field mappings that we define, there is a default property getting always appended
    {
    "propertyName": "ecomm_synced",
    "dataType": "STRING",
    "targetHubspotProperty": "ip__ecomm_bridge__ecomm_synced"
    }
    If we try to PUT the field mappings that we received in GET request (with the above additional property), we are getting an error as below
    "message": "PRODUCT settings [PropertyRequest{propertyName=my_name_field, dataType=STRING, targetHubspotProperty=name}, PropertyRequest{propertyName=image, dataType=STRING, targetHubspotProperty=ip__ecomm_bridge__product_image}, PropertyRequest{propertyName=ecomm_synced, dataType=STRING, targetHubspotProperty=ip__ecomm_bridge__ecomm_synced}] must not define provided PropertyName's [ecomm_synced]"

The request is getting successful, if we remove the property. Please update the API document in the next revision.

  1. Here's our product sync settings that we used in /settings endpoint
    "productSyncSettings": {
    "properties": [
    {
    "propertyName": "image",
    "dataType": "STRING",
    "targetHubspotProperty": "ip__ecomm_bridge__product_image"
    },
    {
    "propertyName": "my_name_field",
    "dataType": "STRING",
    "targetHubspotProperty": "name"
    },
    {
    "propertyName": "ecomm_synced",
    "dataType": "STRING",
    "targetHubspotProperty": "ip__ecomm_bridge__ecomm_synced"
    }
    ]
    }

We are trying to send this body using Sync Messages API to product end point and getting a "204 no content" response. Could you please check this issue and let us know if we are missing out anything?

https://api.hubapi.com/extensions/ecomm/v1/sync-messages/product
PUT /extensions/ecomm/v1/sync-messages/product HTTP/1.1
Host: api.hubapi.com
Content-Type: application/json
Authorization: Bearer CJb4gbmfLBICf48Yr9L3ASCj2TgovsMDMhkAxZ9z7Vi5z2qo4vd5B4k_24DBUIf-Hsdx
Cache-Control: no-cache
Postman-Token: b71f1d16-3578-4178-9e1e-9c857f3d2158

[
{
"integratorObjectId": "3354",
"action": "UPSERT",
"propertyNameToValues": {
"image": "https://cdn.shopify.com/s/files/1/2344/1163/products/85cc58608bf138a50036bcfe86a3a362_grande.jpg",
"my_name_field": "Example Product"
},
"changeOccurredTimestamp":"1520252260"
}
]

  1. Under required properties section, only these properties are available. Is this the complete list of required properties?
    Required Contact Properties:
    email – Only contacts with valid email addresses will be created.
    Required Line Item Properties:
    hs_assoc__deal_id - Only line items associated to a deal will be created.
    hs_assoc__product_id - Only line items associated to a product will be created.

  2. Is it possible to display product images in HubSpot using the bridge API?

0 Upvotes
3 Replies 3
udayapitchika
Member

Getting 204 No Content response in /sync-messages API

Thank you @Llewellyn_Smith for responding . I will go through these points and let you know if I have any other questions.
Do you know by when will the updated API document be published ?

0 Upvotes
lsmith
HubSpot Product Team
HubSpot Product Team

Getting 204 No Content response in /sync-messages API

I will include updates in a new document on Monday.

lsmith
HubSpot Product Team
HubSpot Product Team

Getting 204 No Content response in /sync-messages API

Hi udayapitchika,

Thanks for getting involved with the API. In response to your questions/comments:

  1. Thanks for pointing out the asymmetry. We will work on changing that behavior so that by default HubSpot defined property mappings are not returned by the GET /settings endpoint. We will also update the documentation to specify this, and an optional query parameter that can be used to retrieve all property mappings (including those provided by HubSpot).

  2. For the /sync-messages/{objectType} endpoints, all successful PUTs will result in a 204 response code. We do not return anything from these endpoints, but if you receive a 204 your data will have been processed.

  3. That list is incomplete, there is also a required Deal property: "dealstage". We will update the documentation to reflect the full list.

  4. Syncing product images is possible. There is actually an additional property mapping dataType AVATAR_IMAGE, and we expect the value of a property of that type to be an image url. The image will automatically be downloaded and displayed in HubSpot as well as for use in email, etc. By default, ecommerce portals will have the product property "ip__ecomm_bridge__image_url" for this purpose.
    For example, if your productSyncSettings includes:

{
  "propertyName": "image",
  "dataType": "AVATAR_IMAGE",
  "targetHubspotProperty": "ip__ecomm_bridge__image_url"
}

Then updates to the "image" property will change the product image displayed in HubSpot.

Please let me know if you would like any additional clarification!

0 Upvotes