Ü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,
"name": "Test Ürün",
"code": "URN001",
"barcode": "1234567890",
"product_type": "good",
"description": "Test ürün açıklaması",
"price": 100.0,
"price_currency": "TRY",
"vat_rate": 20,
"quantity": 50
}
]
}
Yanıt Alanları
Alan | Tip | Açıklama |
---|---|---|
id | integer | Ürün ID |
name | string | Ürün adı |
code | string | Ürün kodu |
barcode | string | Barkod |
product_type | string | Ürün tipi |
description | string | Açıklama |
price | number | Fiyat |
price_currency | string | Para birimi |
vat_rate | integer | KDV oranı |
quantity | number | Stok miktarı |