Update product information associated to a transaction

Hello everyone
I am using Hubspot APIs to intergrate it with our internal ERP and I am facing an issue related to product updates. Let me explain
I have a transaction (for instance with id 28730033375)
Using the API
GET https://api.hubapi.com/crm/v4/objects/deals/28730033375/associations/line_items
I am able to get all the line_items associated to my transcation with their respective IDs.
For instance in the result there is

“toObjectId”: 63544129754,

Then, using
GET https://api.hubapi.com/crm/v4/objects/line_items/63544129754?properties=name, description, quantity, price, amount, hs_product_id, lp_id_presta
I have the result like below

{

“id”: “63544129754”,

“properties”: {

“amount”: “5.00”,

“createdate”: “2024-12-20T12:52:46.978Z”,

“description”: “Suivi - CEE”,

“hs_lastmodifieddate”: “2025-01-17T16:13:20.783Z”,

“hs_object_id”: “63544129754”,

“hs_product_id”: “2449969114”,

“lp_id_presta”: “”,

“name”: “CEE IND-UT-137”,

“price”: “1”,

“quantity”: “5”

},

“createdAt”: “2024-12-20T12:52:46.978Z”,

“updatedAt”: “2025-01-17T16:13:20.783Z”,

“archived”: false

}
The point is. The value in “lp_id_presta” which is a custom field of number form, is generated by our ERP and it must flow up to Hupspot.
I tried

PUT https://api.hubapi.com/crm/v4/objects/deals/28730033375/associations/line_items/63544129754
With a body like

{

“properties”: {

“lp_id_presta”: 6

}

}
But I get error 400 Bad Request

“message”: “Invalid input JSON on line 1, column 1: Cannot deserialize value of type `java.util.HashSet<com.hubspot.inbounddb.associations.base.AssociationSpec>` from Object value (token `JsonToken.START_OBJECT`)”,

Can you help me find the correct API and usage of it to update this field (or any other … who knows)?
Thanks in advance.

Hey, @PBREC :waving_hand: Welcome to the community! We’re so glad to have you here. Great question. You’ll need to make a PATCH request to the Line Items endpoint to update the value for this specific line item.

I made a quick example with Postman using the Properties API and the Line Item API:

  • I created a custom Line Item property to match yours
    POST https://api.hubapi.com/crm/v3/properties/line_item​

    {
     "groupName": "lineiteminfo",
     "name": "lp_id_presta",
     "label": "lp_id_presta",
     "type": "string",
     "fieldType": "text"
    }
    
  • Created a Line Item but left the value for `lp_id_presta` null
    POST https://api.hubapi.com/crm/v3/objects/line_items​

    {
     "properties": {
     "name": "presta",
     "hs_product_id": "some_id",
     "hs_recurring_billing_period": "P24M",
     "recurringbillingfrequency": "monthly",
     "quantity": "2",
     "price": "6000.00",
     "lp_id_presta": ""
     }
    }
    
  • Made a PATCH request to the Line Items API
    PATCH https://api.hubapi.com/crm/v3/objects/line_items/28117329942​

    {
     "properties": {
     "lp_id_presta": "0123456789abc"
     }
    }
    
  • Verified the specific Line Item was updated
    GET https://api.hubapi.com/crm/v3/objects/line_items/28117329942?properties=lp_id_presta​

    {
     "id": "28117329942",
     "properties": {
     "createdate": "2025-01-21T21:01:54.367Z",
     "hs_lastmodifieddate": "2025-01-21T21:08:22.397Z",
     "hs_object_id": "28117329942",
     "lp_id_presta": "0123456789abc"
     },
     "createdAt": "2025-01-21T21:01:54.367Z",
     "updatedAt": "2025-01-21T21:08:22.397Z",
     "archived": false
    }
    

I hope that helps get you moving forward! — Jaycee

Fantastic, this is what I was missing.
I tried the PATCH query as you proposed and it works perfect.
Thanks a lot

You are very welcome! — Jaycee