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!
EWood
March 27, 2023, 3:49pm
2
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
@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!
@EWood I manage to create the line item. There is a typo error in the API docs for creating a line item.
The POST is not written correctly. Instead of /crm/v3/objects/line items it should be /crm/v3/objects/line_item .
EWood
March 28, 2023, 3:34pm
5
@DanielaSabau , good catch! I can submit a request to update that API documentation. Glad you were able to resolve