Opportunity: Create or Update

  • Updated

Create or Update Opportunity

 

 


POST /v2/opportunity/save

This API creates an opportunity with a unique opportunity number and its associated details. This same API allows you to update an existing opportunity e.g. change the status or the event type of an opportunity.


Parameter
OpportunityNumber    String

The unique number of an Opportunity. Required when an opportunity is to be updated. If empty, a new opportunity will be created.

OpportunityName    String

The name of the opportunity.

Probability    String

The probability of an opportunity.

DealValue    String

The deal value of an opportunity.

OpportunityStartDate    DateTime

The start date and time of an opportunity.

OpportunityEndDate    DateTime

The end date and time of an opportunity.

ExpectedCloseDate    DateTime

The expected close date and time of an opportunity.

Pax    Long

The number of persons (PAX) which will be attending or present at the opportunity.

EventType    Object { Id, Name }

The type of event that is available in your Priava account. The event type must exist in your Priava Account. Passed in JSON format where:
Id = the ID of the event type.
Name = the name of the event type.

OpportunityStatus    Object { Id, Name }

The status of an Opportunity that is available in your Priava account. The opportunity status must exist in your Priava Account. Passed in JSON format where:
Id = the ID of the opportunity status.
Name = the name of the opportunity status.

Owner    Object { Id, Name }

The owner of an opportunity that is available in your Priava account. The owner must exist in your Priava Account. Passed in JSON format where:
Id = the ID of the owner.
Name = the name of the owner.

IdentifiedBy    Object { Id, Name }

The identifier of an opportunity that is available in your Priava account. The identifier must exist in your Priava Account. Passed in JSON format where:
Id = the ID of the identifier.
Name = the name of the identifier.

OpportunitySource    Object { Id, Name }

The opportunity source for an opportunity as available in your Priava account. The opportunity source must exist in your Priava Account. Passed in JSON format where:
Id = the ID of the opportunity source.
Name = the name of the opportunity source.

OpportunityContact    Object

The primary contact which is to be associated with the opportunity in JSON format.

OpportunityComment    Object { CommentType , Comment}
CommentType    Object { Id, Name }

The type of comment being added. This comment type must exist in your Priava account. Passed in JSON format where:
Id = the ID of the comment type.
Name = the name of the comment type.

Comment    String

The comment to be added to the Opportunity.

CustomFields Object

The custom fields for an Opportunity.

Venues    Object { Id, StartDate, EndDate}

The venue to be added in an opportunity. The venue must exist in your Priava Account. Passed in JSON format where:
Id = the ID of the venue.
StartDate = Start date for a venue. EndDate = End date for a venue.

OpportunityContact    Object
All opportunity contacts should be formatted as below:
ContactType    Object { Id, Name }

The type of contact that is being added. This contact type must exist in your Priava account. Passed in JSON format where:
Id = the ID of the contact type.
Name = the name of the contact type.

ContactId (optional)    Long

The ID of the Contact to be added. Contacts – Get API can be used to fetch contacts. Note: If the ContactId is provided, the contact details provided will be ignored.

Firstname    String

The contact’s first name. 

Lastname    String

The contact’s last name. 

Email    String

The contact's primary email address. 

Phone   String

The contact's phone number. 

Mobile (optional)    String

The contact's mobile/cellular number.  

PrimaryPhone    String

Specifies the primary phone number for the contact. The only accepted values are:
P for the Phone number.
M for the Mobile/Cellular number. The primary phone by default is Phone.

Organisation (optional)    String

The name of the organisation the contact is associated with. The organisation must exist in your Priava Account.

Address (optional)    Object Array (0 to 3 addresses allowed)

The array of addresses (up to 3) for this contact. Passed in JSON format where
AddressType = either POSTAL, BUSINESS or OTHER.
AddressLine1 = Line 1 of the address.
AddressLine2 = Line 2 of the address.
AddressLine3 = Line 3 of the address.
Suburb = The Suburb for the address.
State = The State or County.
Postcode = The Postal or Zip code.
Country = The Country of the address.

{
   "OpportunityStartDate": "10/03/2019 09:00:00",
   "OpportunityEndDate": "10/03/2019 17:00:00",
   "OpportunityName": "John Birthday Party",
   "OpportunityNumber": "",
   "OpportunitySource": {
      "Id": 6
   },
   "OpportunityStatus": {
      "Id": 1
   },
   "EventType": {
      "Id": 174
   },
   "CustomFields": {
      "RegistrationNumber": "G-12676212"
   },
   "OpportunityContact": {
      "ContactType": {
         "Id": 28
      },
      "ContactId": "100500794",
      "Firstname": "Blk1DemoJ2",
      "Lastname": "Challenger",
      "Email": "blue@ymail.com",
      "EmailOther": "LaFerrari@gmail.com",
      "Phone": "02298765676",
      "Mobile": "0229866666",
      "PrimaryPhone": "P",
      "Organisation": "Brian",
      "Department": "IT",
      "DebtorNo": "",
      "PersonalInformationConsent": true,
      "Title": "Engg",
      "JobTitle": "SE",
      "ExternalRefNo": "",
      "MarketingOptOut": true,
      "Inactive": false,
      "Address": [{
            "AddressType": "BUSINESS",
            "AddressLine1": "BUSINESS Address 1",
            "AddressLine2": "BUSINESS Address 2",
            "AddressLine3": "BUSINESS Address 3",
            "Suburb": "Australian Capital",
            "State": "Queensland",
            "Postcode": "112098",
            "Country": "Australia",
            "IsPrimary": false
         },
         {
            "AddressType": "POSTAL",
            "AddressLine1": "POSTAL Address 1",
            "AddressLine2": "POSTAL Address 2",
            "AddressLine3": "POSTAL Address 3",
            "Suburb": "Australian Capital",
            "State": "Queensland",
            "Postcode": "112098",
            "Country": "Australia",
            "IsPrimary": false
         },
         {
            "AddressType": "OTHER",
            "AddressLine1": "OTHER Address 1",
            "AddressLine2": "OTHER Address 2",
            "AddressLine3": "OTHER Address 3",
            "Suburb": "Australian Capital",
            "State": "Queensland",
            "Postcode": "112098",
            "Country": "Australia",
            "IsPrimary": true
         }
      ]
   },
   "OpportunityComment": [{
         "CommentType": {
            "Id": 8
         },
         "Comment": "This is general comment"
      },
      {
         "CommentType": {
            "Id": 8
         },
         "Comment": "This is general comment2"
      }
   ],
   "Owner": {
      "Id": 242
   },
   "IdentifiedBy": {
      "Id": 242
   },
   "Pax": "20",
   "Probability": "20",
   "DealValue": "1000",
   "ExpectedCloseDate": "20/02/2019 20:00:00",
   "Venues": [
        {
            "Id": 3586,
            "StartDate": "01/01/2019 09:00",
            "EndDate": "02/01/2019 09:00"
        }
    ]
}
Response:
{
    "success": true,
"result": "562" }

Was this article helpful?

Have more questions? Submit a request