APIs & Integrations

j_j
Member

Ecommerce Bridge LINE ITEMS - can I create one JSON payload for all items?

Hi,

 

Can someone please tell me if I can create one JSON payload for multiple LINE ITEMS, for example like this:

 

{
  "storeId": "ecommercebridge-test-store",
  "objectType": "LINE_ITEM",
  "messages": [
    {
      "action": "UPSERT",
      "changedAt": "1542092841947",
      "externalObjectId": "100",
      "properties": {
        "price": "100",
        "num_items": "1",
        "tax_amount": "7"
      },
      "associations": {
        "DEAL": [
          "1000"
        ],
        "PRODUCT": [
          "orange_widget"
        ]
      }
    }
  ]
},
{
  "storeId": "ecommercebridge-test-store",
  "objectType": "LINE_ITEM",
  "messages": [
    {
      "action": "UPSERT",
      "changedAt": "1542092841947",
      "externalObjectId": "101",
      "properties": {
        "price": "100",
        "num_items": "1",
        "tax_amount": "7"
      },
      "associations": {
        "DEAL": [
          "1000"
        ],
        "PRODUCT": [
          "orange_widget"
        ]
      }
    }
  ]
},
{
  "storeId": "ecommercebridge-test-store",
  "objectType": "LINE_ITEM",
  "messages": [
    {
      "action": "UPSERT",
      "changedAt": "1542092841947",
      "externalObjectId": "102",
      "properties": {
        "price": "100",
        "num_items": "1",
        "tax_amount": "7"
      },
      "associations": {
        "DEAL": [
          "1000"
        ],
        "PRODUCT": [
          "orange_widget"
        ]
      }
    }
  ]
}
0 Upvotes
4 Replies 4
WendyGoh
HubSpot Employee
HubSpot Employee

Ecommerce Bridge LINE ITEMS - can I create one JSON payload for all items?

Hey @j_j,

 

Currently, one ecommerce sync message PUT request can only send a group of sync messages for a specific object type.

 

It is not possible to create multiple line items using the Send ecommerce sync messages endpoint.

0 Upvotes
j_j
Member

Ecommerce Bridge LINE ITEMS - can I create one JSON payload for all items?

Wendy, did this ever change. Can we send multiple object types in one JSON payload? It would save us making 4 API requests for PRODUCT, DEAL, CONTACT and LINE_ITEM. Please can you let me know thanks.

0 Upvotes
j_j
Member

Ecommerce Bridge LINE ITEMS - can I create one JSON payload for all items?

Thanks for the reply.

 

What about with the eCommerce Bridge API? We moved to that API as it is far superior to get data in to HubSpot from an existing (bespoke) ecommerce store. 

 

We do it like this with eCommerce Bridge:

 

{
"storeId": "Some Store",
"objectType": "LINE_ITEM",
"messages": [
{
"action": "UPSERT",
"changedAt": "1586432203000",
"externalObjectId": "15213434941",
"properties": {
"line_name": "Product 1",
"line_sku": "FZET27",
"line_price": "2395.00",
"line_tax": "399.17",
"line_quantity": "1"
},
"associations": {
"DEAL": [
"128633"
],
"PRODUCT": [
"FZET27"
]
}
},
{
"action": "UPSERT",
"changedAt": "1586432203000",
"externalObjectId": "153423421948",
"properties": {
"line_name": "Product 2",
"line_sku": "VLC75",
"line_price": "90.00",
"line_tax": "15",
"line_quantity": "1"
},
"associations": {
"DEAL": [
"128633"
],
"PRODUCT": [
"VLC75"
]
}
}
]
}

 

I take it that is valid? The documentation says we can send up to 200 objects of the same type with the eCommerce Bridge.

0 Upvotes
WendyGoh
HubSpot Employee
HubSpot Employee

Ecommerce Bridge LINE ITEMS - can I create one JSON payload for all items?

Hey @j_j,

 

Apologise for the confusion. The following code:

 

{
"storeId": "{{your store id}}",
"objectType": "LINE_ITEM",
"messages": [
{
"action": "UPSERT",
"changedAt": "1586432203000",
"externalObjectId": "lineitem_test1",
"properties": {
"price": "2395.00",
"num_items": "1"
},
"associations": {
"DEAL": [
"dealtest1"
],
"PRODUCT": [
"producttest1"
]
}
},
{
"action": "UPSERT",
"changedAt": "1586432203000",
"externalObjectId": "lineitem_test2",
"properties": {
"price": "2395.00",
"num_items": "1"
},
"associations": {
"DEAL": [
"dealtest2"
],
"PRODUCT": [
"producttest2"
]
}
}
]
}

 

would work just fine! I've tested it on my end and I'm able to see that two line items were associated to deals with products accordingly. 

0 Upvotes