APIs & Integrations

DanielaSabau
Member

Create Line Item to a deal

SOLVE

I want to create a line item to a deal.

 

I tried this API: 

POST

/crm/v3/objects/line items

 

{
  "properties": {
    "price""149",
    "quantity""1",
    "name""ChiroSpring 360",
    "hs_product_id""product_id"
  },
  "associations": [
    {
      "to": {
        "id": "id of the deal"
      },
      "types": [
        {
          "associationCategory""HUBSPOT_DEFINED",
          "associationTypeId"20
        }
      ]
    }
  ]
}
 
I do not know what is wrong here. Any ideas?
 
Thanks!
0 Upvotes
1 Accepted solution
DanielaSabau
Solution
Member

Create Line Item to a deal

SOLVE

@EWood I manage to create the line item. There is a typo error in the API docs for creating a line item.

 

DanielaSabau_0-1679997318580.png

 

The POST is not written correctly. Instead of /crm/v3/objects/line items it should be /crm/v3/objects/line_item. 😛

 

View solution in original post

4 Replies 4
EWood
HubSpot Employee
HubSpot Employee

Create Line Item to a deal

SOLVE

Hi @DanielaSabau ,

 

Thanks for reaching out to the HubSpot Community! Happy to help here.


Are you able to provide the error response you're recieving? Also, I noticed you have placeholders for "product_id" and "id of the deal." You don't have to provide the IDs here but just confirming you have number values in those fields on your actual API request.

 

Thanks!

 

Elyse

 

 

0 Upvotes
DanielaSabau
Solution
Member

Create Line Item to a deal

SOLVE

@EWood I manage to create the line item. There is a typo error in the API docs for creating a line item.

 

DanielaSabau_0-1679997318580.png

 

The POST is not written correctly. Instead of /crm/v3/objects/line items it should be /crm/v3/objects/line_item. 😛

 

EWood
HubSpot Employee
HubSpot Employee

Create Line Item to a deal

SOLVE

@DanielaSabau, good catch! I can submit a request to update that API documentation. Glad you were able to resolve 😊

DanielaSabau
Member

Create Line Item to a deal

SOLVE

@EWood here is the response that I get:

 

{
    "status""error",
    "message""Unable to infer object type from: line items",
    "correlationId""58cc54f0-20f8-4e54-893d-5fa3c78c7ae3"
}
 
And yes, I can confirm that "product_id" and "id of the deal" have the actual id's for the product and deal.
 
Thanks!