curl --request PATCH \
--url https://api.withflex.com/v1/product_components/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"product_component": {
"category": "base",
"nutrition_basis": "per_100g",
"nutrition": {}
}
}
'import requests
url = "https://api.withflex.com/v1/product_components/{id}"
payload = { "product_component": {
"category": "base",
"nutrition_basis": "per_100g",
"nutrition": {}
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
product_component: {category: 'base', nutrition_basis: 'per_100g', nutrition: {}}
})
};
fetch('https://api.withflex.com/v1/product_components/{id}', 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.withflex.com/v1/product_components/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'product_component' => [
'category' => 'base',
'nutrition_basis' => 'per_100g',
'nutrition' => [
]
]
]),
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.withflex.com/v1/product_components/{id}"
payload := strings.NewReader("{\n \"product_component\": {\n \"category\": \"base\",\n \"nutrition_basis\": \"per_100g\",\n \"nutrition\": {}\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.withflex.com/v1/product_components/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"product_component\": {\n \"category\": \"base\",\n \"nutrition_basis\": \"per_100g\",\n \"nutrition\": {}\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.withflex.com/v1/product_components/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"product_component\": {\n \"category\": \"base\",\n \"nutrition_basis\": \"per_100g\",\n \"nutrition\": {}\n }\n}"
response = http.request(request)
puts response.read_body{
"product_component": {
"component_id": "fcomp_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
"component_nutrition_id": "fcn_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
"name": "string",
"shared": true,
"test_mode": true,
"category": "string",
"nutrition": {},
"vegan": true,
"gluten_free": true,
"created_at": "string",
"updated_at": "string"
}
}{
"code": "string",
"detail": "string"
}{
"code": "string",
"detail": "string"
}{
"code": "string",
"detail": "string"
}{
"code": "string",
"detail": "string"
}{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string"
}
]
}{
"code": "string",
"detail": "string"
}Update Product Component
Updates your nutrition for a product component. Only the fields you supply are changed.
The component’s name cannot be changed — the name row is shared with every
other account that registered the same ingredient. Use clear to reset a value
to “not supplied”; omitting a field means “leave unchanged”, so omission cannot
express erasure.
curl --request PATCH \
--url https://api.withflex.com/v1/product_components/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"product_component": {
"category": "base",
"nutrition_basis": "per_100g",
"nutrition": {}
}
}
'import requests
url = "https://api.withflex.com/v1/product_components/{id}"
payload = { "product_component": {
"category": "base",
"nutrition_basis": "per_100g",
"nutrition": {}
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
product_component: {category: 'base', nutrition_basis: 'per_100g', nutrition: {}}
})
};
fetch('https://api.withflex.com/v1/product_components/{id}', 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.withflex.com/v1/product_components/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'product_component' => [
'category' => 'base',
'nutrition_basis' => 'per_100g',
'nutrition' => [
]
]
]),
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.withflex.com/v1/product_components/{id}"
payload := strings.NewReader("{\n \"product_component\": {\n \"category\": \"base\",\n \"nutrition_basis\": \"per_100g\",\n \"nutrition\": {}\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.withflex.com/v1/product_components/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"product_component\": {\n \"category\": \"base\",\n \"nutrition_basis\": \"per_100g\",\n \"nutrition\": {}\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.withflex.com/v1/product_components/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"product_component\": {\n \"category\": \"base\",\n \"nutrition_basis\": \"per_100g\",\n \"nutrition\": {}\n }\n}"
response = http.request(request)
puts response.read_body{
"product_component": {
"component_id": "fcomp_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
"component_nutrition_id": "fcn_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
"name": "string",
"shared": true,
"test_mode": true,
"category": "string",
"nutrition": {},
"vegan": true,
"gluten_free": true,
"created_at": "string",
"updated_at": "string"
}
}{
"code": "string",
"detail": "string"
}{
"code": "string",
"detail": "string"
}{
"code": "string",
"detail": "string"
}{
"code": "string",
"detail": "string"
}{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string"
}
]
}{
"code": "string",
"detail": "string"
}Authorizations
Use a Bearer token to access this API.
Path Parameters
The component's fcomp_ identifier.
"fcomp_01J9XR8M3K7VZ8N2YB4WJ6T0RA"
Body
An envelope wrapping a single product component object.
An envelope wrapping a single product component object.
The product component object.
Show child attributes
Show child attributes
{
"category": "base",
"nutrition_basis": "per_100g",
"nutrition": {}
}
Response
An envelope wrapping a single product component object.
An envelope wrapping a single product component object.
The product component object.
Show child attributes
Show child attributes
{
"component_id": "fcomp_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
"component_nutrition_id": "fcn_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
"name": "string",
"shared": true,
"test_mode": true,
"category": "string",
"nutrition": {},
"vegan": true,
"gluten_free": true,
"created_at": "string",
"updated_at": "string"
}