curl --request PUT \
--url https://api.vellaro.io/api/v1/admin/tenant-languages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"active": [
"<string>"
],
"default": "<string>"
}
'import requests
url = "https://api.vellaro.io/api/v1/admin/tenant-languages"
payload = {
"active": ["<string>"],
"default": "<string>"
}
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({active: ['<string>'], default: '<string>'})
};
fetch('https://api.vellaro.io/api/v1/admin/tenant-languages', 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.vellaro.io/api/v1/admin/tenant-languages",
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([
'active' => [
'<string>'
],
'default' => '<string>'
]),
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.vellaro.io/api/v1/admin/tenant-languages"
payload := strings.NewReader("{\n \"active\": [\n \"<string>\"\n ],\n \"default\": \"<string>\"\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.vellaro.io/api/v1/admin/tenant-languages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"active\": [\n \"<string>\"\n ],\n \"default\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vellaro.io/api/v1/admin/tenant-languages")
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 \"active\": [\n \"<string>\"\n ],\n \"default\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"code": "<string>",
"name": "<string>",
"locale": "<string>",
"flag_icon": "<string>",
"is_active": true,
"is_default": true,
"sort_order": 123
}
],
"meta": {
"page": 123,
"page_size": 123,
"total": 123,
"total_pages": 123
},
"error": "<string>",
"error_code": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Set Tenant Languages
Admin: sostituisce in blocco la selezione del negozio.
In blocco e non per singola lingua di proposito: la predefinita è un
vincolo FRA righe (indice unico parziale uq_tenant_languages_one_default
su (tenant_id) WHERE is_default), quindi spostarla con due PATCH
indipendenti passerebbe da uno stato intermedio che il DB rifiuta.
L’ordine di active diventa sort_order, cioè l’ordine con cui le lingue
compaiono nel selettore dei client.
curl --request PUT \
--url https://api.vellaro.io/api/v1/admin/tenant-languages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"active": [
"<string>"
],
"default": "<string>"
}
'import requests
url = "https://api.vellaro.io/api/v1/admin/tenant-languages"
payload = {
"active": ["<string>"],
"default": "<string>"
}
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({active: ['<string>'], default: '<string>'})
};
fetch('https://api.vellaro.io/api/v1/admin/tenant-languages', 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.vellaro.io/api/v1/admin/tenant-languages",
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([
'active' => [
'<string>'
],
'default' => '<string>'
]),
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.vellaro.io/api/v1/admin/tenant-languages"
payload := strings.NewReader("{\n \"active\": [\n \"<string>\"\n ],\n \"default\": \"<string>\"\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.vellaro.io/api/v1/admin/tenant-languages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"active\": [\n \"<string>\"\n ],\n \"default\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vellaro.io/api/v1/admin/tenant-languages")
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 \"active\": [\n \"<string>\"\n ],\n \"default\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"code": "<string>",
"name": "<string>",
"locale": "<string>",
"flag_icon": "<string>",
"is_active": true,
"is_default": true,
"sort_order": 123
}
],
"meta": {
"page": 123,
"page_size": 123,
"total": 123,
"total_pages": 123
},
"error": "<string>",
"error_code": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Autorizzazioni
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Corpo
Sostituisce in blocco la selezione del negozio.
active è anche l'ORDINE di visualizzazione nel selettore: la posizione
nella lista diventa sort_order. Un PATCH per singola lingua non
basterebbe, perché la predefinita è un vincolo fra righe (indice unico
parziale uq_tenant_languages_one_default) e va spostata atomicamente.