curl --request PUT \
--url https://api.statisfy.com/v1/products \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"date_column": null,
"date_format": null,
"dimensions": [
{
"name": "<string>",
"currency": true,
"hidden": true,
"key": "<string>",
"order": 5000,
"show_change": true,
"suffix": "<string>",
"type": null
}
],
"display_name": "<string>",
"period": null,
"show_if_empty": true
}
'import requests
url = "https://api.statisfy.com/v1/products"
payload = {
"name": "<string>",
"date_column": None,
"date_format": None,
"dimensions": [
{
"name": "<string>",
"currency": True,
"hidden": True,
"key": "<string>",
"order": 5000,
"show_change": True,
"suffix": "<string>",
"type": None
}
],
"display_name": "<string>",
"period": None,
"show_if_empty": True
}
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({
name: '<string>',
date_column: null,
date_format: null,
dimensions: [
{
name: '<string>',
currency: true,
hidden: true,
key: '<string>',
order: 5000,
show_change: true,
suffix: '<string>',
type: null
}
],
display_name: '<string>',
period: null,
show_if_empty: true
})
};
fetch('https://api.statisfy.com/v1/products', 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/products",
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([
'name' => '<string>',
'date_column' => null,
'date_format' => null,
'dimensions' => [
[
'name' => '<string>',
'currency' => true,
'hidden' => true,
'key' => '<string>',
'order' => 5000,
'show_change' => true,
'suffix' => '<string>',
'type' => null
]
],
'display_name' => '<string>',
'period' => null,
'show_if_empty' => 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.statisfy.com/v1/products"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"date_column\": null,\n \"date_format\": null,\n \"dimensions\": [\n {\n \"name\": \"<string>\",\n \"currency\": true,\n \"hidden\": true,\n \"key\": \"<string>\",\n \"order\": 5000,\n \"show_change\": true,\n \"suffix\": \"<string>\",\n \"type\": null\n }\n ],\n \"display_name\": \"<string>\",\n \"period\": null,\n \"show_if_empty\": true\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/products")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"date_column\": null,\n \"date_format\": null,\n \"dimensions\": [\n {\n \"name\": \"<string>\",\n \"currency\": true,\n \"hidden\": true,\n \"key\": \"<string>\",\n \"order\": 5000,\n \"show_change\": true,\n \"suffix\": \"<string>\",\n \"type\": null\n }\n ],\n \"display_name\": \"<string>\",\n \"period\": null,\n \"show_if_empty\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.statisfy.com/v1/products")
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 \"name\": \"<string>\",\n \"date_column\": null,\n \"date_format\": null,\n \"dimensions\": [\n {\n \"name\": \"<string>\",\n \"currency\": true,\n \"hidden\": true,\n \"key\": \"<string>\",\n \"order\": 5000,\n \"show_change\": true,\n \"suffix\": \"<string>\",\n \"type\": null\n }\n ],\n \"display_name\": \"<string>\",\n \"period\": null,\n \"show_if_empty\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"result": "created",
"date_column": "<string>",
"date_format": "%Y-%m-%d",
"dimensions": [
{
"id": "<string>",
"key": "<string>",
"name": "<string>",
"product": "<string>",
"currency": false,
"hidden": false,
"order": 123,
"show_change": false,
"suffix": "<string>",
"type": "number"
}
],
"display_name": "<string>",
"period": "DAILY",
"show_if_empty": true
}{
"id": "<string>",
"name": "<string>",
"result": "created",
"date_column": "<string>",
"date_format": "%Y-%m-%d",
"dimensions": [
{
"id": "<string>",
"key": "<string>",
"name": "<string>",
"product": "<string>",
"currency": false,
"hidden": false,
"order": 123,
"show_change": false,
"suffix": "<string>",
"type": "number"
}
],
"display_name": "<string>",
"period": "DAILY",
"show_if_empty": true
}Create or update a product and its dimensions
Sets up a product and its dimensions in one call, in one transaction: the product found by its name (match=name), created when there is none (a new product needs period); each dimension found by its key (key, or the one its name makes), created when the product has none, updated when it does. Dimensions not named are left as they are. A key another product’s dimension holds, or a value type a dimension’s stored values would not read as, refuses the whole call (409) and writes nothing. Answers 201 when it created the product, 200 when it updated it. Needs products:create and products:update.
curl --request PUT \
--url https://api.statisfy.com/v1/products \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"date_column": null,
"date_format": null,
"dimensions": [
{
"name": "<string>",
"currency": true,
"hidden": true,
"key": "<string>",
"order": 5000,
"show_change": true,
"suffix": "<string>",
"type": null
}
],
"display_name": "<string>",
"period": null,
"show_if_empty": true
}
'import requests
url = "https://api.statisfy.com/v1/products"
payload = {
"name": "<string>",
"date_column": None,
"date_format": None,
"dimensions": [
{
"name": "<string>",
"currency": True,
"hidden": True,
"key": "<string>",
"order": 5000,
"show_change": True,
"suffix": "<string>",
"type": None
}
],
"display_name": "<string>",
"period": None,
"show_if_empty": True
}
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({
name: '<string>',
date_column: null,
date_format: null,
dimensions: [
{
name: '<string>',
currency: true,
hidden: true,
key: '<string>',
order: 5000,
show_change: true,
suffix: '<string>',
type: null
}
],
display_name: '<string>',
period: null,
show_if_empty: true
})
};
fetch('https://api.statisfy.com/v1/products', 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/products",
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([
'name' => '<string>',
'date_column' => null,
'date_format' => null,
'dimensions' => [
[
'name' => '<string>',
'currency' => true,
'hidden' => true,
'key' => '<string>',
'order' => 5000,
'show_change' => true,
'suffix' => '<string>',
'type' => null
]
],
'display_name' => '<string>',
'period' => null,
'show_if_empty' => 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.statisfy.com/v1/products"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"date_column\": null,\n \"date_format\": null,\n \"dimensions\": [\n {\n \"name\": \"<string>\",\n \"currency\": true,\n \"hidden\": true,\n \"key\": \"<string>\",\n \"order\": 5000,\n \"show_change\": true,\n \"suffix\": \"<string>\",\n \"type\": null\n }\n ],\n \"display_name\": \"<string>\",\n \"period\": null,\n \"show_if_empty\": true\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/products")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"date_column\": null,\n \"date_format\": null,\n \"dimensions\": [\n {\n \"name\": \"<string>\",\n \"currency\": true,\n \"hidden\": true,\n \"key\": \"<string>\",\n \"order\": 5000,\n \"show_change\": true,\n \"suffix\": \"<string>\",\n \"type\": null\n }\n ],\n \"display_name\": \"<string>\",\n \"period\": null,\n \"show_if_empty\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.statisfy.com/v1/products")
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 \"name\": \"<string>\",\n \"date_column\": null,\n \"date_format\": null,\n \"dimensions\": [\n {\n \"name\": \"<string>\",\n \"currency\": true,\n \"hidden\": true,\n \"key\": \"<string>\",\n \"order\": 5000,\n \"show_change\": true,\n \"suffix\": \"<string>\",\n \"type\": null\n }\n ],\n \"display_name\": \"<string>\",\n \"period\": null,\n \"show_if_empty\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"result": "created",
"date_column": "<string>",
"date_format": "%Y-%m-%d",
"dimensions": [
{
"id": "<string>",
"key": "<string>",
"name": "<string>",
"product": "<string>",
"currency": false,
"hidden": false,
"order": 123,
"show_change": false,
"suffix": "<string>",
"type": "number"
}
],
"display_name": "<string>",
"period": "DAILY",
"show_if_empty": true
}{
"id": "<string>",
"name": "<string>",
"result": "created",
"date_column": "<string>",
"date_format": "%Y-%m-%d",
"dimensions": [
{
"id": "<string>",
"key": "<string>",
"name": "<string>",
"product": "<string>",
"currency": false,
"hidden": false,
"order": 123,
"show_change": false,
"suffix": "<string>",
"type": "number"
}
],
"display_name": "<string>",
"period": "DAILY",
"show_if_empty": true
}Authorizations
An API key, sent as Authorization: Bearer stfy_live_…. See Authentication for how to get one and which scopes it needs.
Body
Response
Successful Response
Was this page helpful?