How do you create Opportunity Items & Quote Items via Rest API

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • KWCJR
    Junior Member
    • Jun 2025
    • 6

    #1

    How do you create Opportunity Items & Quote Items via Rest API

    Hey everyone,

    Please somebody help before I go postal on this...

    I have been wracking my brain on this for about two weeks now...Mabey someone here can shed some light for me because I am already bald enough & there is no documentation on actual /Endpoints that I can find anywhere other than the Generic Syntax structures ~

    My Setup:
    * Vultr Server Running Docker on Ubuntu 25.04 x64
    * EspoCRM v9.1.5 Running in Docker Container
    * Advanced pack v3.9.0 Installed & Active
    * Sales Pack v2.6.13 Installed & Active

    Workflow ( regardless if /api/v1/Opportunity OR /api/v1/Quote ( I have tried both - same outcome )
    * Create a POST request to /Opportunity OR /Quotethat includes the ItemList[] like so ( fig A )
    * the record gets created AND returns a 200 OK but silently ignores the Items. ( fig B & C )

    ( fig A )
    Click image for larger version

Name:	image.png
Views:	28
Size:	23.5 KB
ID:	118673

    ( fig B )
    Click image for larger version

Name:	image.png
Views:	16
Size:	50.7 KB
ID:	118674

    ( fig C )
    Click image for larger version

Name:	image.png
Views:	16
Size:	73.9 KB
ID:	118675
    The Espo Logs state that the unitPrice field is missing but it's clearly not...

    Click image for larger version

Name:	image.png
Views:	16
Size:	21.0 KB
ID:	118676
    And when trying to POST to the endpoint /OpportunityItem it forbids me & PUT & PATCH are not allowed...

    HOWEVER a GET request to /OpportunityItem will return a full list of Items that are attached to many Opps....

    What exactly am I missing here?!

    ​​
  • lazovic
    Super Moderator
    • Jan 2022
    • 1065

    #2
    Hi KWCJR,

    Please try to add the unitPriceCurrency field to every opportunity item and use the itemList field instead of the items one. Example:
    Code:
    {
      "name": "Test Opportunity",
      "amount": 300,
      "closeDate": "2025-06-19",
      "itemList": [
        {
          "name": "Test Item 1",
          "unitPrice": 100,
          "unitPriceCurrency": "USD"
        },
        {
          "name": "Test Item 2",
          "unitPrice": 200,
          "unitPriceCurrency": "USD"
        }
        ]
    }
    Last edited by lazovic; 06-12-2025, 01:22 PM.

    Comment

    • KWCJR
      Junior Member
      • Jun 2025
      • 6

      #3
      Hey lazovic,

      Not only did you getting back to me in less than 30 mins for a new community member, but this worked perfectly!

      Here is my output for the thread just in case anyone else comes across this caveat.

      Thank you so much!

      Click image for larger version

Name:	chrome_ACPIW2xIAt.png
Views:	31
Size:	157.4 KB
ID:	118679

      Comment

      Working...