Upsert Opportunity
http
POST https://services.leadconnectorhq.com/opportunities/upsertAuthorization
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
Authorization | string | Yes | Bearer token generated from the Leadway portal. See Authentication. | |
Version | string | Yes | 2021-07-28 | API version. |
Body
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
id | string | No | yWQobCRIhRguQtD2llvk | opportunityId |
pipelineId | string | Yes | bCkKGpDsyPP4peuKowkG | pipeline Id |
locationId | string | Yes | CLu7BaljjqrEjBGKTNNe | locationId |
followers | string[] | Yes | LiKJ2vnRg5ETM8Z19K7 | contactId |
isRemoveAllFollowers | boolean | Yes | True | isRemoveAllFollowers |
followersActionType | string | Yes | add | followers action type Possible values: 'add', 'remove' |
name | string | No | opportunity name | name |
status | string | No | Possible values: 'open', 'won', 'lost', 'abandoned', 'all' | |
pipelineStageId | string | No | 7915dedc-8f18-44d5-8bc3-77c04e994a10 | |
monetaryValue | object | No | 220 | |
assignedTo | string | No | 082goXVW3lIExEQPOnd3 | |
lostReasonId | string | No | CLu7BaljjqrEjBGKTNNe | lost reason Id |
Responses
200 - Successful response
opportunity(object, required): Updated / New Opportunitynew(boolean, required): Example:True
json
{
"opportunity": {},
"new": true
}400 - Bad Request
json
{}422 - Unprocessable Entity
json
{}Example
curl -X POST 'https://services.leadconnectorhq.com/opportunities/upsert' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Version: 2021-07-28' \
-H 'Content-Type: application/json' \
-d '{
"id": "yWQobCRIhRguQtD2llvk",
"pipelineId": "bCkKGpDsyPP4peuKowkG",
"locationId": "CLu7BaljjqrEjBGKTNNe",
"followers": "LiKJ2vnRg5ETM8Z19K7",
"isRemoveAllFollowers": true,
"followersActionType": "add",
"name": "opportunity name",
"status": "open",
"pipelineStageId": "7915dedc-8f18-44d5-8bc3-77c04e994a10",
"monetaryValue": 220,
"assignedTo": "082goXVW3lIExEQPOnd3",
"lostReasonId": "CLu7BaljjqrEjBGKTNNe"
}'const response = await fetch('https://services.leadconnectorhq.com/opportunities/upsert', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
Version: '2021-07-28',
'Content-Type': 'application/json',
},
body: JSON.stringify({"id": "yWQobCRIhRguQtD2llvk", "pipelineId": "bCkKGpDsyPP4peuKowkG", "locationId": "CLu7BaljjqrEjBGKTNNe", "followers": "LiKJ2vnRg5ETM8Z19K7", "isRemoveAllFollowers": true, "followersActionType": "add", "name": "opportunity name", "status": "open", "pipelineStageId": "7915dedc-8f18-44d5-8bc3-77c04e994a10", "monetaryValue": 220, "assignedTo": "082goXVW3lIExEQPOnd3", "lostReasonId": "CLu7BaljjqrEjBGKTNNe"}),
});
const data = await response.json();import os, requests
response = requests.request(
'POST',
'https://services.leadconnectorhq.com/opportunities/upsert',
headers={
'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
'Version': '2021-07-28',
'Content-Type': 'application/json',
},
json={"id": "yWQobCRIhRguQtD2llvk", "pipelineId": "bCkKGpDsyPP4peuKowkG", "locationId": "CLu7BaljjqrEjBGKTNNe", "followers": "LiKJ2vnRg5ETM8Z19K7", "isRemoveAllFollowers": true, "followersActionType": "add", "name": "opportunity name", "status": "open", "pipelineStageId": "7915dedc-8f18-44d5-8bc3-77c04e994a10", "monetaryValue": 220, "assignedTo": "082goXVW3lIExEQPOnd3", "lostReasonId": "CLu7BaljjqrEjBGKTNNe"},
)
data = response.json()<?php
$ch = curl_init('https://services.leadconnectorhq.com/opportunities/upsert');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
'Version: 2021-07-28',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode({'id': 'yWQobCRIhRguQtD2llvk', 'pipelineId': 'bCkKGpDsyPP4peuKowkG', 'locationId': 'CLu7BaljjqrEjBGKTNNe', 'followers': 'LiKJ2vnRg5ETM8Z19K7', 'isRemoveAllFollowers': true, 'followersActionType': 'add', 'name': 'opportunity name', 'status': 'open', 'pipelineStageId': '7915dedc-8f18-44d5-8bc3-77c04e994a10', 'monetaryValue': 220, 'assignedTo': '082goXVW3lIExEQPOnd3', 'lostReasonId': 'CLu7BaljjqrEjBGKTNNe'}),
]);
$data = json_decode(curl_exec($ch), true);