Opportunity

An opportunity record exposes an opportunity to REST web services. This record is not a subrecord. This record has one subrecord: record ID item.

The REST API Browser includes information about the field names and field types of the opportunity record. It also includes information about the HTTP methods, request parameters, and operations available to this record. For details, see the REST API Browser’s opportunity reference page.

For information about using the REST API Browser, see The REST API Browser.

Record ID

The record ID for an opportunity REST record is opportunity.

Limitations

When updating an existing Opportunity record through REST, do not include the “line” element when adding an item line.

Incorrect

              "item": { "items": [{ "item": { "id": 5 }, "line": 1, "quantity": 2.0, "rate": 12.78 }]
} 

            

Correct

              "item": { "items": [{ "item": { "id": 5 }, "quantity": 2.0, "rate": 12.78 }]
} 

            

Code Samples

These samples show typical use cases for opportunity. The sample ID is 132.

Creating an Opportunity Using a POST Request

              https://0000071.suitetalk.api.snap.netsuite.com/services/rest/record/v1/opportunity
{ "altSalesRangeHigh": 0.0, "altSalesRangeLow": 0.0, "altSalesTotal": 0, "canHaveStackable": false, "competitors": { "items": [ { "competitor": { "id": "1" } } ] }, "currency": { "id": "1" }, "entity": { "id": "110" }, "entityStatus": { "id": "17" }, "exchangeRate": 1.0, "expectedCloseDate": "2023-07-13", "forecastType": { "id": "2" }, "isBudgetApproved": false, "item": { "items": [ { "fromJob": false, "isEstimate": false, "item": { "id": "98" }, "marginal": false, "printItems": false, "quantity": 4.0, "rate": 39.95 }, { "fromJob": false, "isEstimate": false, "item": { "id": "5" }, "marginal": false, "printItems": false, "rate": 954.21 } ] }, "leadSource": { "id": "-2" }, "prevDate": "2023-07-13", "probability": 10.0, "projAltSalesAmt": 0.0, "projectedTotal": 100.0, "rangeHigh": 100.0, "rangeLow": 100.0, "salesTeam": { "items": [ { "contribution": 100.00, "employee": { "id": "40" }, "isPrimary": false, "salesRole": { "id": "-2" } }, { "contribution": 100.00, "employee": { "id": "134" }, "isPrimary": true, "salesRole": { "id": "3" } } ] }, "shipIsResidential": false, "shipOverride": false, "subsidiary": {"id": "1" }, "tranDate": "2023-07-13", "weightedTotal": 10.0
} 

            

Retrieving an Opportunity Using a GET Request

              GET https://0000071.suitetalk.api.snap.netsuite.com/services/rest/record/v1/opportunity/132 

            

Updating an Opportunity Using a PATCH Request

              https://0000071.suitetalk.api.snap.netsuite.com/services/rest/record/v1/opportunity/132
{ "altSalesRangeHigh": 0.0, "altSalesRangeLow": 0.0, "altSalesTotal": 0, "canHaveStackable": false, "competitors": { "items": [ { "competitor": { "id": "1" } } ] }, "currency": { "id": "1" }, "entity": { "id": "110" }, "entityStatus": { "id": "17" }, "exchangeRate": 1.0, "expectedCloseDate": "2023-07-13", "forecastType": { "id": "2" }, "isBudgetApproved": false, "item": { "items": [ { "description": "Ergonomic Keyboard", "fromJob": false, "isEstimate": false, "item": { "id": "98" }, "line": 1, "marginal": false, "printItems": false, "quantity": 4.0, "rate": 39.95 }, { "description": "NonInvItem", "fromJob": false, "isEstimate": false, "item": { "id": "5" }, "marginal": false, "printItems": false, "rate": 954.21 } ] }, "leadSource": { "id": "-2" }, "prevDate": "2023-07-13", "probability": 10.0, "projAltSalesAmt": 0.0, "projectedTotal": 100.0, "rangeHigh": 100.0, "rangeLow": 100.0, "salesTeam": { "items": [ { "contribution": 100.00, "employee": { "id": "40" }, "isPrimary": false, "salesRole": { "id": "-2" } }, { "contribution": 100.00, "employee": { "id": "134" }, "isPrimary": true, "salesRole": { "id": "3" } } ] }, "shipIsResidential": false, "shipOverride": false, "subsidiary": {"id": "1" }, "tranDate": "2023-07-13", "weightedTotal": 10.0
} 

            

Deleting an Opportunity Using a DELETE Request

              DELETE https://0000071.suitetalk.api.snap.netsuite.com/services/rest/record/v1/opportunity/132 

            

Related Topics

REST Web Services Supported Records
SuiteTalk REST Web Services Overview and Setup
Working with Records
NetSuite Record Structure
The REST API Browser

General Notices