update
This commit is contained in:
@@ -388,6 +388,141 @@ Jesli etykieta nie jest ustawiona:
|
||||
}
|
||||
```
|
||||
|
||||
### 4.6c Ustawienie unit pricing
|
||||
|
||||
- `action=product_unit_pricing_set`
|
||||
- Cel: zapisuje `products.unit_pricing_measure`, `products.unit_pricing_base_measure` oraz `products.unit_pricing_changed_at`
|
||||
|
||||
Parametry:
|
||||
- `api_key` (string, wymagany)
|
||||
- `offer_id` (string, wymagany)
|
||||
- `client_id` (int, wymagany)
|
||||
- `unit_pricing_measure` (string, opcjonalny) - format: `<liczba><spacja><jednostka>`, np. `30 ml`
|
||||
- `unit_pricing_base_measure` (string, opcjonalny) - format jw., np. `100 ml`
|
||||
|
||||
Uwagi:
|
||||
- oba pola musza byc podane razem albo oba puste (czyszczenie)
|
||||
- wymagane sa te same jednostki w `measure` i `base_measure`
|
||||
- API akceptuje jednostki: `ml`, `l`, `mg`, `g`, `kg`, `cl`, `m`, `cm`, `sqm`, `cbm`, `ct`, `szt`
|
||||
- dla jednostek `ml` i `g` baza musi miec wartosc `100`
|
||||
- dla jednostek `l`, `kg`, `szt`, `ct` baza musi miec wartosc `1`
|
||||
- zmiana zapisuje komentarz techniczny do `products_comments`
|
||||
|
||||
Przyklad:
|
||||
|
||||
```bash
|
||||
curl -X POST "https://example.com/api.php" \
|
||||
-d "action=product_unit_pricing_set" \
|
||||
-d "api_key=YOUR_API_KEY" \
|
||||
-d "client_id=12" \
|
||||
-d "offer_id=SKU-123" \
|
||||
-d "unit_pricing_measure=30 ml" \
|
||||
-d "unit_pricing_base_measure=100 ml"
|
||||
```
|
||||
|
||||
Przyklad odpowiedzi:
|
||||
|
||||
```json
|
||||
{
|
||||
"result": "ok",
|
||||
"product_id": 987,
|
||||
"offer_id": "SKU-123",
|
||||
"unit_pricing_measure": "30 ml",
|
||||
"unit_pricing_base_measure": "100 ml"
|
||||
}
|
||||
```
|
||||
|
||||
Przyklad bledu walidacji:
|
||||
|
||||
```json
|
||||
{
|
||||
"result": "error",
|
||||
"message": "Invalid unit_pricing_measure format"
|
||||
}
|
||||
```
|
||||
|
||||
HTTP status: `422`
|
||||
|
||||
### 4.6d Odczyt unit pricing
|
||||
|
||||
- `action=product_unit_pricing_get`
|
||||
- Cel: odczytuje `products.unit_pricing_measure` i `products.unit_pricing_base_measure`
|
||||
|
||||
Parametry:
|
||||
- `api_key` (string, wymagany)
|
||||
- `offer_id` (string, wymagany)
|
||||
- `client_id` (int, wymagany)
|
||||
|
||||
Przyklad:
|
||||
|
||||
```bash
|
||||
curl -G "https://example.com/api.php" \
|
||||
--data-urlencode "action=product_unit_pricing_get" \
|
||||
--data-urlencode "api_key=YOUR_API_KEY" \
|
||||
--data-urlencode "client_id=12" \
|
||||
--data-urlencode "offer_id=SKU-123"
|
||||
```
|
||||
|
||||
Przyklad odpowiedzi:
|
||||
|
||||
```json
|
||||
{
|
||||
"result": "ok",
|
||||
"product_id": 987,
|
||||
"offer_id": "SKU-123",
|
||||
"unit_pricing_measure": "30 ml",
|
||||
"unit_pricing_base_measure": "100 ml"
|
||||
}
|
||||
```
|
||||
|
||||
### 4.6e Lista produktow bez unit pricing
|
||||
|
||||
- `action=products_get_missing_unit_pricing`
|
||||
- Cel: zwraca produkty bez kompletu `unit_pricing_*`, z priorytetem wg klikniec
|
||||
|
||||
Parametry:
|
||||
- `api_key` (string, wymagany)
|
||||
- `client_id` (int, wymagany)
|
||||
- `top` (int, opcjonalny, domyslnie 50, max 200)
|
||||
- `category_filter` (string, opcjonalny) - gdy podany, filtruje po `google_product_category LIKE %...%`
|
||||
|
||||
Uwagi:
|
||||
- bez `category_filter` endpoint ogranicza liste do kategorii beauty/cosmetics (heurystyka LIKE)
|
||||
- sortowanie: `clicks_all_time DESC`, potem `clicks_30 DESC`
|
||||
|
||||
Przyklad:
|
||||
|
||||
```bash
|
||||
curl -G "https://example.com/api.php" \
|
||||
--data-urlencode "action=products_get_missing_unit_pricing" \
|
||||
--data-urlencode "api_key=YOUR_API_KEY" \
|
||||
--data-urlencode "client_id=12" \
|
||||
--data-urlencode "top=20"
|
||||
```
|
||||
|
||||
Przyklad odpowiedzi:
|
||||
|
||||
```json
|
||||
{
|
||||
"result": "ok",
|
||||
"client_id": 12,
|
||||
"count": 2,
|
||||
"products": [
|
||||
{
|
||||
"product_id": 987,
|
||||
"offer_id": "SKU-123",
|
||||
"default_name": "Serum C 30 ml",
|
||||
"custom_title": "Serum C 30 ml",
|
||||
"google_product_category": "Health & Beauty > Skin Care",
|
||||
"unit_pricing_measure": "",
|
||||
"unit_pricing_base_measure": "",
|
||||
"clicks_30": 45,
|
||||
"clicks_all_time": 312
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### 4.7 Odczyt minimalnego ROAS produktu
|
||||
|
||||
- `action=product_min_roas_get`
|
||||
|
||||
Reference in New Issue
Block a user