Ürün/Hizmet Listeleme
Şirketinize ait tüm ürün/hizmet kayıtlarını listeleme ve filtreleme.
Endpoint
GET /kolaybi/v1/products
Parametreler
| Parametre | Tip | Açıklama |
|---|---|---|
barcode | string | Ürün barkodu ile filtreleme |
code | string | Ürün kodu ile filtreleme |
name | string | Ürün adı ile filtreleme |
type | ProductType | Ürün tipi ile filtreleme |
group | string | Ürün grubu ile filtreleme |
full_text_search | string | Genel arama |
Örnekler
- cURL
- JavaScript
- PHP
- Python
- C#
# Tüm ürünler
curl -X GET "https://ofis-sandbox-api.kolaybi.com/kolaybi/v1/products" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Channel: YOUR_CHANNEL"
# Mal tipi ürünler
curl -X GET "https://ofis-sandbox-api.kolaybi.com/kolaybi/v1/products?type=good" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Channel: YOUR_CHANNEL"
async function listProducts(filters = {}) {
const params = new URLSearchParams(filters);
const response = await fetch(
`https://ofis-sandbox-api.kolaybi.com/kolaybi/v1/products?${params}`,
{
headers: {
Authorization: `Bearer ${accessToken}`,
Channel: channel,
},
}
);
return await response.json();
}
// Kullanım
const products = await listProducts({ type: "good" });
const byCode = await listProducts({ code: "URN001" });
function listProducts($filters = []) {
$url = 'https://ofis-sandbox-api.kolaybi.com/kolaybi/v1/products';
if (!empty($filters)) {
$url .= '?' . http_build_query($filters);
}
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => $url,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $accessToken,
'Channel: ' . $channel
],
CURLOPT_RETURNTRANSFER => true
]);
$response = curl_exec($ch);
curl_close($ch);
return json_decode($response, true);
}
import requests
def list_products(filters=None):
url = "https://ofis-sandbox-api.kolaybi.com/kolaybi/v1/products"
headers = {
"Authorization": f"Bearer {access_token}",
"Channel": channel
}
response = requests.get(url, headers=headers, params=filters)
return response.json()
# Kullanım
products = list_products({"type": "good"})
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Newtonsoft.Json;
async Task<dynamic> ListProductsAsync(Dictionary<string, string> filters = null)
{
using var client = new HttpClient();
var url = "https://ofis-sandbox-api.kolaybi.com/kolaybi/v1/products";
if (filters != null && filters.Count > 0)
{
var query = await new FormUrlEncodedContent(filters).ReadAsStringAsync();
url += "?" + query;
}
var request = new HttpRequestMessage(HttpMethod.Get, url);
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
request.Headers.Add("Channel", channel);
var response = await client.SendAsync(request);
var content = await response.Content.ReadAsStringAsync();
return JsonConvert.DeserializeObject<dynamic>(content);
}
// Kullanım
var products = await ListProductsAsync(new Dictionary<string, string> { { "type", "good" } });
Yanıt
- Başarılı Yanıt
{
"data": [
{
"id": 1,
"product_type": "good",
"name": "Test Ürün",
"code": "URN001",
"vat_type": "PERCENTAGE",
"vat_value": 20,
"barcode": "1234567890",
"description": "Test ürün açıklaması",
"discount_type": "PERCENTAGE",
"discount_value": 5,
"stock_unit": 1,
"stock_multiplier": 1,
"purchase_unit": 1,
"purchase_stock_multiplier": 1,
"purchase_unit_description": "kutu",
"purchase_price": 80,
"purchase_currency": "try",
"sale_unit": 1,
"sale_stock_multiplier": 1,
"sale_unit_description": "adet",
"sale_price": 100,
"sale_currency": "try",
"total_stock_quantity": 50,
"tags": [
{
"id": 12,
"name": "e-ticaret"
}
]
}
]
}
Yanıt Alanları
| Alan | Tip | Açıklama |
|---|---|---|
id | integer | Ürün ID |
product_type | string | good / service |
name | string | Ürün adı |
code | string | Ürün kodu |
vat_type | string | PERCENTAGE veya NUMERIC |
vat_value | number | KDV oranı |
barcode | string | Barkod |
description | string | Ürün açıklaması |
discount_type | string | İndirim tipi |
discount_value | number | İndirim değeri |
stock_unit | number | Stok birimi |
stock_multiplier | number | Stok birim çarpanı |
purchase_unit | number | Alış birimi |
purchase_stock_multiplier | number | Alış birim çarpanı |
purchase_unit_description | number | Alış birim açıklaması |
purchase_price | number | Alış fiyatı |
purchase_currency | number | Alış para birimi |
sale_unit | number | Satış birimi |
sale_stock_multiplier | number | Satış birim çarpanı |
sale_unit_description | number | Satış birim açıklaması |
sale_price | number | Satış fiyatı |
sale_currency | number | Satış para birimi |
total_stock_quantity | number | Toplam stok miktarı (negatif olabilir) |
tags | array | Ürün etiketleri |
Etiket Alanları (tags)
| Alan | Tip | Açıklama |
|---|---|---|
id | integer | Etiket ID değeri |
name | string | Etiket adı |
description | string | Etiket açıklaması (varsa) |