curl --request POST \
--url https://api.affinity.co/v2/opportunities/{opportunityId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Horizon Technologies Upsell $10k",
"isRestricted": true
}
'import requests
url = "https://api.affinity.co/v2/opportunities/{opportunityId}"
payload = {
"name": "Horizon Technologies Upsell $10k",
"isRestricted": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Horizon Technologies Upsell $10k', isRestricted: true})
};
fetch('https://api.affinity.co/v2/opportunities/{opportunityId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.affinity.co/v2/opportunities/{opportunityId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Horizon Technologies Upsell $10k',
'isRestricted' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.affinity.co/v2/opportunities/{opportunityId}"
payload := strings.NewReader("{\n \"name\": \"Horizon Technologies Upsell $10k\",\n \"isRestricted\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.affinity.co/v2/opportunities/{opportunityId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Horizon Technologies Upsell $10k\",\n \"isRestricted\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.affinity.co/v2/opportunities/{opportunityId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Horizon Technologies Upsell $10k\",\n \"isRestricted\": true\n}"
response = http.request(request)
puts response.read_body{
"errors": [
{
"code": "bad-request",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "authorization",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "not-found",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "authentication",
"message": "<string>"
}
]
}Update an Opportunity
| This endpoint is currently in BETA |
|---|
Updates an Opportunity. Only provided properties are updated; properties omitted from the request keep their current value.
When isRestricted is true, the Opportunity becomes restricted, and the requester is added to its allow list. When a Field of the List sets the allow list, the requester is added to that Field only if it is a Person Field. Enterprise Admins are not added to that Field.
When your organization does not allow restricted Opportunities, or does not have the Restricted Opportunities feature, the request fails with 403. When the Opportunity is already restricted, the request fails with 400. When isRestricted is false, the request fails with 400.
Requires manage access to the opportunity.
curl --request POST \
--url https://api.affinity.co/v2/opportunities/{opportunityId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Horizon Technologies Upsell $10k",
"isRestricted": true
}
'import requests
url = "https://api.affinity.co/v2/opportunities/{opportunityId}"
payload = {
"name": "Horizon Technologies Upsell $10k",
"isRestricted": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Horizon Technologies Upsell $10k', isRestricted: true})
};
fetch('https://api.affinity.co/v2/opportunities/{opportunityId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.affinity.co/v2/opportunities/{opportunityId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Horizon Technologies Upsell $10k',
'isRestricted' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.affinity.co/v2/opportunities/{opportunityId}"
payload := strings.NewReader("{\n \"name\": \"Horizon Technologies Upsell $10k\",\n \"isRestricted\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.affinity.co/v2/opportunities/{opportunityId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Horizon Technologies Upsell $10k\",\n \"isRestricted\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.affinity.co/v2/opportunities/{opportunityId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Horizon Technologies Upsell $10k\",\n \"isRestricted\": true\n}"
response = http.request(request)
puts response.read_body{
"errors": [
{
"code": "bad-request",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "authorization",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "not-found",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "authentication",
"message": "<string>"
}
]
}Authorizations
Path Parameters
Body
Partial-update request body for an Opportunity. Only provided properties are updated; properties omitted from the request keep their current value.
Response
No Content
Was this page helpful?