Upsert Daily Sales
curl --request PUT \
--url https://console.lomaplatform.com/api/org/v1/sales/daily \
--header 'API-Key: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"date": "2024-06-14",
"locations": {
"loc_jsnFcOej5oD": {
"net_sales": 1201,
"transaction_count": 12
},
"loc_PP4ZcUxYG2g": {
"net_sales": 3291,
"transaction_count": 32
}
}
}
'import requests
url = "https://console.lomaplatform.com/api/org/v1/sales/daily"
payload = {
"date": "2024-06-14",
"locations": {
"loc_jsnFcOej5oD": {
"net_sales": 1201,
"transaction_count": 12
},
"loc_PP4ZcUxYG2g": {
"net_sales": 3291,
"transaction_count": 32
}
}
}
headers = {
"API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
date: '2024-06-14',
locations: {
loc_jsnFcOej5oD: {net_sales: 1201, transaction_count: 12},
loc_PP4ZcUxYG2g: {net_sales: 3291, transaction_count: 32}
}
})
};
fetch('https://console.lomaplatform.com/api/org/v1/sales/daily', 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://console.lomaplatform.com/api/org/v1/sales/daily",
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([
'date' => '2024-06-14',
'locations' => [
'loc_jsnFcOej5oD' => [
'net_sales' => 1201,
'transaction_count' => 12
],
'loc_PP4ZcUxYG2g' => [
'net_sales' => 3291,
'transaction_count' => 32
]
]
]),
CURLOPT_HTTPHEADER => [
"API-Key: <api-key>",
"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://console.lomaplatform.com/api/org/v1/sales/daily"
payload := strings.NewReader("{\n \"date\": \"2024-06-14\",\n \"locations\": {\n \"loc_jsnFcOej5oD\": {\n \"net_sales\": 1201,\n \"transaction_count\": 12\n },\n \"loc_PP4ZcUxYG2g\": {\n \"net_sales\": 3291,\n \"transaction_count\": 32\n }\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("API-Key", "<api-key>")
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://console.lomaplatform.com/api/org/v1/sales/daily")
.header("API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"date\": \"2024-06-14\",\n \"locations\": {\n \"loc_jsnFcOej5oD\": {\n \"net_sales\": 1201,\n \"transaction_count\": 12\n },\n \"loc_PP4ZcUxYG2g\": {\n \"net_sales\": 3291,\n \"transaction_count\": 32\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://console.lomaplatform.com/api/org/v1/sales/daily")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"date\": \"2024-06-14\",\n \"locations\": {\n \"loc_jsnFcOej5oD\": {\n \"net_sales\": 1201,\n \"transaction_count\": 12\n },\n \"loc_PP4ZcUxYG2g\": {\n \"net_sales\": 3291,\n \"transaction_count\": 32\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"error": {
"status": 400,
"message": "Invalid date.",
"hint": "Date cannot be in the future."
}
}{
"error": {
"status": 401,
"message": "Invalid API Key"
}
}Sales
Upsert Daily Sales
Upserts daily sales data by location and date.
PUT
/
api
/
org
/
v1
/
sales
/
daily
Upsert Daily Sales
curl --request PUT \
--url https://console.lomaplatform.com/api/org/v1/sales/daily \
--header 'API-Key: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"date": "2024-06-14",
"locations": {
"loc_jsnFcOej5oD": {
"net_sales": 1201,
"transaction_count": 12
},
"loc_PP4ZcUxYG2g": {
"net_sales": 3291,
"transaction_count": 32
}
}
}
'import requests
url = "https://console.lomaplatform.com/api/org/v1/sales/daily"
payload = {
"date": "2024-06-14",
"locations": {
"loc_jsnFcOej5oD": {
"net_sales": 1201,
"transaction_count": 12
},
"loc_PP4ZcUxYG2g": {
"net_sales": 3291,
"transaction_count": 32
}
}
}
headers = {
"API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
date: '2024-06-14',
locations: {
loc_jsnFcOej5oD: {net_sales: 1201, transaction_count: 12},
loc_PP4ZcUxYG2g: {net_sales: 3291, transaction_count: 32}
}
})
};
fetch('https://console.lomaplatform.com/api/org/v1/sales/daily', 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://console.lomaplatform.com/api/org/v1/sales/daily",
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([
'date' => '2024-06-14',
'locations' => [
'loc_jsnFcOej5oD' => [
'net_sales' => 1201,
'transaction_count' => 12
],
'loc_PP4ZcUxYG2g' => [
'net_sales' => 3291,
'transaction_count' => 32
]
]
]),
CURLOPT_HTTPHEADER => [
"API-Key: <api-key>",
"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://console.lomaplatform.com/api/org/v1/sales/daily"
payload := strings.NewReader("{\n \"date\": \"2024-06-14\",\n \"locations\": {\n \"loc_jsnFcOej5oD\": {\n \"net_sales\": 1201,\n \"transaction_count\": 12\n },\n \"loc_PP4ZcUxYG2g\": {\n \"net_sales\": 3291,\n \"transaction_count\": 32\n }\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("API-Key", "<api-key>")
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://console.lomaplatform.com/api/org/v1/sales/daily")
.header("API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"date\": \"2024-06-14\",\n \"locations\": {\n \"loc_jsnFcOej5oD\": {\n \"net_sales\": 1201,\n \"transaction_count\": 12\n },\n \"loc_PP4ZcUxYG2g\": {\n \"net_sales\": 3291,\n \"transaction_count\": 32\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://console.lomaplatform.com/api/org/v1/sales/daily")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"date\": \"2024-06-14\",\n \"locations\": {\n \"loc_jsnFcOej5oD\": {\n \"net_sales\": 1201,\n \"transaction_count\": 12\n },\n \"loc_PP4ZcUxYG2g\": {\n \"net_sales\": 3291,\n \"transaction_count\": 32\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"error": {
"status": 400,
"message": "Invalid date.",
"hint": "Date cannot be in the future."
}
}{
"error": {
"status": 401,
"message": "Invalid API Key"
}
}⌘I