curl --request PUT \
--url https://api.statisfy.com/v1/objects/opportunity/records \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"account": null,
"amount": null,
"close_date": null,
"crm_opportunity_id": null,
"description": null,
"fields": {},
"name": null,
"owner": null,
"stage": null,
"type": null
}
'import requests
url = "https://api.statisfy.com/v1/objects/opportunity/records"
payload = {
"account": None,
"amount": None,
"close_date": None,
"crm_opportunity_id": None,
"description": None,
"fields": {},
"name": None,
"owner": None,
"stage": None,
"type": None
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
account: null,
amount: null,
close_date: null,
crm_opportunity_id: null,
description: null,
fields: {},
name: null,
owner: null,
stage: null,
type: null
})
};
fetch('https://api.statisfy.com/v1/objects/opportunity/records', 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.statisfy.com/v1/objects/opportunity/records",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'account' => null,
'amount' => null,
'close_date' => null,
'crm_opportunity_id' => null,
'description' => null,
'fields' => [
],
'name' => null,
'owner' => null,
'stage' => null,
'type' => null
]),
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.statisfy.com/v1/objects/opportunity/records"
payload := strings.NewReader("{\n \"account\": null,\n \"amount\": null,\n \"close_date\": null,\n \"crm_opportunity_id\": null,\n \"description\": null,\n \"fields\": {},\n \"name\": null,\n \"owner\": null,\n \"stage\": null,\n \"type\": null\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.statisfy.com/v1/objects/opportunity/records")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"account\": null,\n \"amount\": null,\n \"close_date\": null,\n \"crm_opportunity_id\": null,\n \"description\": null,\n \"fields\": {},\n \"name\": null,\n \"owner\": null,\n \"stage\": null,\n \"type\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.statisfy.com/v1/objects/opportunity/records")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"account\": null,\n \"amount\": null,\n \"close_date\": null,\n \"crm_opportunity_id\": null,\n \"description\": null,\n \"fields\": {},\n \"name\": null,\n \"owner\": null,\n \"stage\": null,\n \"type\": null\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"result": "created",
"account": "<string>",
"account_name": "<string>",
"amount": 123,
"close_date": "<string>",
"created_at": "<string>",
"crm_opportunity_id": "<string>",
"description": "<string>",
"fields": {},
"is_closed": false,
"is_won": false,
"name": "<string>",
"owner": "<string>",
"source": "<string>",
"stage": "<string>",
"type": "<string>"
}{
"id": "<string>",
"result": "created",
"account": "<string>",
"account_name": "<string>",
"amount": 123,
"close_date": "<string>",
"created_at": "<string>",
"crm_opportunity_id": "<string>",
"description": "<string>",
"fields": {},
"is_closed": false,
"is_won": false,
"name": "<string>",
"owner": "<string>",
"source": "<string>",
"stage": "<string>",
"type": "<string>"
}Update the matching opportunity, or create it
match=crm_opportunity_id finds the opportunity by your CRM’s id for it, matched as stored (after trimming spaces) or in its other Salesforce form (15 or 18 characters). One matches: it is updated and the answer is 200 with result: "updated". None does: the body is a create and the answer is 201 with result: "created". A CRM id a deleted opportunity holds is a 409. On the update side account must be the one the opportunity is on (409 otherwise; an upsert does not move it). Retrying is safe: a retry after a create updates. Of two upserts of one new CRM id in the same form at the same moment, one creates and the other is a 409; retry it to update. Needs opportunities:create and opportunities:update.
curl --request PUT \
--url https://api.statisfy.com/v1/objects/opportunity/records \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"account": null,
"amount": null,
"close_date": null,
"crm_opportunity_id": null,
"description": null,
"fields": {},
"name": null,
"owner": null,
"stage": null,
"type": null
}
'import requests
url = "https://api.statisfy.com/v1/objects/opportunity/records"
payload = {
"account": None,
"amount": None,
"close_date": None,
"crm_opportunity_id": None,
"description": None,
"fields": {},
"name": None,
"owner": None,
"stage": None,
"type": None
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
account: null,
amount: null,
close_date: null,
crm_opportunity_id: null,
description: null,
fields: {},
name: null,
owner: null,
stage: null,
type: null
})
};
fetch('https://api.statisfy.com/v1/objects/opportunity/records', 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.statisfy.com/v1/objects/opportunity/records",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'account' => null,
'amount' => null,
'close_date' => null,
'crm_opportunity_id' => null,
'description' => null,
'fields' => [
],
'name' => null,
'owner' => null,
'stage' => null,
'type' => null
]),
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.statisfy.com/v1/objects/opportunity/records"
payload := strings.NewReader("{\n \"account\": null,\n \"amount\": null,\n \"close_date\": null,\n \"crm_opportunity_id\": null,\n \"description\": null,\n \"fields\": {},\n \"name\": null,\n \"owner\": null,\n \"stage\": null,\n \"type\": null\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.statisfy.com/v1/objects/opportunity/records")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"account\": null,\n \"amount\": null,\n \"close_date\": null,\n \"crm_opportunity_id\": null,\n \"description\": null,\n \"fields\": {},\n \"name\": null,\n \"owner\": null,\n \"stage\": null,\n \"type\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.statisfy.com/v1/objects/opportunity/records")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"account\": null,\n \"amount\": null,\n \"close_date\": null,\n \"crm_opportunity_id\": null,\n \"description\": null,\n \"fields\": {},\n \"name\": null,\n \"owner\": null,\n \"stage\": null,\n \"type\": null\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"result": "created",
"account": "<string>",
"account_name": "<string>",
"amount": 123,
"close_date": "<string>",
"created_at": "<string>",
"crm_opportunity_id": "<string>",
"description": "<string>",
"fields": {},
"is_closed": false,
"is_won": false,
"name": "<string>",
"owner": "<string>",
"source": "<string>",
"stage": "<string>",
"type": "<string>"
}{
"id": "<string>",
"result": "created",
"account": "<string>",
"account_name": "<string>",
"amount": 123,
"close_date": "<string>",
"created_at": "<string>",
"crm_opportunity_id": "<string>",
"description": "<string>",
"fields": {},
"is_closed": false,
"is_won": false,
"name": "<string>",
"owner": "<string>",
"source": "<string>",
"stage": "<string>",
"type": "<string>"
}Authorizations
An API key, sent as Authorization: Bearer stfy_live_…. See Authentication for how to get one and which scopes it needs.
Query Parameters
Body
Response
Successful Response
Was this page helpful?