Line Item Update

Hi all,

I’m currently trying to build an integration using NodeJS to update a Deal Line Item using the Line Item Id.

I’m attempting to make a PATCH request to the following endpoint:

/crm/v3/objects/line_items/{lineItemId}

I’m passing in the properties in the body of the request (Fetch) like the following:

{“price”: “25”,“quantity”: “3”,“name”: “Updated line item”}

After speaking to HubSpot support, they recommended the following for the properties:

{“objectWriteTraceId”: “randomString123”, “properties”: {“price”: “8888.00”}}

Neither of these options have worked and I’m receiving the following error:

‘Invalid input JSON on line 1, column 1: Cannot deserialize value of type `com.hubspot.inbounddb.publicobject.core.v2.SimplePublicObjectInput$Json` from Array value’

The Fetch request:

let endpoint = `https://api.hubapi.com/crm/v3/objects/line_items/123456`;

const options = {
method: “PATCH”,
headers: {
‘Authorization’: ‘Bearer IAM-A-TOKEN-123’,
‘Content-Type’: ‘application/json’
},
body: JSON.stringify({“objectWriteTraceId”: “123123123addhfdjfgj”, “properties”: {“price”: “8888.00”}})
};

If I add the JSON.stringify command to the properties, I then get a ‘resource not found’ error.

Any help would be greatly appreciated, thanks!


@ATJ3 wrote:

Hi all,

I’m currently trying to build an integration using NodeJS to update a Deal Line Item using the Line Item Id.

I’m attempting to make a PATCH request to the following endpoint:

/crm/v3/objects/line_items/{lineItemId}

I’m passing in the properties in the body of the request (Fetch) like the following:

{“price”: “25”,“quantity”: “3”,“name”: “Updated line item”}

After speaking to HubSpot support, they recommended the following for the properties:

{“objectWriteTraceId”: “randomString123”, “properties”: {“price”: “8888.00”}}

Neither of these options have worked and I’m receiving the following error:

‘Invalid input JSON on line 1, column 1: Cannot deserialize value of type `com.hubspot.inbounddb.publicobject.core.v2.SimplePublicObjectInput$Json` from Array value’

The Fetch request:

let endpoint = `https://api.hubapi.com/crm/v3/objects/line_items/123456`;

const options = {
method: “PATCH”,
headers: {
‘Authorization’: ‘Bearer IAM-A-TOKEN-123’,
‘Content-Type’: ‘application/json’
},
body: JSON.stringify({“objectWriteTraceId”: “123123123addhfdjfgj”, “properties”: {“price”: “8888.00”}})
};

If I add the JSON.stringify command to the properties, I then get a ‘resource not found’ error.

Any help would be greatly appreciated, thanks!


The body of the request should have a properties object containing the fields you want to update. You don’t need to stringify individual values inside the properties object. Ensure that the lineItemId you’re passing in the URL is valid and belongs to an existing line item in your HubSpot account.
Make sure your bearer token has sufficient permissions to update line items.

Here is an updated example using Node.js with the fetch API that should work based on HubSpot’s documentation:

Hello, just curious, did you/your teams try to explore apps available on the market to do same without codding or?

Best