API Produse

Acesta este sectiunea de help pentru versiunea Legacy a panoului de control. Daca utilizati panoul de control Flex, puteti gasi aici sectiunea de help relevanta.

Foloseste API-ul de produse pentru a extrage informatii despre produse, pentru a adauga produse sau pentru a actualiza datelor unor produse sau variante existente.

Campuri disponibile

Lista de mai jos indica toate campurile disponibile pt acest API, care sunt returnate cand extragi o lista sau resursa individuala, care pot fi modificate, care sunt obligatorii in cazul crearii unei resurse noi sau actualizarii unei resurse existente.

Camp Tip Descriere Lista Alterabil
id int ID-ul produsului  
type string Tipul produsului (basic, multi_variant, digital, bundle)
sku string Codul SKU al produsului
ean string Codul EAN al produsului
ext_ref string Identificatorul de referinta in sistemul furnizorului
name string Numele produsului
description string Descrierea produsului  
meta_description string Meta-descrierea produsului  
inventory_enabled string Activarea functiei de inventar produs (valoare implicita off)
stock int Cantitatea in stoc
warehouses array Repartizare stocuri pe depozite
   warehouses[].id int ID-ul depozitului  
   warehouses[].name string Numele depozitului  
   warehouses[].stock int Cantitatea in stoc
   warehouses[].label string Pozitia in raft
availability_id int Disponibilitate furnizor
price_net float Pretul net
price_gross float Pretul cu taxe incluse
old_price_net float Pretul vechi neredus al produsului
old_price_gross float Pretul vechi neredus al produsului (taxe incluse)
tax_id int ID-ul taxei
tax_value float Valoarea procentuala a taxei
tax_name string Denumirea taxei  
shipping_type string Setare cost livrare la nivel de produs (default, free,unit, disabled)  
quantity_multiplier int Multiplicatorul de cantitate (valoare implicita 1)
unit_type string Tip unitate de masura
shipping_unit_cost float Cost unitar livrare produs
weight float Greutate produs
category_id int ID-ul categoriei
category_name string Numele categoriei  
categories array Alocarea produsului pe categorii multiple  
   categories [].id int ID-ul categoriei    
   categories [].name string Numele categoriei    
manufacturer_id int Id-ul producatorului
manufacturer_name string Numele producatorului
tags array Taguri aferente produsului  
   tags [].id int ID-ul tag-ului    
   tags [].name string Numele tag-ului  
product_attributes array Atributele descriptive ale produsului
   product_attributes[].id int ID-ul atributului  
   product_attributes[].name string Numele atributului
   product_attributes[].options array Lista de valori selectate ale atributului  
      product_attributes[].options[].id int ID-ul valorii atributului  
      product_attributes[].options[].value string Numele valorii atributului
variant_attributes array Atributele produsului care diferentiaza variantele acestuia
   variant_attributes[].id int ID-ul atributului  
   variant_attributes[].name string Numele atributului
   variant_attributes[].options array Lista de valori selectate ale atributului  
      variant_attributes[].options[].id int ID-ul valorii atributului  
      variant_attributes[].options[].value string Numele valorii atributului
variants array Variantele produsului (produse tip multi_variant)
   variants[].id int ID-ul variantei  
   variants[].sku string Codul SKU al variantei
   variants[].ean string Codul EAN al variantei
   variants[].inventory_enabled string Activarea functiei de inventar al variantei
   variants[].stock int Stocul variantei
   variants[].price_net float Pretul net
   variants[].price_gross float Pretul cu taxe incluse
   variants[].variant_options[] array Atributele care definesc variantele de produs
      variants[].variant_options[].id int ID-ul atributului
      variants[].variant_options[].name int Numele atributului
      variants[].variant_options[].value string Valoarea atributului
variants[].visibility string Optiuni vizibilitate ("visible", "discontinued")
meta_fields object Campurile suplimentare
   meta_fields [].img[] array Camp suplimentar de tip imagine
      meta_fields [].img[] .name int Numele imaginii  
      meta_fields [].img[] .ext string Extensia imaginii  
      meta_fields [].img[] .width int Latimea imaginii  
      meta_fields [].img[] .height int Lungimea imaginii  
      meta_fields [].img[] .path string Calea imaginii  
   meta_fields [].list[] string Camp suplimentar de tip lista
   meta_fields [].text[] string Camp suplimentar de tip text
user_fields array Lista de campuri personalizabile
url string URL-ul produsului (active, inactive)  
images array Lista de imagini
   images[].id int ID-ul imaginii  
   images[].url string URL-ul imaginii  
   images[].caption int Denumirea imaginii  
meta_links array URL-urile produselor aferente limbilor active    
   meta_links[].lang string Limba    
   meta_links[].url string URL-ul produsului    
date_created date Data adaugarii produsului (format ISO 8601)  
date_modified date Data ultimei modificari pe produs, nu include actualizarile de pret si stoc (format ISO 8601)  
date_last_updated date Data ultimei modificari, include actualizarile de pret si stoc (format ISO 8601)  
status string Status-ul inregistrarii (active, inactive)
is_featured bool Produsul este afisat pe homepage  
is_listed bool Produsul indeplineste conditiile pt a fi listat pe site  
is_new bool Produsul este marcat ca fiind Nou sau este recent adaugat  
is_marked_new bool Produsul este marcat ca fiind Nou    
in_stock bool Produsul indeplineste conditiile pt a fi achizitionat  
total_sales int Numarul de comenzi in care se regaseste produsul  
total_units_sold int Numarul total de unitati vandute  
total_views int Numarul total de afisari ale produsului  
bundled_products array Produsele incluse in pachet  
visibility string Optiuni vizibilitate ("visible", "discontinued", "hidden")

TIP
Orice camp returnat si care nu este documentat poate fi ignorat deoarece nu este inca disponibil.

Extragere lista produse

Afiseaza lista filtrata de inregistrari.

Tip: Lista resurse
Verb: GET
Url: /api/v2/products
Filtrare rezultate: Da
Selectie campuri: Da
Includere campuri suplimentare: Da
Paginatie: Da

Codul http de raspuns este 200 in caz de succes, raspunsul va avea forma unei liste de resurse aferente filtrelor definite.

Doar campurile de tip lista vor fi incluse in rezultatul standard. Poti include campuri suplimentare care in mod implicit nu sunt incluse folosind parametrul include si mentionand in mod explicit doar campurile suplimentare (separate prin virgula) pe care le doresti incluse.

GET /api/v2/products?include=variants 

Poti filtra campurile pe care le doresti incluse in rezultat pentru fiecare resursa folosind parametrul fields si mentionand in mod explicit doar campurile (separate prin virgula) pe care le doresti incluse (campul id va fi inclus intotdeauna in mod implicit).

GET /api/v2/products?fields=id,name,url

Filtrare rezultate

Este posibila filtrarea rezultatelor prin apendarea unor parametrii specifici in URL.

Parametru Descriere Exemplu
id Id-ul produsului id=10001
ids Lista id-uri produse separate prin virgula ids=10001,10002,10003
type Tipul produsului (basic, multi_variant, digital, bundle) type=multi_variant
sku Codul SKU al produsului sku=PN.1358
ean Codul EAN al produsului ean=7501031311309
category_id Id-ul categoriei din care face parte category_id=101
category_ids Lista id-uri categorii category_ids=101,102,103
manufacturer_id Id-ul producatorului manufacturer_id=1001
manufacturer_ids Lista id-uri producatori manufacturer_ids=1001,1002,1003
meta_fields Campurile suplimentare meta_fields[field_key]=field_value
created_after Data de la care au fost create inregistrarile (format ISO 8601) created_after=2019-01-01
created_before Data pana la care au fost create inregistrarile (format ISO 8601) created_before=2020-01-01
modified_after Data de la care au fost modificate ultima data inregistrarile (format ISO 8601) modified_after=2019-01-01
modified_before Data pana la care au fost modificate ultima data inregistrarile (format ISO 8601) modified_before=2020-01-01
status Status-ul inregistrarii (active, inactive) status=active
is_featured Inregistrarile afisate pe homepage (0, 1) is_featured=1
is_new Inregistrarile noi sau marcate ca fiind noi (0, 1) is_new=1
tag_name Numele tag-ului tag_name=valoare
tag_ids Lista id-uri taguri separate prin virgula tag_ids=123,456
ext_ref Valoarea referintei externe ext_ref=valoare
GET /api/v2/products?category_id=101&status=active

Sortare rezultate

Este posibila sortarea rezultatelor prin apendarea unor parametrii specifici in URL.

Parametru Descriere Exemplu
name Numele produsului ascendent sort=name
name.desc Numele produsului descendent sort=name.desc
date_created Data adaugarii produsului ascendent sort=date_created
date_created.desc Data adaugarii produsului descendent sort=date_created.desc
newest Cele mai noi produse sort=newest
date_modified Data actualizarii produselor ascendent sort=date_modified
date_modified.desc Data actualizarii produselor descendent sort=date_modified.desc
rank Cele mai populare produse sort=rank
best_seller Cele mai bine vandute produse sort=best_seller
price Preturl net al produselor ascendent sort=price
price.desc Pretul net al produselor descendent sort=price.desc
GET /api/v2/products?sort=name

Paginatie

Parametrii de paginatie pot fi adaugati request-ului API pentru a limita numarul de inregistrari pe pagina si a accesa toate paginile disponibile.

Parametru Tip Default
start int 0
limit int 20

Limita maxima de inregistrari pe pagina nu poate depasi valoarea 100.

GET /api/v2/products?start=150&limit=50 

Format request

Exemplu de request CURL care returneaza toate inregistrarile:

curl --request GET \
--url 'https://shop.demo.ro/api/v2/products' \
--header 'Accept: application/json' \
--header 'Content-type: application/json' \
--header 'Authorization: Basic {base64-encoded-credentials}'

Extrage toate inregistrarile, extrage toate campurile

Exemplu request

GET /api/v2/products
Exemplu raspuns
{
  "data": [
    {
      "id": 11,
      "type": "basic",
      "sku": null,
      "name": "Cotton Twill Shirt for men",
      "description": "<p>Rendered in feather-light cotton twill, this long-sleeved shirt from Ralph Lauren equips new season collections with comfortable breathability and an iconic profile.</p><p>Embroidered with the iconic Polo Pony logo on the chest, its slim point collar and button fastening combine to offer the label's signature preppy appeal.</p>",
      "meta_description": null,
      "inventory_enabled": "off",
      "category_id": 6,
      "category_name": "Shirts",
      "manufacturer_id": 1000005,
      "manufacturer_name": "Ralph Lauren",
      "price_net": 127.72,
      "price_gross": 127.72,
      "tax_id": 1,
      "tax_name": "VAT",
      "tax_value": 0,
      "url": "https://shop.demo.ro/shirts/cotton-twill-shirt-for-men",
      "date_created": "2019-01-29T16:43:35+02:00",
      "date_modified": "2020-03-01T20:55:51+02:00",
      "status": "active",
     "visibility": "visible",
      "is_listed": true,
      "in_stock": true,
      "total_sales": 0,
      "total_units_sold": 0,
      "total_views": 0
    },
    {
      "id": 12,
      "type": "basic",
      "sku": null,
      "name": "Striped Shirt",
      "description": "<p>A staple piece that cleverly merges statement with minimalist, this shirt from Polo Ralph Lauren is infused with nautical stripes that can be transformed from casual to formal depending on the occasion.</p><p>Embroidered with the signature Pony logo to the chest, the breezy cotton silhouette boasts a classic point collar and mother-of-pearl button fastenings to complement the cobalt tones.</p>",
      "meta_description": null,
      "inventory_enabled": "off",
      "category_id": 6,
      "category_name": "Shirts",
      "manufacturer_id": 1000005,
      "manufacturer_name": "Ralph Lauren",
      "price_net": 126.04,
      "price_gross": 126.04,
      "tax_id": 1,
      "tax_name": "VAT",
      "tax_value": 0,
      "url": "https://shop.demo.ro/shirts/striped-shirt",
      "date_created": "2019-01-29T16:43:35+02:00",
      "date_modified": "2020-03-01T20:55:51+02:00",
      "status": "active",
      "visibility": "visible",
      "is_listed": true,
      "in_stock": true,
      "total_sales": 0,
      "total_units_sold": 0,
      "total_views": 0
    },
    { ... }
  ],
  "meta": {
    "count": {
      "total": 2000,
      "current": 20,
      "start": 0,
      "limit": 20
    },
    "links": {
      "prev": null,
      "current": "/api/v2/products",
      "next": "/api/v2/products?start=20"
    }
  }
}

Extrage toate inregistrarile, filtreaza doar anumite campuri

Exemplu request

GET /api/v2/products?fields=id,name,url
Exemplu raspuns
{
  "data": [
    {
      "id": 11,
      "name": "Cotton Twill Shirt for men",
      "url": "https://shop.demo.ro/shirts/cotton-twill-shirt-for-men"
    },
    {
      "id": 12,
      "name": "Striped Shirt",
      "url": "https://shop.demo.ro/shirts/striped-shirt"
    },
    { ... }
  ],
  "meta": {
    "count": {
      "total": 2000,
      "current": 20,
      "start": 0,
      "limit": 20
    },
    "links": {
      "prev": null,
      "current": "/api/v2/products",
      "next": "/api/v2/products?start=20"
    }
  }
}

Extrage toate inregistrarile, include campuri suplimentare

Exemplu request

GET /api/v2/products?include=images
Exemplu raspuns
{
  "data": [
    {
      "id": 11,
      "type": "basic",
      "sku": null,
      "ean": null,
      "name": "Cotton Twill Shirt for men",
      "description": "<p>Rendered in feather-light cotton twill, this long-sleeved shirt from Ralph Lauren equips new season collections with comfortable breathability and an iconic profile.</p><p>Embroidered with the iconic Polo Pony logo on the chest, its slim point collar and button fastening combine to offer the label's signature preppy appeal.</p>",
      "meta_description": null,
      "inventory_enabled": "off",
      "category_id": 6,
      "category_name": "Camasi",
      "manufacturer_id": 1000005,
      "manufacturer_name": "Ralph Lauren",
      "price_net": 127.72,
      "price_gross": 151.99,
      "tax_id": 1,
      "tax_name": "TVA",
      "tax_value": 19,
      "url": "http://shop.demo.ro/shirts/cotton-twill-shirt-for-men",
      "images": [
        {
          "id": 43,
          "url": "https://s.cdnmpro.com/242394140/p/l/3/cotton-twill-shirt-for-men~43.jpg",
          "caption": null
        },
        {
          "id": 686,
          "url": "https://s.cdnmpro.com/242394140/p/l/6/cotton-twill-shirt-for-men~686.jpg",
          "caption": null
        },
        {
          "id": 687,
          "url": "https://s.cdnmpro.com/242394140/p/l/7/cotton-twill-shirt-for-men~687.jpg",
          "caption": null
        }
      ],
      "date_created": "2019-01-29T16:43:35+02:00",
      "date_modified": "2020-04-08T12:22:17+03:00",
      "status": "active",
      "visibility": "visible",
      "is_listed": true,
      "in_stock": true,
      "total_sales": 1,
      "total_units_sold": 1,
      "total_views": 0
    },
    {
      "id": 12,
      "type": "basic",
      "sku": null,
      "ean": null,
      "name": "Striped Shirt",
      "description": "<p>A staple piece that cleverly merges statement with minimalist, this shirt from Polo Ralph Lauren is infused with nautical stripes that can be transformed from casual to formal depending on the occasion.</p><p>Embroidered with the signature Pony logo to the chest, the breezy cotton silhouette boasts a classic point collar and mother-of-pearl button fastenings to complement the cobalt tones.</p>",
      "meta_description": null,
      "inventory_enabled": "off",
      "category_id": 6,
      "category_name": "Camasi",
      "manufacturer_id": 1000005,
      "manufacturer_name": "Ralph Lauren",
      "price_net": 126.04,
      "price_gross": 149.99,
      "tax_id": 1,
      "tax_name": "TVA",
      "tax_value": 19,
      "url": "http://shop.demo.ro/shirts/striped-shirt",
      "images": [
        {
          "id": 46,
          "url": "https://s.cdnmpro.com/242394140/p/l/6/striped-shirt~46.jpg",
          "caption": null
        },
        {
          "id": 693,
          "url": "https://s.cdnmpro.com/242394140/p/l/3/striped-shirt~693.jpg",
          "caption": null
        },
        {
          "id": 694,
          "url": "https://s.cdnmpro.com/242394140/p/l/4/striped-shirt~694.jpg",
          "caption": null
        }
      ],
      "date_created": "2019-01-29T16:43:35+02:00",
      "date_modified": "2020-04-08T12:22:17+03:00",
      "status": "active",
      "visibility": "visible",
      "is_listed": true,
      "in_stock": true,
      "total_sales": 5,
      "total_units_sold": 5,
      "total_views": 0
    },
    { ... }
  ],
  "meta": {
    "count": {
      "total": 2000,
      "current": 20,
      "start": 0,
      "limit": 20
    },
    "links": {
      "prev": null,
      "current": "/api/v2/products?include=images",
      "next": "/api/v2/products?include=images&amp;start=20"
    }
  }
}

Filtreaza inregistrarile pe baza de lista de ID-uri, filtreaza doar anumite campuri

Exemplu request

GET /api/v2/products?ids=101,102&fields=id,name
Exemplu raspuns
{
  "data": [
    {
      "id": 101,
      "name": "Cotton Twill Shirt for men"
     },
    {
      "id": 102,
      "name": "Striped Shirt"
    },
    { ... }
  ],
  "meta": {
    "count": {
      "total": 2,
      "current": 2,
      "start": 0,
      "limit": 20
    },
    "links": {
      "prev": null,
      "current": "/api/v2/products?ids=101,102&amp;fields=id,name",
      "next": null
    }
  }
}

Extragere date produs

Afiseaza datele unei singure inregistrari.

Tip: Resursa individuala
Verb: GET
Url: /api/v2/products/{id}
Filtrare rezultate: Nu
Selectie campuri: Da
Includere campuri suplimentare: Nu
Paginatie: Nu

Codul http de raspuns este 200 in caz de succes, raspunsul va avea forma unei resurse individuale aferente id-ului solicitat.

Poti filtra campurile pe care le doresti incluse in rezultat pentru fiecare resursa folosind parametrul ‘fields’ si mentionand in mod explicit doar campurile (separate prin virgula) pe care le doresti incluse (campul id va fi inclus intotdeauna in mod implicit)

GET /api/v2/products/{id}?fields=id,name,category_id 

Format request

Exemplu de request CURL care returneaza o inregistrare individuala:

curl --request GET \
--url 'https://shop.demo.ro/api/v2/products/30' \
--header 'Accept: application/json' \
--header 'Content-type: application/json' \
--header 'Authorization: Basic {base64-encoded-credentials}'

Extrage toate campurile

Exemplu request

GET /api/v2/products/30
Exemplu raspuns
{
  "id": 30,
  "type": "basic",
  "sku": null,
  "name": "Low Neckline Dress",
  "description": "<p>Boasting a deep neckline and gathering details, this dress from Roberto Cavalli is sure to make an impression. The sleeveless design can be worn during the day with tights and boots and elevated come evening with an embellished clutch bag and pointed heels.</p>",
  "meta_description": null,
  "inventory_enabled": "off",
  "category_id": 9,
  "category_name": "Dresses",
  "manufacturer_id": 1000010,
  "manufacturer_name": "Roberto Cavalli",
  "price_net": 515.96,
  "price_gross": 515.96,
  "tax_id": 1,
  "tax_name": "VAT",
  "tax_value": 0,
  "url": "https://shop.demo.ro/dresses/low-neckline-dress",
  "meta_links": [
    {
      "lang": "en_US",
      "url": "https://shop.demo.ro/dresses/low-neckline-dress"
    }
  ],
  "images": [
    {
      "id": 100,
      "url": "https://cdn1.shopmania.biz/files/s15/936942325/p/l/0/100.jpg",
      "caption": null
    },
    {
      "id": 822,
      "url": "https://cdn1.shopmania.biz/files/s15/936942325/p/l/2/822.jpg",
      "caption": null
    }
  ],
  "product_attributes": [
    {
      "id": 5,
      "name": "Colour",
      "options": [
        "id": 5,
        "name": "Purple",
      ]
    },
    {
      "id": 6,
      "name": "Occasion",
      "options": [
        "id": 15,
        "name": "Party",
      ]
    }
  ],
  "date_created": "2019-01-29T16:43:36+02:00",
  "date_modified": "2020-03-01T20:55:51+02:00",
  "status": "active",
  "visibility": "visible",
  "is_listed": true,
  "in_stock": true,
  "total_sales": 0,
  "total_units_sold": 0,
  "total_views": 0
}

Filtreaza doar anumite campuri

Exemplu request

GET /api/v2/products/101?fields=id,name,url
Exemplu raspuns
{
  "id": 101,
  "name": "Low Neckline Dress",
  "url": "https://shop.demo.ro/dresses/low-neckline-dress"
}

Adaugare produs

Permite adaugarea unei noi inregistrari.

Tip: Creare resursa
Verb: POST
Url: /api/v2/products

Codul http de raspuns este 200 in caz de succes, raspunsul va avea forma unei resurse individuale reprezentand inregistrarea care tocmai a fost adaugata.

Format request

Exemplu de request CURL care creeaza un produs nou de tip basic:

curl --request POST \
--url 'https://shop.demo.ro/api/v2/products' \
--header 'Accept: application/json' \
--header 'Content-type: application/json' \
--header 'Authorization: Basic {base64-encoded-credentials}' \
--data-raw '{
  "type": "basic",
  "name": "Leather Cardholder Wallet",
  "description": "A classic bi-fold wallet, perfect for everyday use",
  "category_id": 22,
  "price_gross": 89
}'

Exemplu de request CURL care creeaza un produs nou de tip multi_variant:

curl --request POST \
--url 'https://shop.demo.ro/api/v2/products' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {base64-encoded-credentials}' \
--data-raw '{
  "type": "multi_variant",
  "name": "Leather biker jacket",
  "description": "We\u0027ve fused traditional bomber jackets with classic elements from biker styles.",
  "category_id": 10,
  "manufacturer_id": 1000014,
  "product_attributes": [
    {
      "name": "Material",
      "options": [
        {
          "value": "Leather"
        },
        {
          "value": "Faux leather"
        }
      ]
    },
    {
      "name": "Sleeve size",
      "options": [
        {
          "value": "Small"
        },
        {
          "value": "Medium"
        },
        {
          "value": "Large"
        }
      ]
    }
  ],
  "variant_attributes": [
    {
      "name": "Size",
      "options": [
        {
          "value": "S"
        },
        {
          "value": "M"
        },
        {
          "value": "L"
        }
      ]
    }
  ],
  "variants": [
    {
      "inventory_enabled": "off",
      "price_gross": 457,
      "variant_options": [
        {
          "name": "Size",
          "value": "M"
        }
      ]
    }
  ],
  "images": [
    {
      "caption": "Front side",
      "default": true,
      "base64": "/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAAyADIDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD8q6KKK+PP9CAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigD/2Q=="
    }
  ]
}'

Adaugare produs de tip basic

Exemplu request

POST /api/v2/products
{
  "type": "basic",
  "name": "Leather Cardholder Wallet",
  "description": "A classic bi-fold wallet, perfect for everyday use",
  "category_id": 22,
  "price_gross": 89,
  "stock": 10
}
Exemplu raspuns
{
  "id": 17838,
  "type": "basic",
  "sku": null,
  "ean": null,
  "ext_ref": null,
  "name": "Leather Cardholder Wallet",
  "description": "A classic bi-fold wallet, perfect for everyday use",
  "meta_description": null,
  "inventory_enabled": "off",
  "category_id": 22,
  "category_name": "Wallets",
  "categories": [
    {
      "id": 22,
      "name": "Wallets"
    }
  ],
  "manufacturer_id": 0,
  "manufacturer_name": null,
  "price_net": 80.91,
  "price_gross": 89,
  "tax_id": 3,
  "tax_name": "taxa 10",
  "tax_value": 10,
  "quantity_multiplier": 1,
  "unit_id": 0,
  "shipping_unit_cost": 0,
  "weight": null,
  "url": "http://shop.demo.ro/leather-cardholder-wallet-17838",
  "meta_links": [
    {
      "lang": "ro_RO",
      "url": "http://shop.demo.ro/cumpara/leather-cardholder-wallet-17838"
    },
    {
      "lang": "de_DE",
      "url": "http://shop.demo.ro/de/cumpara/leather-cardholder-wallet-17838"
    },
    {
      "lang": "en_GB",
      "url": "http://shop.demo.ro/buy/leather-cardholder-wallet-17838"
    },
    {
      "lang": "fr_FR",
      "url": "http://shop.demo.ro/acheter/leather-cardholder-wallet-17838"
    },
    {
      "lang": "it_IT",
      "url": "http://shop.demo.ro/compra/leather-cardholder-wallet-17838"
    },
    {
      "lang": "hu_HU",
      "url": "http://shop.demo.ro/hu/cumpara/leather-cardholder-wallet-17838"
    }
  ],
  "images": [],
  "date_created": "2020-04-30T13:30:51+03:00",
  "date_modified": "2020-04-30T13:30:51+03:00",
  "status": "active",
  "visibility": "visible",
  "is_listed": true,
  "in_stock": true,
  "total_sales": 0,
  "total_units_sold": 0,
  "total_views": 0
}

Adaugare produs de tip multi-variant

Exemplu request

POST /api/v2/products
{
  "type": "multi_variant",
  "name": "Leather biker jacket",
  "description": "We\u0027ve fused traditional bomber jackets with classic elements from biker styles.",
  "category_id": 10,
  "manufacturer_id": 1000014,
  "product_attributes": [
    {
      "name": "Material",
      "options": [
        {
          "value": "Leather"
        },
        {
          "value": "Faux leather"
        }
      ]
    },
    {
      "name": "Sleeve size",
      "options": [
        {
          "value": "Small"
        },
        {
          "value": "Medium"
        },
        {
          "value": "Large"
        }
      ]
    }
  ],
  "variant_attributes": [
    {
      "name": "Size",
      "options": [
        {
          "value": "S"
        },
        {
          "value": "M"
        },
        {
          "value": "L"
        }
      ]
    }
  ],
  "variants": [
    {
      "inventory_enabled": "off",
      "price_gross": 457,
      "variant_options": [
        {
          "name": "Size",
          "value": "M"
        }
      ]
    }
  ],
  "images": [
    {
      "caption": "Front side",
      "default": true,
      "base64": "/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAAyADIDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD8q6KKK+PP9CAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigD/2Q=="
    }
  ]
}
Exemplu raspuns
{
  "id": 620,
  "type": "multi_variant",
  "sku": null,
  "name": "Leather biker jacket",
  "description": "We've fused traditional bomber jackets with classic elements from biker styles.",
  "meta_description": null,
  "inventory_enabled": "on",
  "stock": 0,
  "stock_value": 0,
  "category_id": 10,
  "category_name": "Coats &amp; Jackets",
  "manufacturer_id": 1000014,
  "manufacturer_name": "Dolce &amp; Gabbana",
  "price_net": 457,
  "price_gross": 457,
  "tax_id": 0,
  "tax_value": null,
  "url": "https://shop.demo.ro/coats-jackets/leather-biker-jacket",
  "meta_links": [
    {
      "lang": "en_US",
      "url": "https://shop.demo.ro/coats-jackets/leather-biker-jacket"
    }
  ],
  "images": [
    {
      "id": 2051,
      "url": "https://cdn1.shopmania.biz/files/s15/936942325/p/l/1/2051.jpg",
      "caption": "Front side"
    }
  ],
  "product_attributes": [
  {
      "id": 8,
      "name": "Material",
      "options": [
        {
          "value": "Leather"
        },
        {
          "value": "Faux leather"
        }
      ]
    },
    {
      "id": 9,
      "name": "Sleeve size",
      "options": [
        {
          "value": "Small"
        },
        {
          "value": "Medium"
        },
        {
          "value": "Large"
        }
      ]
    }
  ],
  "variant_attributes": [
    {
      "id": 4,
      "name": "Size",
      "options": [
        {
          "value": "S"
        },
        {
          "value": "M"
        },
        {
          "value": "L"
        }
      ]
    }
  ],
  "variants": [
    {
      "id": 10000001,
      "sku": null,
      "inventory_enabled": "off",
      "price_net": 457,
      "price_gross": 457,
      "variant_options": [
        {
          "id": 4,
          "name": "Size",
          "value": "M"
        }
      ],
      "visibility": "visible"
    }
  ],
  "date_created": "2020-03-04T16:19:02+02:00",
  "date_modified": "2020-03-04T16:19:03+02:00",
  "status": "active",
  "visibility": "visible",
  "is_listed": true,
  "in_stock": true,
  "total_sales": 0,
  "total_units_sold": 0,
  "total_views": 0
}

Modificare date produs

Permite actualizarea unei inregistrari existente pe baza de ID.

Tip: Actualizare resursa
Verb: PATCH
Url: /api/v2/products/{id}

Codul http de raspuns este 200 in caz de succes, raspunsul va avea forma unei resurse individuale reprezentand inregistrarea care tocmai a fost actualizata.

Format request

Exemplu de request CURL care actualizeaza o inregistrare existenta:

curl --request PATCH \
--url 'https://shop.demo.ro/api/v2/products/619' \
--header 'Accept: application/json' \
--header 'Content-type: application/json' \
--header 'Authorization: Basic {base64-encoded-credentials}' \
--data-raw '{
  "price_gross": 59,
  "old_price_gross": 89,
  "stock": 250
}'

Actualizare date produs

Exemplu request

PATCH /api/v2/products/17838
{
  "price_gross": 59,
  "old_price_gross": 89
}
Exemplu raspuns
{
  "id": 17838,
  "type": "basic",
  "sku": null,
  "ean": null,
  "ext_ref": null,
  "name": "Leather Cardholder Wallet",
  "description": "A classic bi-fold wallet, perfect for everyday use",
  "meta_description": null,
  "inventory_enabled": "off",
  "category_id": 22,
  "category_name": "Wallets",
  "categories": [
    {
      "id": 22,
      "name": "Wallets"
    }
  ],
  "manufacturer_id": 0,
  "manufacturer_name": null,
  "price_net": 53.64,
  "price_gross": 59,
  "old_price_net": 80.91,
  "old_price_gross": 89,
  "tax_id": 3,
  "tax_name": "taxa 10",
  "tax_value": 10,
  "quantity_multiplier": 1,
  "unit_id": 0,
  "shipping_unit_cost": 0,
  "weight": null,
  "url": "http://shop.demo.ro/leather-cardholder-wallet-17838",
  "meta_links": [
    {
      "lang": "ro_RO",
      "url": "http://shop.demo.ro/cumpara/leather-cardholder-wallet-17838"
    },
    {
      "lang": "de_DE",
      "url": "http://shop.demo.ro/de/cumpara/leather-cardholder-wallet-17838"
    },
    {
      "lang": "en_GB",
      "url": "http://shop.demo.ro/buy/leather-cardholder-wallet-17838"
    },
    {
      "lang": "fr_FR",
      "url": "http://shop.demo.ro/acheter/leather-cardholder-wallet-17838"
    },
    {
      "lang": "it_IT",
      "url": "http://shop.demo.ro/compra/leather-cardholder-wallet-17838"
    },
    {
      "lang": "hu_HU",
      "url": "http://shop.demo.ro/hu/cumpara/leather-cardholder-wallet-17838"
    }
  ],
  "images": [],
  "product_attributes": [],
  "variant_attributes": [],
  "date_created": "2020-04-30T13:30:51+03:00",
  "date_modified": "2020-04-30T13:30:51+03:00",
  "status": "active",
  "visibility": "visible",
  "is_listed": true,
  "in_stock": true,
  "total_sales": 0,
  "total_units_sold": 0,
  "total_views": 0
}

Schimbare status produs

Exemplu request

PATCH /api/v2/products/101
{
  "status": "inactive"
}
Exemplu raspuns
{
  "id": 17838,
  "type": "basic",
  "sku": null,
  "ean": null,
  "ext_ref": null,
  "name": "Leather Cardholder Wallet",
  "description": "A classic bi-fold wallet, perfect for everyday use",
  "meta_description": null,
  "inventory_enabled": "off",
  "category_id": 22,
  "category_name": "Wallets",
  "categories": [
    {
      "id": 22,
      "name": "Wallets"
    }
  ],
  "manufacturer_id": 0,
  "manufacturer_name": null,
  "price_net": 53.64,
  "price_gross": 59,
  "old_price_net": 80.91,
  "old_price_gross": 89,
  "tax_id": 3,
  "tax_name": "taxa 10",
  "tax_value": 10,
  "quantity_multiplier": 1,
  "unit_id": 0,
  "shipping_unit_cost": 0,
  "weight": null,
  "url": "http://shop.demo.ro/cumpara/leather-cardholder-wallet-17838",
  "meta_links": [
    {
      "lang": "ro_RO",
      "url": "http://shop.demo.ro/cumpara/leather-cardholder-wallet-17838"
    },
    {
      "lang": "de_DE",
      "url": "http://shop.demo.ro/de/cumpara/leather-cardholder-wallet-17838"
    },
    {
      "lang": "en_GB",
      "url": "http://shop.demo.ro/buy/leather-cardholder-wallet-17838"
    },
    {
      "lang": "fr_FR",
      "url": "http://shop.demo.ro/acheter/leather-cardholder-wallet-17838"
    },
    {
      "lang": "it_IT",
      "url": "http://shop.demo.ro/compra/leather-cardholder-wallet-17838"
    },
    {
      "lang": "hu_HU",
      "url": "http://shop.demo.ro/hu/cumpara/leather-cardholder-wallet-17838"
    }
  ],
  "images": [],
  "product_attributes": [],
  "variant_attributes": [],
  "date_created": "2020-04-30T13:30:51+03:00",
  "date_modified": "2020-04-30T13:30:51+03:00",
  "status": "inactive",
  "visibility": "visible",
  "is_listed": false,
  "in_stock": true,
  "total_sales": 0,
  "total_units_sold": 0,
  "total_views": 0
}

Schimbare variante produs

Exemplu request

PATCH /api/v2/products/101
{
  "variant_attributes": [
    {
      "name": "Color",
      "options": [
        {
          "value": "White"
        },
        {
          "value": "Blue"
        }
      ]
    }
  ],
  "variants": [
    {
      "price_net": 457,
      "price_gross": 457,
      "variant_options": [
        {
          "name": "Color",
          "value": "Blue"
        }
      ]
    }
  ]
}
Exemplu raspuns
{
  "id": 630,
  "type": "multi_variant",
  "sku": null,
  "ean": null,
  "name": "Leather biker jacket",
  "description": "We've fused traditional bomber jackets with classic elements from biker styles.",
  "meta_description": null,
  "inventory_enabled": "on",
  "stock": 0,
  "category_id": 10,
  "category_name": "Jackets",
  "categories": [
    {
      "id": 10,
      "name": "Jackets"
    }
  ],
  "manufacturer_id": 1000014,
  "manufacturer_name": "Dolce &amp; Gabbana",
  "price_net": 457,
  "price_gross": 457,
  "tax_id": 0,
  "tax_value": null,
  "url": "http://shop.demo.ro//cumpara/leather-biker-jacket-630",
  "meta_links": [
    {
      "lang": "ro_RO",
      "url": "http://shop.demo.ro//cumpara/leather-biker-jacket-630"
    },
    {
      "lang": "en_GB",
      "url": "http://shop.demo.ro//en/cumpara/leather-biker-jacket-630"
    },
    {
      "lang": "es_ES",
      "url": "http://shop.demo.ro//es/cumpara/leather-biker-jacket-630"
    }
  ],
  "images": [
    {
      "id": 2057,
      "url": "https://s.cdnmpro.com/242394140/p/l/5/narn-quilted-funnel-neck-jacket~205.jpg",
      "caption": "Front side"
    }
  ],
  "product_attributes": [
    {
      "id": 15,
      "name": "Sleeve size",
      "options": [
        {
          "id": 108,
          "value": "Small"
        },
        {
          "id": 109,
          "value": "Medium"
        },
        {
           "id": 110,
           "value": "Large"
        }
      ]
    },
    {
      "id": 3,
      "name": "Material",
      "options": [
        {
          "id": 106,
          "value": "Leather"
        },
        {
          "id": 107,
          "value": "Faux leather"
        }
      ]
   }
  ],
  "variant_attributes": [
    {
      "id": 17
      "name": "Color",
      "options": [
        {
          "id": 114,
          "value": "White"
        },
        {
          "id": 115,
          "value": "Blue"
        }
      ]
    }
  ],
  "variants": [
    {
      "id": 10000112,
      "sku": null,
      "inventory_enabled": "off",
      "price_net": 457,
      "price_gross": 457,
      "variant_options": [
        {
          "id": 17,
          "name": "Color",
          "value": "Blue"
        }
      ]
    }
  ],
  "date_created": "2020-04-30T13:27:37+03:00",
  "date_modified": "2020-04-30T14:10:42+03:00",
  "status": "active",
  "visibility": "visible",
  "is_listed": true,
  "in_stock": true,
  "total_sales": 0,
  "total_units_sold": 0,
  "total_views": 0
}

Stergere produs

Permite stergerea unei inregistrari existente pe baza de ID.

Tip: Stergere resursa
Verb: DELETE
Url: /api/v2/products/{id}

Codul http de raspuns este 200 in caz de succes.

Format request

Exemplu de request CURL care sterge o inregistrare existenta:

curl --request DELETE \
--url 'https://shop.demo.ro/api/v2/products/619' \
--header 'Accept: application/json' \
--header 'Content-type: application/json' \
--header 'Authorization: Basic {base64-encoded-credentials}'
Exemplu raspuns
{
  "ok": true
}
Ultima modificare: 20 Dec 2023
Te-a ajutat acest articol?
Mai ai nevoie si de alte informatii?
Confidentialitate
Utilizam cookie-uri pentru a-ti oferi serviciile si pentru a-ti optimiza experienta. Navigand in continuare, iti exprimi acordul cu privire la Politica de Cookies.