Create Opportunity
This tutorial should help you create the first Opportunity. Before moving forward, make sure your Authentication works and you understand the Key Concepts of the Pipeliner API and make sure you know how to use API parameters
The Opportunity represents existing potential business for a company. Go to the web Application and Opportunities can be located on the Opportunities screen. Opportunity is always part of the Pipeline and pipeline step.
The Pipeline is the list of steps (eg. First Contact, Proposal, Closed/Won), that represents the life cycle of the opportunity. Set up your first Pipeline

Tutorial Assignment

Create Opportunity in the Pipeline within the First Step of the Pipeline. This Opportunity will be Linked with an Account(Company) and multiple Contact that belongs to this Account.

0. Required fields

Required API field Name
Description
name
Name of the opportunity
owner_id
Id of the User in Pipeliner Application
closing_date
Expected Closing date. When the opportunity should be closed
step_id
ID of the Pipeline step where the Opportunity should be created
value
The business value of Opportunity, eg. dollar amount. base_value - The Real Business Value in dollars currency_id - The ID of currency saved in Pipeliner value_foreign - The value for currency_id (Use only with multicurrency setup)

1. Prepare Data

Owner_id

Load an id of the user with the default sales unit. This user will become the owner of the newly created Opportunity.
get
https://us-east.pipelinersales.com/api/v100/rest/spaces/<space_id>
/entities/Clients
1
{{baseUrl}}/entities/Clients?load-only=id,default_unit_id&filter[email][email protected]
Copied!
1
{
2
"id": "00000000-0000-0000-0000-000000011a7d",
3
"default_unit_id": "aba4a358-f3f8-4f55-b3ed-dd5cf589103b"
4
}
Copied!
We don´t necessarily need to load the default unit id. If only owner_id is specified in the final request, Pipeliner will automatically create the opportunity with the default User´s sales unit. (See step 2. of this tutorial)

Step_id

Pull Opportunity Pipelines and their steps. Store the ID of the First Step
get
https://us-east.pipelinersales.com/api/v100/rest/spaces/<space_id>
/entities/Pipelines
1
{{baseUrl}}/entities/Pipelines?expand=steps&filter-op[name]=contains&filter[name]=Test Pipeline
Copied!
1
{
2
"is_delete_protected": false,
3
"id": "90be8a83-bae8-401d-9e5e-c4564a986270",
4
"is_deleted": false,
5
"modified": "2020-09-25 10:48:29.825069+00:00",
6
"created": "2020-08-12 15:00:21.732550+00:00",
7
"color": 16233984,
8
"name": "Test Pipeline",
9
"revision": 66001,
10
"steps": [
11
{
12
"is_delete_protected": false,
13
"id": "de115511-5dc1-46c3-86d9-f714457208dd",
14
"is_deleted": false,
15
"modified": "2020-08-12 15:00:21.734413+00:00",
16
"created": "2020-08-12 15:00:21.734454+00:00",
17
"pipeline": "https://us-east.pipelinersales.com/api/v100/rest/spaces/nv3_PipelinerDev/entities/Pipelines/90be8a83-bae8-401d-9e5e-c4564a986270",
18
"name": "First",
19
"percent": 15,
20
"pipeline_id": "90be8a83-bae8-401d-9e5e-c4564a986270",
21
"sort_order": 0,
22
"timeframe": null,
23
"revision": 65654,
24
"documents": [],
25
"step_checklists": []
26
}
27
28
}
Copied!

Account_id

We are going to search for Accounts by email address. But you can use whatever parameter.
get
https://us-east.pipelinersales.com/api/v100/rest/spaces/<space_id>
/entities/Accounts/{id}
1
{{baseUrl}}/entities/Accounts?include-deleted=false&filter[email1][email protected]
Copied!
1
{
2
"is_delete_protected": false,
3
"id": "0bc376a4-c579-413a-9221-e86e4a134766",
4
"is_deleted": false,
5
"modified": "2019-02-01 10:01:23.011709+00:00",
6
"created": "2019-01-30 11:44:23.586083+00:00",
7
"account_type": "https://us-east.pipelinersales.com/api/v100/rest/spaces/nv3_PipelinerDev/entities/AccountTypes/a456236f-6f23-0908-abfd-384aa0f62f9e",
8
"customer_type": "https://us-east.pipelinersales.com/api/v100/rest/spaces/nv3_PipelinerDev/entities/Data/04444b3a-c669-03bc-2c49-bcd7f047d41a",
9
"industry": "https://us-east.pipelinersales.com/api/v100/rest/spaces/nv3_PipelinerDev/entities/Data/acbda72f-2054-0b71-9d42-cb35aaa37600",
10
"owner": "https://us-east.pipelinersales.com/api/v100/rest/spaces/nv3_PipelinerDev/entities/Clients/00000000-0000-0000-0000-000000011a3d",
11
"parent_account": null,
12
"parent_account_relation_type": null,
13
"picture": "https://us-east.pipelinersales.com/api/v100/rest/spaces/nv3_PipelinerDev/entities/CloudObjects/5ddfe953-a569-48e1-86bb-271e6506e7d0",
14
"unit": "https://us-east.pipelinersales.com/api/v100/rest/spaces/nv3_PipelinerDev/entities/SalesUnits/ea33e8fb-9a56-4802-a175-2d1f406af7cf",
15
"account_class": 5,
16
"account_type_id": "a456236f-6f23-0908-abfd-384aa0f62f9e",
17
"address": "7 Lillian Plaza",
18
"city": "Coronda",
19
"comments": "",
20
"country": "Argentina",
21
"customer_type_id": "04444b3a-c669-03bc-2c49-bcd7f047d41a",
22
"email1": "[email protected]",
23
"email2": "",
24
"email3": "",
25
"email4": "",
26
"email5": "",
27
"health_category": null,
28
"health_status": null,
29
"home_page": "www.ziemannandsons.com",
30
"industry_id": "acbda72f-2054-0b71-9d42-cb35aaa37600",
31
"name": "Ziemann and Sons",
32
"owner_id": "00000000-0000-0000-0000-000000011a3d",
33
"parent_account_id": null,
34
"parent_account_relation_type_id": null,
35
"phone1": "+1 (888) 500-8000",
36
"..."
37
}
Copied!

Contact_id

We are going to search for Contacts that are linked to the Account. We are going to use Account_id from the previous Step and list all contact_id that exists on the Account
get
https://us-east.pipelinersales.com/api/v100/rest/spaces/<space_id>
/entities/ContactAccountRelations
1
{{baseUrl}}/entities/ContactAccountRelations?filter[account_id]=0bc376a4-c579-413a-9221-e86e4a134766
Copied!
1
{
2
"is_delete_protected": false,
3
"id": "7bb50668-badb-4c4b-a184-2f2be3df4fd8",
4
"is_deleted": false,
5
"modified": "2019-01-30 11:54:15.289916+00:00",
6
"created": "2019-01-30 11:54:15.289965+00:00",
7
"account": "https://us-east.pipelinersales.com/api/v100/rest/spaces/nv3_PipelinerDev/entities/Accounts/0bc376a4-c579-413a-9221-e86e4a134766",
8
"contact": "https://us-east.pipelinersales.com/api/v100/rest/spaces/nv3_PipelinerDev/entities/Contacts/02bdc9f6-4dfb-479e-84ba-f6c3b96c39ba",
9
"account_id": "0bc376a4-c579-413a-9221-e86e4a134766",
10
"comment": "",
11
"contact_id": "02bdc9f6-4dfb-479e-84ba-f6c3b96c39ba",
12
"is_assistant": false,
13
"is_primary": true,
14
"is_sibling": false,
15
"position": "",
16
"relationship": 0,
17
"revision": 184,
18
"account_roles": []
19
}
Copied!

Value

  1. 1.
    Foreign value (required/optional) - This is the value that the User (SalesPerson) can put into the system. This value is depending on currency_id.
    1. 1.
      Example: if your salespeople want to have an Opportunity Value in Euro, for currency_id use Euro, into the Foreign value put the amount in Euro
  2. 2.
    currency_id (Required) - the currency for the opportunity (like dollar, euro, etc.). In Pipeliner there are two types of currencies
    1. 1.
      Base currency - System currency (the main currency)
    2. 2.
      Multiple currencies (custom currencies) - When your business works with multiple currencies
  3. 3.
    base_value (required/optional) - this value is always calculated according to the Base Currency
You can use one of the foreign values, base_value. It depends on what fits you better.
When you define base value, then Foreign Currency is calculated automatically based on Exchange rates
When you define Foreign Currency, then the base value is calculated automatically based on Exchange rates

Value.currency_id

In this tutorial, we don´t use a multi-currency setup, so we are going to search for the base currency (system currency). To retrieve base currency let´s use the following request. Base currency is flagged as is_base:true
get
https://us-east.pipelinersales.com/api/v100/rest/spaces/<space_id>
/entities/Currencies
1
{{baseUrl}}/entities/Currencies?filter[is_base]=true
Copied!
1
{
2
"is_delete_protected": true,
3
"id": "c4ca4238-a0b9-0382-0dcc-509a6f75849b",
4
"is_deleted": false,
5
"modified": "2019-01-30 11:20:40.481012+00:00",
6
"created": "2019-01-11 13:47:33.247720+00:00",
7
"code": "USD",
8
"is_base": true,
9
"symbol": "quot;,
10
"revision": 18,
11
"currency_exchange_rates": []
12
}
Copied!

2. Create Opportunity

Let´s Take data from Step 1. and use them in the following request to create an Opportunity.
post
https://us-east.pipelinersales.com/api/v100/rest/spaces/<space_id>
/entities/Opportunities
1
{
2
"closing_date": "2019-01-01",
3
"name": "New Opportunity",
4
"owner_id": "00000000-0000-0000-0000-000000011a7d",
5
"step_id": "de115511-5dc1-46c3-86d9-f714457208dd",
6
"value": {
7
"base_value": 100,
8
"currency_id": "c4ca4238-a0b9-0382-0dcc-509a6f75849b"
9
},
10
"account_relations": [
11
{
12
"account_id": "0bc376a4-c579-413a-9221-e86e4a134766",
13
"is_primary": true
14
15
}
16
],
17
"contact_relations": [
18
{
19
"contact_id": "02bdc9f6-4dfb-479e-84ba-f6c3b96c39ba",
20
"is_primary":true
21
}
22
]
23
}
Copied!
Opportunity inside the Pipeliner Application
Possible problems
Error description
Resolution
Error on field account_relations. Exactly one 'is_primary' item must be set.
Use is_primary flag for Account/Contact relation object.
-When creating account relations at least one Account needs to be primary -When creating contact relations at least one Contact needs to be primary