POST quote "There was a problem with the request"

A “GET” request to

https://api.hubapi.com/crm/v3/objects/quotes

produces a response of all the quotes in the system.

A “POST” request to
https://api.hubapi.com/crm/v3/objects/quote/QUOTE_ID

consisting of this data to update the quotes status

{

*"properties": {*

    *"hs\_status": "APPROVAL\_NOT\_NEEDED"*

*}*

}

produces an error “Error 405 Method Not Allowed”
To create a new Quote with a POST request to
https://api.hubapi.com/crm/v3/objects/quote
which consists of this data.

{

"properties": {

    "hs\_title": "CRS Quote 5",

    "hs\_status": "APPROVAL\_NOT\_NEEDED",

     "hs\_expiration\_date": "2023-09-13"

}

}

produces this error

“status”: “error”,

“message”: “There was a problem with the request.”,

“correlationId”: “1c085753-ffaf-4171-bc34-f237f7ee1bdb”

There are no descriptive error logs or detail which assists me with a diagnosis. The detail in the error is very limited and doesnt help me determine an appropriate fix

Hi @csuch :waving_hand:

I’ve managed to successfully create a Quote via API. In order to do so, I had to read in-between the lines (a lot!). I completely agree that the documentation is lacking and some of the API error responses are not helpful.

Relating to your Update Quote request, you’ll need to use request method “PATCH”, not “POST”. That should explain the 405 error message for that case.

Finally, here’s an example Create Quote request that might help you take a further step forward:

{
 "properties": {
 "hs_title": "CRS Quote 5",
 "hs_status": "APPROVAL_NOT_NEEDED",
 "hs_expiration_date": "2023-09-13"
 },
 "associations": [
 {
 "to": {
 "id": deal_id
 },
 "types": [
 {
 "associationCategory": "HUBSPOT_DEFINED",
 "associationTypeId": 64
 }
 ]
 },
 {
 "to": {
 "id": line_item_id
 },
 "types": [
 {
 "associationCategory": "HUBSPOT_DEFINED",
 "associationTypeId": 67
 }
 ]
 },
 {
 "to": {
 "id": quote_template_id
 },
 "types": [
 {
 "associationCategory": "HUBSPOT_DEFINED",
 "associationTypeId": 286
 }
 ]
 }
 ]
}

Note, you’ll need to replace deal_id, line_item_id and quote_template_id with IDs relevant to your case.

Based on my testing, all 3 of the following association types are required when creating a Quote via API:

  • Quote to Deal
    • name: quote_to_deal
    • associationTypeId: 64
    • associationCategory: HUBSPOT_DEFINED
  • Quote to Line Item
    • name: quote_to_line_item
    • associationTypeId: 67
    • associationCategory: HUBSPOT_DEFINED
  • Quote to Quote Template
    • name: quote_to_quote_template
    • associationTypeId: 286
    • associationCategory: HUBSPOT_DEFINED

To find the relevant quote_template_id, you’ll want to replicate this request:

I hope this proves useful. Please let me know if you have any follow-up questions.

oh, so would you create the line_items before hand, then use the line_item_ids when creating the quote to associated the line items with your new quote?
I was adding line_items afterwards, which didnt seem to link to the quote

Hi @csuch :waving_hand:

Yes, that’s right. You’ll need to create your line items beforehand, then associate them to the Quote when you create it using their ID(s).

Good luck :slightly_smiling_face:

ah ok, I see.
The docs are somewhat sketchy arent they, its not very clear.
I will take your advice and try that.
Thank you very much, appreciate your assistance :+1: