Ürün yönetimi ile ilgili tüm işlemler için kullanılır.
Ürün ekleme süreci şeması:
Ürün Arama
Eklenmiş tüm ürünler arasında filtreleme ile arama yapmak için kullanılır.
Örnekler
Curl ile istek atmak için bu örnek kullanılabilir.
curl -X GET \ 'https://api.allesgo.com/v1.0/product/search?access_token={ACCESS_TOKEN}&type={PRODUCT_TYPE}&search_key={SEARCH_KEY}' \ -H 'Accept: application/json' \ -H 'Cache-Control: no-cache' \ -H 'Connection: keep-alive' \ -H 'Host: api.allesgo.com' \ -H 'cache-control: no-cache'
PHP ile istek atmak için bu örnek kullanılabilir. Örnekte Curl kullanılmaktadır.
<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.allesgo.com/v1.0/product/search?access_token={ACCESS_TOKEN}&type={PRODUCT_TYPE}&search_key={SEARCH_KEY}", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => array( "Accept: application/json", "Cache-Control: no-cache", "Connection: keep-alive", "Host: api.allesgo.com", "cache-control: no-cache", ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }
Python ile istek atmak için bu örnek kullanılabilir. Bu örnekte Python'un requests kütüphanesi kullanılır ama http.client gibi kütüphane kullanılabilir
import requests url = "https://api.allesgo.com/v1.0/product/search" querystring = {"access_token":"{{ACCESS_TOKEN}}", "type": "{{PRODUCT_TYPE}}", "search_key": "{{SEARCH_KEY}}"} headers = { 'Accept': "application/json", 'Cache-Control': "no-cache", 'Host': "api.allesgo.com", 'Connection': "keep-alive", 'cache-control': "no-cache" } response = requests.request("GET", url, headers=headers, params=querystring) print(response.text)
Node.js ile istek atmak için bu örnek kullanılabilir. Örnekte request kullanılmaktadır.
var request = require('request'); var options = { method: 'GET', url: 'https://api.allesgo.com/v1.0/product/search', qs: { access_token: '{ACCESS_TOKEN}', type: '{PRODUCT_TYPE}', search_key: '{SEARCH_KEY}' }, headers: { 'cache-control': 'no-cache', Connection: 'keep-alive', Host: 'api.allesgo.com', Accept: 'application/json', }, }; request(options, (error, response, body) => { if (error) throw new Error(error); console.log(body); });
Javascipt ile istek atmak için bu örnek kullanılabilir. Örnekte xhr kullanılmakdır. Not: Bilgi amaçlıdır. Javascipt ile yazılan bu kod'ta Kullanıcı access token'a erişebildiğinden, kullanmanızı önermiyoruz.
var data = null; var xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener('readystatechange', function () { if (this.readyState === 4) { console.log(this.responseText); } }); xhr.open('GET', 'https://api.allesgo.com/v1.0/product/search?access_token={ACCESS_TOKEN}&type={PRODUCT_TYPE}&search_key={SEARCH_KEY}'); xhr.setRequestHeader('Accept', 'application/json'); xhr.setRequestHeader('Cache-Control', 'no-cache'); xhr.setRequestHeader('Host', 'api.allesgo.com'); xhr.setRequestHeader('Connection', 'keep-alive'); xhr.setRequestHeader('cache-control', 'no-cache'); xhr.send(data);
C Sharp ile istek atmak için bu örnek kullanılabilir. Bu örnekte RestSharp kullanılmaktadır.
var client = new RestClient("https://api.allesgo.com/v1.0/product/search?access_token={ACCESS_TOKEN}&type={PRODUCT_TYPE}&search_key={SEARCH_KEY}"); var request = new RestRequest(Method.GET); request.AddHeader("cache-control", "no-cache"); request.AddHeader("Connection", "keep-alive"); request.AddHeader("Host", "api.allesgo.com"); request.AddHeader("Cache-Control", "no-cache"); request.AddHeader("Accept", "application/json"); IRestResponse response = client.Execute(request);
Java ile istek atmak için bu örnek kullanılabilir. Örnekte Ok Http kullanılmaktadır.
OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://api.allesgo.com/v1.0/product/search?access_token={ACCESS_TOKEN}&type={PRODUCT_TYPE}&search_key={SEARCH_KEY}") .get() .addHeader("Accept", "application/json") .addHeader("Cache-Control", "no-cache") .addHeader("Host", "api.allesgo.com") .addHeader("Connection", "keep-alive") .addHeader("cache-control", "no-cache") .build(); Response response = client.newCall(request).execute();
Go ile istek atmak için bu örnek kullanılabilir. Örnekte net/http kullanılmaktadır.
package main import ( "fmt" "net/http" "io/ioutil" ) func main() { url := "https://api.allesgo.com/v1.0/category/product/search?access_token={ACCESS_TOKEN}&type={PRODUCT_TYPE}&search_key={SEARCH_KEY}" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Accept", "*/*") req.Header.Add("Cache-Control", "no-cache") req.Header.Add("Host", "api.allesgo.com") req.Header.Add("Connection", "keep-alive") req.Header.Add("cache-control", "no-cache") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) }
API Referansı
Request query strings
Parametre | Türkçe | Tür | Zorunlu | Geçerli Değerler | Varsayılan | Açıklama |
---|---|---|---|---|---|---|
limit | Limit | Integer | false | 20 | Limit (max: 50) | |
page | Sayfa | Integer | false | 1 | Ürünler sayfa sayısına göre listelenir. | |
type | Ürün Türü | String | true | b2c, c2c | Ürün Türü | |
search_key | Anahtar Kelimesi | String | true | Anahtar Kelimesi |
Sunucudan dönecek cevabın örneği.
{
"data": {
"total": "Integer",
"result": [
{
"id": "ObjectId",
"title": "String",
"subtitle": "String",
"product_code": "String",
"store_name": "String",
"category_id": "ObjectId",
"category_name": "String",
"brand_id": "ObjectId",
"brand_name": "String",
"warranty": "String",
"warranty_time": "String",
"warranty_type": "Number",
"warranty_period": "Number",
"stock": "Integer",
"sid": "Integer",
"description": "String",
"item_type": "String",
"properties": "Array<{property: String, property_id: ObjectId, option: String, option_id: ObjectId}>",
"variants": "Array<{Variant}>",
"currency": "String",
"url": "String",
"price": "Number",
"has_discount": "Boolean",
"discount_amount": "Number",
"paid_price": "Number",
"shipping_price": "Number",
"images": "Array"
}
]
}
}
Ürünleri Filtreleme
Belirtilen mağazaya eklenmiş ürünler arasında belirlediğiniz kritere göre arama yapmak için kullanılır.
Örnekler
Curl ile istek atmak için bu örnek kullanılabilir.
curl -X GET \ 'https://api.allesgo.com/v1.0/product/store/{STORE_ID}?access_token={ACCESS_TOKEN}' \ -H 'Accept: application/json' \ -H 'Cache-Control: no-cache' \ -H 'Connection: keep-alive' \ -H 'Host: api.allesgo.com' \ -H 'cache-control: no-cache'
PHP ile istek atmak için bu örnek kullanılabilir. Örnekte Curl kullanılmaktadır.
<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.allesgo.com/v1.0/product/store/{STORE_ID}?access_token={ACCESS_TOKEN}", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => array( "Accept: application/json", "Cache-Control: no-cache", "Connection: keep-alive", "Host: api.allesgo.com", "cache-control: no-cache", ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }
Python ile istek atmak için bu örnek kullanılabilir. Bu örnekte Python'un requests kütüphanesi kullanılır ama http.client gibi kütüphane kullanılabilir
import requests url = "https://api.allesgo.com/v1.0/product/store/{{STORE_ID}}" querystring = {"access_token":"{{ACCESS_TOKEN}}"} headers = { 'Accept': "application/json", 'Cache-Control': "no-cache", 'Host': "api.allesgo.com", 'Connection': "keep-alive", 'cache-control': "no-cache" } response = requests.request("GET", url, headers=headers, params=querystring) print(response.text)
Node.js ile istek atmak için bu örnek kullanılabilir. Örnekte request kullanılmaktadır.
var request = require('request'); var options = { method: 'GET', url: 'https://api.allesgo.com/v1.0/product/store/{STORE_ID}', qs: { access_token: '{ACCESS_TOKEN}' }, headers: { 'cache-control': 'no-cache', Connection: 'keep-alive', Host: 'api.allesgo.com', Accept: 'application/json', }, }; request(options, (error, response, body) => { if (error) throw new Error(error); console.log(body); });
Javascipt ile istek atmak için bu örnek kullanılabilir. Örnekte xhr kullanılmakdır. Not: Bilgi amaçlıdır. Javascipt ile yazılan bu kod'ta Kullanıcı access token'a erişebildiğinden, kullanmanızı önermiyoruz.
var data = null; var xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener('readystatechange', function () { if (this.readyState === 4) { console.log(this.responseText); } }); xhr.open('GET', 'https://api.allesgo.com/v1.0/product/store/{STORE_ID}?access_token={ACCESS_TOKEN}'); xhr.setRequestHeader('Accept', 'application/json'); xhr.setRequestHeader('Cache-Control', 'no-cache'); xhr.setRequestHeader('Host', 'api.allesgo.com'); xhr.setRequestHeader('Connection', 'keep-alive'); xhr.setRequestHeader('cache-control', 'no-cache'); xhr.send(data);
C Sharp ile istek atmak için bu örnek kullanılabilir. Bu örnekte RestSharp kullanılmaktadır.
var client = new RestClient("https://api.allesgo.com/v1.0/product/store/{STORE_ID}?access_token={ACCESS_TOKEN}"); var request = new RestRequest(Method.GET); request.AddHeader("cache-control", "no-cache"); request.AddHeader("Connection", "keep-alive"); request.AddHeader("Host", "api.allesgo.com"); request.AddHeader("Cache-Control", "no-cache"); request.AddHeader("Accept", "application/json"); IRestResponse response = client.Execute(request);
Java ile istek atmak için bu örnek kullanılabilir. Örnekte Ok Http kullanılmaktadır.
OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://api.allesgo.com/v1.0/product/store/{STORE_ID}?access_token={ACCESS_TOKEN}") .get() .addHeader("Accept", "application/json") .addHeader("Cache-Control", "no-cache") .addHeader("Host", "api.allesgo.com") .addHeader("Connection", "keep-alive") .addHeader("cache-control", "no-cache") .build(); Response response = client.newCall(request).execute();
Go ile istek atmak için bu örnek kullanılabilir. Örnekte net/http kullanılmaktadır.
package main import ( "fmt" "net/http" "io/ioutil" ) func main() { url := "https://api.allesgo.com/v1.0/product/store/{STORE_ID}?access_token={ACCESS_TOKEN}" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Accept", "*/*") req.Header.Add("Cache-Control", "no-cache") req.Header.Add("Host", "api.allesgo.com") req.Header.Add("Connection", "keep-alive") req.Header.Add("cache-control", "no-cache") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) }
API Referansı
Request query strings
Parametre | Türkçe | Tür | Zorunlu | Geçerli Değerler | Varsayılan | Açıklama |
---|---|---|---|---|---|---|
limit | Limit | Integer | false | 20 | Limit (max: 50) | |
page | Sayfa | Integer | false | 1 | Ürünler sayfa sayısına göre listelenir. | |
start_date | Başlangıç Tarihi | Integer | false | Belirlenen tarihten sonra eklenmiş tüm ürünler listelenir. Format: UnixTimeStamp . | ||
end_date | Bitiş Tarihi | Integer | false | Belirlenen tarihten önce eklenmiş tüm ürünler listelenir. Format: UnixTimeStamp | ||
sort_by_date | Tarihe Göre Sırala | String | false | ascending, descending | descending | Ürünler eklenme sırasına göre listelenir. |
ids | Ürün Id'leri | ObjectId | false | Ürünleri ID numarasına göre getirirsiniz. Birden fazla ID ile arama yapılacaksa aralara virgül koymayı unutmayın | ||
product_code | Ürün Kodu | String | false | Ürünleri kod numaralarına göre listelersiniz. | ||
title | Ürün Başlığı | String | false | Belirlediğiniz ürün başlığına göre listeleyebilirsiniz. | ||
status | Ürün Durumu | String | false | approved, passive, veto | approved | Belirlediğiniz durumda olan tüm ürünleri listeleyebilirsiniz |
Request URL parameters
Parametre | Türkçe | Tür | Zorunlu | Geçerli Değerler | Varsayılan | Açıklama |
---|---|---|---|---|---|---|
storeId | Mağaza ID'si | ObjectId | true | Mağaza ID'si |
Sunucudan dönecek cevabın örneği.
{
"data": {
"total": "Integer",
"result": [
{
"id": "ObjectId",
"title": "String",
"subtitle": "String",
"product_code": "String",
"category_name": "String",
"stock": "Integer",
"brand_id": "ObjectId",
"brand_name": "String",
"warranty": "String",
"warranty_time": "String",
"warranty_type": "Number",
"warranty_period": "Number",
"shipping_template_id": "ObjectId",
"sid": "Integer",
"description": "String",
"item_type": "String",
"properties": "Array<{property: String, property_id: ObjectId, option: String, option_id: ObjectId}>",
"variants": "Array<{Variant}>",
"currency": "String",
"url": "String",
"price": "Number",
"has_discount": "Boolean",
"discount_type": "Number|null",
"discount_value": "Number|false",
"shipping_price": "String",
"paid_price": "Number",
"images": "Array"
}
]
}
}
Ürün Ekleme
Belirtilen mağazaya yeni ürün eklemek için kullanılır.
Örnekler
Curl ile istek atmak için bu örnek kullanılabilir.
curl -X POST \ 'https://api.allesgo.com/v1.0/product/add/store/{STORE_ID}' \ -H 'Content-Type: application/json' \ -H 'cache-control: no-cache' \ -d '{"title":"{TITLE}","sub_title":"{SUB_TITLE}","brand_id":"{BRAND_ID}","brand_model":"{BRAND_MODEL}","description":"{DESCRIPTION}","price":"{PRICE}","product_code":"{PRODUCT_CODE}","warranty_type":"{WARRANTY_TYPE}","warranty_period":"{WARRANTY_PERIOD}","has_discount":"{HAS_DISCOUNT}","stock_count":"{STOCK_COUNT}","category_id":"{CATEGORY_ID}","shipping_template_id":"{SHIPPING_TEMPLATE_ID}","images":"{IMAGES}"}'
PHP ile istek atmak için bu örnek kullanılabilir. Örnekte Curl kullanılmaktadır.
<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.allesgo.com/v1.0/product/add/store/{STORE_ID}", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => array( 'title' => '{TITLE}', 'sub_title' => '{SUB_TITLE}', 'brand_id' => '{BRAND_ID}', 'brand_model' => '{BRAND_MODEL}', 'description' => '{DESCRIPTION}', 'price' => '{PRICE}', 'product_code' => '{PRODUCT_CODE}', 'warranty_type' => '{WARRANTY_TYPE}', 'warranty_period' => '{WARRANTY_PERIOD}', 'has_discount' => '{HAS_DISCOUNT}', 'stock_count' => '{STOCK_COUNT}', 'category_id' => '{CATEGORY_ID}', 'shipping_template_id' => '{SHIPPING_TEMPLATE_ID}', 'images' => '{IMAGES}', ), CURLOPT_HTTPHEADER => array( "Content-Type: application/json", "cache-control: no-cache", ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }
Python ile istek atmak için bu örnek kullanılabilir. Bu örnekte Python'un requests kütüphanesi kullanılır ama http.client gibi kütüphane kullanılabilir
import requests url = "https://api.allesgo.com/v1.0/product/add/store/{{STORE_ID}}" payload = { "title": "{TITLE}", "sub_title": "{SUB_TITLE}", "brand_id": "{BRAND_ID}", "brand_model": "{BRAND_MODEL}", "description": "{DESCRIPTION}", "price": "{PRICE}", "product_code": "{PRODUCT_CODE}", "warranty_type": "{WARRANTY_TYPE}", "warranty_period": "{WARRANTY_PERIOD}", "has_discount": "{HAS_DISCOUNT}", "stock_count": "{STOCK_COUNT}", "category_id": "{CATEGORY_ID}", "shipping_template_id": "{SHIPPING_TEMPLATE_ID}", "images": "{IMAGES}" } headers = { 'Content-Type': "application/json", 'cache-control': "no-cache" } response = requests.request("POST", url, data = payload, headers = headers) print(response.text)
Node.js ile istek atmak için bu örnek kullanılabilir. Örnekte request kullanılmaktadır.
var request = require('request'); var options = { method: 'POST', url: 'https://api.allesgo.com/v1.0/product/add/store/{STORE_ID}', headers: { 'cache-control': 'no-cache', 'Content-Type': 'application/json', }, body: { title: '{TITLE}', sub_title: '{SUB_TITLE}', brand_id: '{BRAND_ID}', brand_model: '{BRAND_MODEL}', description: '{DESCRIPTION}', price: '{PRICE}', product_code: '{PRODUCT_CODE}', warranty_type: '{WARRANTY_TYPE}', warranty_period: '{WARRANTY_PERIOD}', has_discount: '{HAS_DISCOUNT}', stock_count: '{STOCK_COUNT}', category_id: '{CATEGORY_ID}', shipping_template_id: '{SHIPPING_TEMPLATE_ID}', images: '{IMAGES}', }, json: true, }; request(options, (error, response, body) => { if (error) throw new Error(error); console.log(body); });
Javascipt ile istek atmak için bu örnek kullanılabilir. Örnekte xhr kullanılmakdır. Not: Bilgi amaçlıdır. Javascipt ile yazılan bu kod'ta Kullanıcı access token'a erişebildiğinden, kullanmanızı önermiyoruz.
var data = JSON.stringify({ title: '{TITLE}', sub_title: '{SUB_TITLE}', brand_id: '{BRAND_ID}', brand_model: '{BRAND_MODEL}', description: '{DESCRIPTION}', price: '{PRICE}', product_code: '{PRODUCT_CODE}', warranty_type: '{WARRANTY_TYPE}', warranty_period: '{WARRANTY_PERIOD}', has_discount: '{HAS_DISCOUNT}', stock_count: '{STOCK_COUNT}', category_id: '{CATEGORY_ID}', shipping_template_id: '{SHIPPING_TEMPLATE_ID}', images: '{IMAGES}', }); var xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener('readystatechange', function () { if (this.readyState === 4) { console.log(this.responseText); } }); xhr.open('POST', 'https://api.allesgo.com/v1.0/product/add/store/{STORE_ID}'); xhr.setRequestHeader('Content-Type', 'application/json'); xhr.setRequestHeader('cache-control', 'no-cache'); xhr.send(data);
C Sharp ile istek atmak için bu örnek kullanılabilir. Bu örnekte RestSharp kullanılmaktadır.
var client = new RestClient("https://api.allesgo.com/v1.0/product/add/store/{STORE_ID}"); var request = new RestRequest(Method.POST); request.AddHeader("cache-control", "no-cache"); request.AddHeader("Content-Type", "application/json"); var body = new { title = "{TITLE}", sub_title = "{SUB_TITLE}", brand_id = "{BRAND_ID}", brand_model = "{BRAND_MODEL}", description = "{DESCRIPTION}", price = "{PRICE}", product_code = "{PRODUCT_CODE}", warranty_type = "{WARRANTY_TYPE}", warranty_period = "{WARRANTY_PERIOD}", has_discount = "{HAS_DISCOUNT}", stock_count = "{STOCK_COUNT}", category_id = "{CATEGORY_ID}", shipping_template_id = "{SHIPPING_TEMPLATE_ID}", images = "{IMAGES}", }; request.AddJsonBody(body); IRestResponse response = client.Execute(request);
Java ile istek atmak için bu örnek kullanılabilir. Örnekte Ok Http kullanılmaktadır.
OkHttpClient client = new OkHttpClient(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, "{\"title\":\"{TITLE}\",\"sub_title\":\"{SUB_TITLE}\",\"brand_id\":\"{BRAND_ID}\",\"brand_model\":\"{BRAND_MODEL}\",\"description\":\"{DESCRIPTION}\",\"price\":\"{PRICE}\",\"product_code\":\"{PRODUCT_CODE}\",\"warranty_type\":\"{WARRANTY_TYPE}\",\"warranty_period\":\"{WARRANTY_PERIOD}\",\"has_discount\":\"{HAS_DISCOUNT}\",\"stock_count\":\"{STOCK_COUNT}\",\"category_id\":\"{CATEGORY_ID}\",\"shipping_template_id\":\"{SHIPPING_TEMPLATE_ID}\",\"images\":\"{IMAGES}\"}"); Request request = new Request.Builder() .url("https://api.allesgo.com/v1.0/product/add/store/{STORE_ID}") .post(body) .addHeader("Content-Type", "application/json") .addHeader("cache-control", "no-cache") .build(); Response response = client.newCall(request).execute();
Go ile istek atmak için bu örnek kullanılabilir. Örnekte net/http kullanılmaktadır.
package main import ( "fmt" "strings" "net/http" "io/ioutil" ) func main() { url := "https://api.allesgo.com/v1.0/product/add/store/{STORE_ID}" payload := strings.NewReader("{\"title\":\"{TITLE}\",\"sub_title\":\"{SUB_TITLE}\",\"brand_id\":\"{BRAND_ID}\",\"brand_model\":\"{BRAND_MODEL}\",\"description\":\"{DESCRIPTION}\",\"price\":\"{PRICE}\",\"product_code\":\"{PRODUCT_CODE}\",\"warranty_type\":\"{WARRANTY_TYPE}\",\"warranty_period\":\"{WARRANTY_PERIOD}\",\"has_discount\":\"{HAS_DISCOUNT}\",\"stock_count\":\"{STOCK_COUNT}\",\"category_id\":\"{CATEGORY_ID}\",\"shipping_template_id\":\"{SHIPPING_TEMPLATE_ID}\",\"images\":\"{IMAGES}\"}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Content-Type", "application/json") req.Header.Add("cache-control", "no-cache") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) }
API Referansı
Request URL parameters
Parametre | Türkçe | Tür | Zorunlu | Geçerli Değerler | Varsayılan | Açıklama |
---|---|---|---|---|---|---|
storeId | Mağaza ID'si | ObjectId | true | Mağaza ID'si |
POST Request Payload
Parametre | Türkçe | Tür | Zorunlu | Geçerli Değerler | Varsayılan | Açıklama |
---|---|---|---|---|---|---|
title | Ürün Başlığı | String | true | Ürünün başlığını belirlersiniz. | ||
sub_title | Ürün Alt Başlığı | String | true | Ürünün alt başlığını belirlersiniz. | ||
brand_id | Üretici Marka ID'si | ObjectId | true | Ürünün üretici marka ID bilgisini girebilirsiniz. | ||
brand_model | Ürün Modeli | String|ObjectId | true | Ürün model bilgisini girebilirsiniz. | ||
description | Ürün Açıklaması | String | true | Ürün açıklama bilgisini girebilirsiniz. | ||
currency | Döviz | String | false | TL, USD, EUR | TL | Ürün fiyatının döviz cinsini belirlersiniz. |
price | Ürün Fiyatı | Number | true | Ürün fiyat bilgisini girebilirsiniz. TL => Kuruş USD => Cent EUR => Cent |
||
product_code | Mağaza Ürün Kodu | String | true | Mağaza ürün kodu bilgisini belirlersiniz. | ||
warranty_type | Garanti Türü | Integer | true | 1, 2, 3, 4 | Ürünün garanti türünü belirlersiniz. 1. => Garantisiz 2. => İthalatçı Firma Garantili 3. => Tedarikçi Firma Garantili 4. => Teknik Servis Garantili |
|
warranty_period | Garanti Süresi | Integer | true | 0, 12, 24, 36 | Garantili bir ürünün garanti süresini belirlersiniz. 0. => Garantisiz 12 => 12 Ay Garanti 24 => 24 Ay Garanti 36 => 36 Ay Garanti |
|
has_discount | İndirim Durumu | Boolean | true | İndirimli ürün ekleyebilirsiniz. | ||
discount_type | İndirim Türü | Integer | false | 1, 2, 3 |
Ürünün indirim türünü belirlersiniz.
1 => İndirim Tutarı 2 => İndirim Oranı 3 => İndirimli Fiyat |
|
discount_value | İndirim Değeri | Integer | false |
Ürünün indirim tutarını belirlersiniz.
|
||
category_id | Kategori ID'si | ObjectId | true | Ürünün hangi kategoriye ekleneceğini belirlersiniz. | ||
shipping_template_id | Kargo Şablonu ID'si | ObjectId | true | Ürüne ait kargo şablonunu belirlersiniz. | ||
stock_count | Ürün Stok Adedi | Integer | true | Ürünün stok miktarını belirlersiniz. | ||
product_condition | Ürün Durumu | String | false | new, used | new | Ürünün sıfır veya ikinci el olduğunu belirlersiniz. Sadece Pazar mağazaları için geçerlidir. |
images | Ürün Görseli | Array |
true | Ürünlere dilediğiniz sayıda görsel ekleyebilirsiniz. | ||
custom_order_input | Kişiye Özel Alan | Boolean | false | Ürünün kişiye özel alanını aktif edebilirsiniz. |
Sunucudan dönecek cevabın örneği.
{
"data": {
"status": "Boolean",
"message": "String",
"product_id": "ObjectId"
}
}
Ürün Güncelleme
Belirtilen mağazaya ürün güncellemek için kullanılır.
Örnekler
Curl ile istek atmak için bu örnek kullanılabilir.
curl -X POST \ 'https://api.allesgo.com/v1.0/product/update/store/{STORE_ID}' \ -H 'Content-Type: application/json' \ -H 'cache-control: no-cache' \ -d '{"product_id":"{PRODUCT_ID}","title":"{TITLE}","sub_title":"{SUB_TITLE}","brand_id":"{BRAND_ID}","brand_model":"{BRAND_MODEL}","description":"{DESCRIPTION}","price":"{PRICE}","product_code":"{PRODUCT_CODE}","warranty_type":"{WARRANTY_TYPE}","warranty_period":"{WARRANTY_PERIOD}","has_discount":"{HAS_DISCOUNT}","stock_count":"{STOCK_COUNT}","category_id":"{CATEGORY_ID}","shipping_template_id":"{SHIPPING_TEMPLATE_ID}","images":"{IMAGES}"}'
PHP ile istek atmak için bu örnek kullanılabilir. Örnekte Curl kullanılmaktadır.
<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.allesgo.com/v1.0/product/update/store/{STORE_ID}", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => array( 'product_id' => '{PRODUCT_ID}', 'title' => '{TITLE}', 'sub_title' => '{SUB_TITLE}', 'brand_id' => '{BRAND_ID}', 'brand_model' => '{BRAND_MODEL}', 'description' => '{DESCRIPTION}', 'price' => '{PRICE}', 'product_code' => '{PRODUCT_CODE}', 'warranty_type' => '{WARRANTY_TYPE}', 'warranty_period' => '{WARRANTY_PERIOD}', 'has_discount' => '{HAS_DISCOUNT}', 'stock_count' => '{STOCK_COUNT}', 'category_id' => '{CATEGORY_ID}', 'shipping_template_id' => '{SHIPPING_TEMPLATE_ID}', 'images' => '{IMAGES}', ), CURLOPT_HTTPHEADER => array( "Content-Type: application/json", "cache-control: no-cache", ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }
Python ile istek atmak için bu örnek kullanılabilir. Bu örnekte Python'un requests kütüphanesi kullanılır ama http.client gibi kütüphane kullanılabilir
import requests url = "https://api.allesgo.com/v1.0/product/update/store/{{STORE_ID}}" payload = { "product_id": "{{PRODUCT_ID}}", "title": "{{TITLE}}", "sub_title": "{{SUB_TITLE}}", "brand_id": "{{BRAND_ID}}", "brand_model": "{{BRAND_MODEL}}", "description": "{{DESCRIPTION}}", "price": "{{PRICE}}", "product_code": "{{PRODUCT_CODE}}", "warranty_type": "{{WARRANTY_TYPE}}", "warranty_period": "{{WARRANTY_PERIOD}}", "has_discount": "{{HAS_DISCOUNT}}", "stock_count": "{{STOCK_COUNT}}", "category_id": "{{CATEGORY_ID}}", "shipping_template_id": "{{SHIPPING_TEMPLATE_ID}}", "images": "{{IMAGES}}" } headers = { 'Content-Type': "application/json", 'cache-control': "no-cache" } response = requests.request("POST", url, data = payload, headers = headers) print(response.text)
Node.js ile istek atmak için bu örnek kullanılabilir. Örnekte request kullanılmaktadır.
var request = require('request'); var options = { method: 'POST', url: 'https://api.allesgo.com/v1.0/product/update/store/{STORE_ID}', headers: { 'cache-control': 'no-cache', 'Content-Type': 'application/json', }, body: { product_id: '{PRODUCT_ID}', title: '{TITLE}', sub_title: '{SUB_TITLE}', brand_id: '{BRAND_ID}', brand_model: '{BRAND_MODEL}', description: '{DESCRIPTION}', price: '{PRICE}', product_code: '{PRODUCT_CODE}', warranty_type: '{WARRANTY_TYPE}', warranty_period: '{WARRANTY_PERIOD}', has_discount: '{HAS_DISCOUNT}', stock_count: '{STOCK_COUNT}', category_id: '{CATEGORY_ID}', shipping_template_id: '{SHIPPING_TEMPLATE_ID}', images: '{IMAGES}', }, json: true, }; request(options, (error, response, body) => { if (error) throw new Error(error); console.log(body); });
Javascipt ile istek atmak için bu örnek kullanılabilir. Örnekte xhr kullanılmakdır. Not: Bilgi amaçlıdır. Javascipt ile yazılan bu kod'ta Kullanıcı access token'a erişebildiğinden, kullanmanızı önermiyoruz.
var data = JSON.stringify({ product_id: '{PRODUCT_ID}', title: '{TITLE}', sub_title: '{SUB_TITLE}', brand_id: '{BRAND_ID}', brand_model: '{BRAND_MODEL}', description: '{DESCRIPTION}', price: '{PRICE}', product_code: '{PRODUCT_CODE}', warranty_type: '{WARRANTY_TYPE}', warranty_period: '{WARRANTY_PERIOD}', has_discount: '{HAS_DISCOUNT}', stock_count: '{STOCK_COUNT}', category_id: '{CATEGORY_ID}', shipping_template_id: '{SHIPPING_TEMPLATE_ID}', images: '{IMAGES}', }); var xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener('readystatechange', function () { if (this.readyState === 4) { console.log(this.responseText); } }); xhr.open('POST', 'https://api.allesgo.com/v1.0/product/update/store/{STORE_ID}'); xhr.setRequestHeader('Content-Type', 'application/json'); xhr.setRequestHeader('cache-control', 'no-cache'); xhr.send(data);
C Sharp ile istek atmak için bu örnek kullanılabilir. Bu örnekte RestSharp kullanılmaktadır.
var client = new RestClient("https://api.allesgo.com/v1.0/product/update/store/{STORE_ID}"); var request = new RestRequest(Method.POST); request.AddHeader("cache-control", "no-cache"); request.AddHeader("Content-Type", "application/json"); var body = new { product_id = "{PRODUCT_ID}", title = "{TITLE}", sub_title = "{SUB_TITLE}", brand_id = "{BRAND_ID}", brand_model = "{BRAND_MODEL}", description = "{DESCRIPTION}", price = "{PRICE}", product_code = "{PRODUCT_CODE}", warranty_type = "{WARRANTY_TYPE}", warranty_period = "{WARRANTY_PERIOD}", has_discount = "{HAS_DISCOUNT}", stock_count = "{STOCK_COUNT}", category_id = "{CATEGORY_ID}", shipping_template_id = "{SHIPPING_TEMPLATE_ID}", images = "{IMAGES}", }; request.AddJsonBody(body); IRestResponse response = client.Execute(request);
Java ile istek atmak için bu örnek kullanılabilir. Örnekte Ok Http kullanılmaktadır.
OkHttpClient client = new OkHttpClient(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, "{\"product_id\":\"{PRODUCT_ID}\", \"title\":\"{TITLE}\",\"sub_title\":\"{SUB_TITLE}\",\"brand_id\":\"{BRAND_ID}\",\"brand_model\":\"{BRAND_MODEL}\",\"description\":\"{DESCRIPTION}\",\"price\":\"{PRICE}\",\"product_code\":\"{PRODUCT_CODE}\",\"warranty_type\":\"{WARRANTY_TYPE}\",\"warranty_period\":\"{WARRANTY_PERIOD}\",\"has_discount\":\"{HAS_DISCOUNT}\",\"stock_count\":\"{STOCK_COUNT}\",\"category_id\":\"{CATEGORY_ID}\",\"shipping_template_id\":\"{SHIPPING_TEMPLATE_ID}\",\"images\":\"{IMAGES}\"}"); Request request = new Request.Builder() .url("https://api.allesgo.com/v1.0/product/update/store/{STORE_ID}") .post(body) .addHeader("Content-Type", "application/json") .addHeader("cache-control", "no-cache") .build(); Response response = client.newCall(request).execute();
Go ile istek atmak için bu örnek kullanılabilir. Örnekte net/http kullanılmaktadır.
package main import ( "fmt" "strings" "net/http" "io/ioutil" ) func main() { url := "https://api.allesgo.com/v1.0/product/add/update/{STORE_ID}" payload := strings.NewReader("{\"product_id\":\"{PRODUCT_ID}\",\"title\":\"{TITLE}\",\"sub_title\":\"{SUB_TITLE}\",\"brand_id\":\"{BRAND_ID}\",\"brand_model\":\"{BRAND_MODEL}\",\"description\":\"{DESCRIPTION}\",\"price\":\"{PRICE}\",\"product_code\":\"{PRODUCT_CODE}\",\"warranty_type\":\"{WARRANTY_TYPE}\",\"warranty_period\":\"{WARRANTY_PERIOD}\",\"has_discount\":\"{HAS_DISCOUNT}\",\"stock_count\":\"{STOCK_COUNT}\",\"category_id\":\"{CATEGORY_ID}\",\"shipping_template_id\":\"{SHIPPING_TEMPLATE_ID}\",\"images\":\"{IMAGES}\"}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Content-Type", "application/json") req.Header.Add("cache-control", "no-cache") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) }
API Referansı
Request URL parameters
Parametre | Türkçe | Tür | Zorunlu | Geçerli Değerler | Varsayılan | Açıklama |
---|---|---|---|---|---|---|
storeId | Mağaza ID'si | ObjectId | true | Mağaza ID'si |
POST Request Payload
Parametre | Türkçe | Tür | Zorunlu | Geçerli Değerler | Varsayılan | Açıklama |
---|---|---|---|---|---|---|
product_id | Ürün ID'si | ObjectId | true | Ürün ID'si. | ||
title | Ürün Başlığı | String | false | Ürünün başlığını belirlersiniz. | ||
sub_title | Ürün Alt Başlığı | String | false | Ürünün alt başlığını belirlersiniz. | ||
brand_id | Üretici Marka ID'si | ObjectId | false | Ürünün üretici marka ID bilgisini girebilirsiniz. | ||
brand_model | Ürün Modeli | String|ObjectId | false | Ürün model bilgisini girebilirsiniz. | ||
description | Ürün Açıklaması | String | false | Ürün açıklama bilgisini girebilirsiniz. | ||
price | Ürün Fiyatı | Number | false | Ürün fiyat bilgisini girebilirsiniz. TL => Kuruş USD => Cent EUR => Cent |
||
product_code | Mağaza Ürün Kodu | String | false | Mağaza ürün kodu bilgisini belirlersiniz. | ||
warranty_type | Garanti Türü | Integer | false | 1, 2, 3, 4 | Ürünün garanti türünü belirlersiniz. 1. => Garantisiz 2. => İthalatçı Firma Garantili 3. => Tedarikçi Firma Garantili 4. => Teknik Servis Garantili |
|
warranty_period | Garanti Süresi | Integer | false | 0, 12, 24, 36 | Garantili bir ürünün garanti süresini belirlersiniz. 0. => Garantisiz 12 => 12 Ay Garanti 24 => 24 Ay Garanti 36 => 36 Ay Garanti |
|
has_discount | İndirim Durumu | Boolean | false | İndirimli ürün ekleyebilirsiniz. | ||
discount_type | İndirim Türü | Integer | false | 1, 2, 3 |
Ürünün indirim türünü belirlersiniz.
1 => İndirim Tutarı 2 => İndirim Oranı 3 => İndirimli Fiyat |
|
discount_value | İndirim Değeri | Integer | false |
Ürünün indirim tutarını belirlersiniz.
|
||
category_id | Kategori ID'si | ObjectId | false | Ürünün hangi kategoriye ekleneceğini belirlersiniz. | ||
shipping_template_id | Kargo Şablonu ID'si | ObjectId | false | Ürüne ait kargo şablonunu belirlersiniz. | ||
stock_count | Ürün Stok Adedi | Integer | false | Ürünün stok miktarını belirlersiniz. | ||
product_condition | Ürün Durumu | String | false | new, used | new | Ürünün sıfır veya ikinci el olduğunu belirlersiniz. Sadece Pazar mağazaları için geçerlidir. |
images | Ürün Görseli | Array |
false | Ürünlere dilediğiniz sayıda görsel ekleyebilirsiniz. | ||
custom_order_input | Kişiye Özel Alan | Boolean | false | Ürünün kişiye özel alanını aktif edebilirsiniz. | ||
currency | Döviz | String | false | TL, USD, EUR | TL | Ürün fiyatının döviz cinsini belirlersiniz. |
Sunucudan dönecek cevabın örneği.
{
"data": {
"status": "Boolean",
"message": "String",
"product_id": "ObjectId"
}
}
Ürün Değer-Özellik Verileri
Belirtilen mağazaya ait belirtilen ürüne değer-özellik verilerini eklemek veya güncellemek için kullanılır.
Örnekler
Curl ile istek atmak için bu örnek kullanılabilir.
curl -X POST \ 'https://api.allesgo.com/v1.0/product/set-properties/store/{STORE_ID}' \ -H 'Content-Type: application/json' \ -H 'cache-control: no-cache' \ -d '{"product_id":"{PRODUCT_ID}","properties":[{"property":"{PROPERTY}","option":"{OPTION}"}]}'
PHP ile istek atmak için bu örnek kullanılabilir. Örnekte Curl kullanılmaktadır.
<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.allesgo.com/v1.0/product/set-properties/store/{STORE_ID}", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => array( 'product_id' => '{PRODUCT_ID}', 'properties' => array( 0 => array( 'property' => '{PROPERTY}', 'option' => '{OPTION}', ), ), ), CURLOPT_HTTPHEADER => array( "Content-Type: application/json", "cache-control: no-cache", ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }
Python ile istek atmak için bu örnek kullanılabilir. Bu örnekte Python'un requests kütüphanesi kullanılır ama http.client gibi kütüphane kullanılabilir
import requests url = "https://api.allesgo.com/v1.0/product/set-properties/store/{{STORE_ID}}" payload = { "product_id":"{{PRODUCT_ID}}", "properties":[{ "property":"{{PROPERTY}}", "option":"{{OPTION}}" } ] } headers = { 'Content-Type': "application/json", 'cache-control': "no-cache" } response = requests.request("POST", url, data=payload, headers=headers) print(response.text)
Node.js ile istek atmak için bu örnek kullanılabilir. Örnekte request kullanılmaktadır.
var request = require('request'); var options = { method: 'POST', url: 'https://api.allesgo.com/v1.0/product/set-properties/store/{STORE_ID}', headers: { 'cache-control': 'no-cache', 'Content-Type': 'application/json', }, body: { product_id: '{PRODUCT_ID}', properties: [{ property: '{PROPERTY}', option: '{OPTION}' }], }, json: true, }; request(options, (error, response, body) => { if (error) throw new Error(error); console.log(body); });
Javascipt ile istek atmak için bu örnek kullanılabilir. Örnekte xhr kullanılmakdır. Not: Bilgi amaçlıdır. Javascipt ile yazılan bu kod'ta Kullanıcı access token'a erişebildiğinden, kullanmanızı önermiyoruz.
var data = JSON.stringify({ product_id: '{PRODUCT_ID}', properties: [ { property: '{PROPERTY}', option: '{OPTION}', }, ], }); var xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener('readystatechange', function () { if (this.readyState === 4) { console.log(this.responseText); } }); xhr.open('POST', 'https://api.allesgo.com/v1.0/product/set-properties/store/{STORE_ID}'); xhr.setRequestHeader('Content-Type', 'application/json'); xhr.setRequestHeader('cache-control', 'no-cache'); xhr.send(data);
C Sharp ile istek atmak için bu örnek kullanılabilir. Bu örnekte RestSharp kullanılmaktadır.
var client = new RestClient("https://api.allesgo.com/v1.0/product/set-properties/store/{STORE_ID}"); var request = new RestRequest(Method.POST); request.AddHeader("cache-control", "no-cache"); request.AddHeader("Content-Type", "application/json"); request.AddParameter("undefined", "{\"product_id\":\"{PRODUCT_ID}\",\"properties\":[{\"property\":\"{PROPERTY}\",\"option\":\"{OPTION}\"}]}", ParameterType.RequestBody); IRestResponse response = client.Execute(request);
Java ile istek atmak için bu örnek kullanılabilir. Örnekte Ok Http kullanılmaktadır.
OkHttpClient client = new OkHttpClient(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, "{\"product_id\":\"{PRODUCT_ID}\",\"properties\":[{\"property\":\"{PROPERTY}\",\"option\":\"{OPTION}\"}]}"); Request request = new Request.Builder() .url("https://api.allesgo.com/v1.0/product/set-properties/store/{STORE_ID}") .post(body) .addHeader("Content-Type", "application/json") .addHeader("cache-control", "no-cache") .build(); Response response = client.newCall(request).execute();
Go ile istek atmak için bu örnek kullanılabilir. Örnekte net/http kullanılmaktadır.
package main import ( "fmt" "strings" "net/http" "io/ioutil" ) func main() { url := "https://api.allesgo.com/v1.0/product/set-properties/store/{STORE_ID}" payload := strings.NewReader("{\"product_id\":\"{PRODUCT_ID}\",\"properties\":[{\"property\":\"{PROPERTY}\",\"option\":\"{OPTION}\"}]}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Content-Type", "application/json") req.Header.Add("cache-control", "no-cache") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) }
API Referansı
Request URL parameters
Parametre | Türkçe | Tür | Zorunlu | Geçerli Değerler | Varsayılan | Açıklama |
---|---|---|---|---|---|---|
storeId | Mağaza ID'si | ObjectId | true | Mağaza ID'si |
POST Request Payload
Parametre | Türkçe | Tür | Zorunlu | Geçerli Değerler | Varsayılan | Açıklama |
---|---|---|---|---|---|---|
product_id | Ürün ID'si | ObjectId | true | Ürün ID'sini belirleyebilirsiniz. | ||
properties | Ürün Özellikleri | Array |
true | Ürün Özellikleri |
Sunucudan dönecek cevabın örneği.
{
"data": {
"status": "Boolean"
}
}
Ürün Durumunu Değiştirme
Belirtilen mağazaya ait belirtilen ürünü aktif veya pasif hale getirmek için kullanılır.
Örnekler
Curl ile istek atmak için bu örnek kullanılabilir.
curl -X POST \ 'https://api.allesgo.com/v1.0/product/set-status/store/{STORE_ID}' \ -H 'Content-Type: application/json' \ -H 'cache-control: no-cache' \ -d '{"product_id":"{PRODUCT_ID}","status":"{STATUS}"}'
PHP ile istek atmak için bu örnek kullanılabilir. Örnekte Curl kullanılmaktadır.
<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.allesgo.com/v1.0/product/set-status/store/{STORE_ID}", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => array( 'product_id' => '{PRODUCT_ID}', 'status' => '{STATUS}', ), CURLOPT_HTTPHEADER => array( "Content-Type: application/json", "cache-control: no-cache", ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }
Python ile istek atmak için bu örnek kullanılabilir. Bu örnekte Python'un requests kütüphanesi kullanılır ama http.client gibi kütüphane kullanılabilir
import requests url = "https://api.allesgo.com/v1.0/product/set-status/store/{{STORE_ID}}" payload = {"product_id":"{{PRODUCT_ID}}","status":"{{STATUS}}"} headers = { 'Content-Type': "application/json", 'cache-control': "no-cache" } response = requests.request("POST", url, data=payload, headers=headers) print(response.text)
Node.js ile istek atmak için bu örnek kullanılabilir. Örnekte request kullanılmaktadır.
var request = require('request'); var options = { method: 'POST', url: 'https://api.allesgo.com/v1.0/product/set-status/store/{STORE_ID}', headers: { 'cache-control': 'no-cache', 'Content-Type': 'application/json', }, body: { product_id: '{PRODUCT_ID}', status: '{STATUS}' }, json: true, }; request(options, (error, response, body) => { if (error) throw new Error(error); console.log(body); });
Javascipt ile istek atmak için bu örnek kullanılabilir. Örnekte xhr kullanılmakdır. Not: Bilgi amaçlıdır. Javascipt ile yazılan bu kod'ta Kullanıcı access token'a erişebildiğinden, kullanmanızı önermiyoruz.
var data = JSON.stringify({ product_id: '{PRODUCT_ID}', status: '{STATUS}', }); var xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener('readystatechange', function () { if (this.readyState === 4) { console.log(this.responseText); } }); xhr.open('POST', 'https://api.allesgo.com/v1.0/product/set-status/store/{STORE_ID}'); xhr.setRequestHeader('Content-Type', 'application/json'); xhr.setRequestHeader('cache-control', 'no-cache'); xhr.send(data);
C Sharp ile istek atmak için bu örnek kullanılabilir. Bu örnekte RestSharp kullanılmaktadır.
var client = new RestClient("https://api.allesgo.com/v1.0/product/set-status/store/{STORE_ID}"); var request = new RestRequest(Method.POST); request.AddHeader("cache-control", "no-cache"); request.AddHeader("Content-Type", "application/json"); var body = new { product_question_id = "{PRODUCT_QUESTION_ID}", status = "{STATUS}" }; request.AddJsonBody(body); IRestResponse response = client.Execute(request);
Java ile istek atmak için bu örnek kullanılabilir. Örnekte Ok Http kullanılmaktadır.
OkHttpClient client = new OkHttpClient(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, "{\"product_id\":\"{PRODUCT_ID}\",\"status\":\"{STATUS}\"}"); Request request = new Request.Builder() .url("https://api.allesgo.com/v1.0/product/set-status/store/{STORE_ID}") .post(body) .addHeader("Content-Type", "application/json") .addHeader("cache-control", "no-cache") .build(); Response response = client.newCall(request).execute();
Go ile istek atmak için bu örnek kullanılabilir. Örnekte net/http kullanılmaktadır.
package main import ( "fmt" "strings" "net/http" "io/ioutil" ) func main() { url := "https://api.allesgo.com/v1.0/product/set-status/store/{STORE_ID}" payload := strings.NewReader("{\"product_id\":\"{PRODUCT_ID}\",\"status\":\"{STATUS}\"}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Content-Type", "application/json") req.Header.Add("cache-control", "no-cache") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) }
API Referansı
Request URL parameters
Parametre | Türkçe | Tür | Zorunlu | Geçerli Değerler | Varsayılan | Açıklama |
---|---|---|---|---|---|---|
storeId | Mağaza ID'si | ObjectId | true | Mağaza ID'si |
POST Request Payload
Parametre | Türkçe | Tür | Zorunlu | Geçerli Değerler | Varsayılan | Açıklama |
---|---|---|---|---|---|---|
product_id | Ürün ID'si | ObjectId | true | Ürün durumu ile ilgili değişiklik yapabilirsiniz. | ||
status | Ürün Durumu | Integer | true | 0, 1 | Belirlediğiniz ürünü aktif veya pasif durumu getirebilirsiniz . 0 => passive 1 => active |
Sunucudan dönecek cevabın örneği.
{
"data": {
"status": "Boolean"
}
}
Ürün Stok Miktarı
Belirtilen mağazaya ait belirtilen ürünün stok bilgilerini güncellemek için kullanılır.
Örnekler
Curl ile istek atmak için bu örnek kullanılabilir.
curl -X POST \ 'https://api.allesgo.com/v1.0/product/set-stock/store/{STORE_ID}' \ -H 'Content-Type: application/json' \ -H 'cache-control: no-cache' \ -d '{"product_id":"{PRODUCT_ID}","stock":"{STOCK}"}'
PHP ile istek atmak için bu örnek kullanılabilir. Örnekte Curl kullanılmaktadır.
<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.allesgo.com/v1.0/product/set-stock/store/{STORE_ID}", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => array( 'product_id' => '{PRODUCT_ID}', 'stock' => '{STOCK}', ), CURLOPT_HTTPHEADER => array( "Content-Type: application/json", "cache-control: no-cache", ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }
Python ile istek atmak için bu örnek kullanılabilir. Bu örnekte Python'un requests kütüphanesi kullanılır ama http.client gibi kütüphane kullanılabilir
import requests url = "https://api.allesgo.com/v1.0/product/set-stock/store/{{STORE_ID}}" payload = {"product_id":"{{PRODUCT_ID}}","stock":"{{STOCK}}"} headers = { 'Content-Type': "application/json", 'cache-control': "no-cache" } response = requests.request("POST", url, data=payload, headers=headers) print(response.text)
Node.js ile istek atmak için bu örnek kullanılabilir. Örnekte request kullanılmaktadır.
var request = require('request'); var options = { method: 'POST', url: 'https://api.allesgo.com/v1.0/product/set-stock/store/{STORE_ID}', headers: { 'cache-control': 'no-cache', 'Content-Type': 'application/json', }, body: { product_id: '{PRODUCT_ID}', stock: '{STOCK}' }, json: true, }; request(options, (error, response, body) => { if (error) throw new Error(error); console.log(body); });
Javascipt ile istek atmak için bu örnek kullanılabilir. Örnekte xhr kullanılmakdır. Not: Bilgi amaçlıdır. Javascipt ile yazılan bu kod'ta Kullanıcı access token'a erişebildiğinden, kullanmanızı önermiyoruz.
var data = JSON.stringify({ product_id: '{PRODUCT_ID}', stock: '{STOCK}', }); var xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener('readystatechange', function () { if (this.readyState === 4) { console.log(this.responseText); } }); xhr.open('POST', 'https://api.allesgo.com/v1.0/product/set-stock/store/{STORE_ID}'); xhr.setRequestHeader('Content-Type', 'application/json'); xhr.setRequestHeader('cache-control', 'no-cache'); xhr.send(data);
C Sharp ile istek atmak için bu örnek kullanılabilir. Bu örnekte RestSharp kullanılmaktadır.
var client = new RestClient("https://api.allesgo.com/v1.0/product/set-stock/store/{STORE_ID}"); var request = new RestRequest(Method.POST); request.AddHeader("Postman-Token", "7d94f9fc-e98f-4dcc-b9cb-5c51e349c1b8"); request.AddHeader("cache-control", "no-cache"); request.AddHeader("Content-Type", "application/json"); var body = new { product_id = "{PRODUCT_ID}", stock = "{STOCK}" }; request.AddJsonBody(body); IRestResponse response = client.Execute(request);
Java ile istek atmak için bu örnek kullanılabilir. Örnekte Ok Http kullanılmaktadır.
OkHttpClient client = new OkHttpClient(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, "{\"product_id\":\"{PRODUCT_ID}\",\"stock\":\"{STOCK}\"}"); Request request = new Request.Builder() .url("https://api.allesgo.com/v1.0/product/set-stock/store/{STORE_ID}") .post(body) .addHeader("Content-Type", "application/json") .addHeader("cache-control", "no-cache") .build(); Response response = client.newCall(request).execute();
Go ile istek atmak için bu örnek kullanılabilir. Örnekte net/http kullanılmaktadır.
package main import ( "fmt" "strings" "net/http" "io/ioutil" ) func main() { url := "https://api.allesgo.com/v1.0/product/set-stock/store/{STORE_ID}" payload := strings.NewReader("{\"product_id\":\"{PRODUCT_ID}\",\"stock\":\"{STOCK}\"}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Content-Type", "application/json") req.Header.Add("cache-control", "no-cache") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) }
API Referansı
Request URL parameters
Parametre | Türkçe | Tür | Zorunlu | Geçerli Değerler | Varsayılan | Açıklama |
---|---|---|---|---|---|---|
storeId | Mağaza ID'si | ObjectId | true | Mağaza ID'si |
POST Request Payload
Parametre | Türkçe | Tür | Zorunlu | Geçerli Değerler | Varsayılan | Açıklama |
---|---|---|---|---|---|---|
product_id | Ürün ID'si | ObjectId | true | Ürün ID'sini kullanarak ürün durumu ile ilgili değişiklik yapabilirsiniz. | ||
variant_id | Ürün Varyant ID'si | ObjectId | false | Varyant ID'sine göre stok güncellemesi yapabilirsiniz. Eğer ürün varyantlı değilse herhangi bir değer girmenize gerek yoktur. | ||
stock | Ürün Stoğu | Integer | true | Ürün veya varyant stok miktarını belirlersiniz. |
Sunucudan dönecek cevabın örneği.
{
"data": {
"status": "Boolean"
}
}
Ürün Varyantı Oluşturma
Belirtilen mağazaya ait belirtilen ürünün varyantları oluşturmak için kullanılır.
Örnekler
Curl ile istek atmak için bu örnek kullanılabilir.
curl -X POST \ 'https://api.allesgo.com/v1.0/product/set-variants/store/{storeId}' \ -H 'Content-Type: application/json' \ -H 'cache-control: no-cache' \ -d '{"product_id":"PRODUCT_ID","variants":[{"ozellik":"deger","price":"PRICE","stock_count":"STOCK_COUNT","code":"CODE","gtin":"GTIN","mpn":"MPN"}]}'
PHP ile istek atmak için bu örnek kullanılabilir. Örnekte Curl kullanılmaktadır.
<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.allesgo.com/v1.0/product/set-variants/store/{storeId}", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => array( 'product_id' => 'PRODUCT_ID', 'variants' => array( 0 => array( 'ozellik' => 'deger', 'price' => 'PRICE', 'stock_count' => 'STOCK_COUNT', 'code' => 'CODE', 'gtin' => 'GTIN', 'mpn' => 'MPN', ), ), ), CURLOPT_HTTPHEADER => array( "Content-Type: application/json", "cache-control: no-cache", ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }
Python ile istek atmak için bu örnek kullanılabilir. Bu örnekte Python'un requests kütüphanesi kullanılır ama http.client gibi kütüphane kullanılabilir
import requests url = "https://api.allesgo.com/v1.0/product/set-variants/store/{{storeId}}" payload = { "product_id": "PRODUCT_ID", "variants": [{ "ozellik": "deger", "price": "PRICE", "stock_count": "STOCK_COUNT", "code": "CODE", "gtin": "GTIN", "mpn": "MPN" }] } headers = { 'Content-Type': "application/json", 'cache-control': "no-cache" } response = requests.request("POST", url, data = payload, headers = headers) print(response.text)
Node.js ile istek atmak için bu örnek kullanılabilir. Örnekte request kullanılmaktadır.
var request = require('request'); var options = { method: 'POST', url: 'https://api.allesgo.com/v1.0/product/set-variants/store/{storeId}', headers: { 'cache-control': 'no-cache', 'Content-Type': 'application/json', }, body: { product_id: 'PRODUCT_ID', variants: [ { ozellik: 'deger', price: 'PRICE', stock_count: 'STOCK_COUNT', code: 'CODE', gtin: 'GTIN', mpn: 'MPN', }, ], }, json: true, }; request(options, (error, response, body) => { if (error) throw new Error(error); console.log(body); });
Javascipt ile istek atmak için bu örnek kullanılabilir. Örnekte xhr kullanılmakdır. Not: Bilgi amaçlıdır. Javascipt ile yazılan bu kod'ta Kullanıcı access token'a erişebildiğinden, kullanmanızı önermiyoruz.
var data = JSON.stringify({ product_id: 'PRODUCT_ID', variants: [ { ozellik: 'deger', price: 'PRICE', stock_count: 'STOCK_COUNT', code: 'CODE', gtin: 'GTIN', mpn: 'MPN', }, ], }); var xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener('readystatechange', function () { if (this.readyState === 4) { console.log(this.responseText); } }); xhr.open('POST', 'https://api.allesgo.com/v1.0/product/set-variants/store/{storeId}'); xhr.setRequestHeader('Content-Type', 'application/json'); xhr.setRequestHeader('cache-control', 'no-cache'); xhr.send(data);
C Sharp ile istek atmak için bu örnek kullanılabilir. Bu örnekte RestSharp kullanılmaktadır.
var client = new RestClient("https://api.allesgo.com/v1.0/product/set-variants/store/{storeId}"); var request = new RestRequest(Method.POST); request.AddHeader("cache-control", "no-cache"); request.AddHeader("Content-Type", "application/json"); request.AddParameter("undefined", "{\"product_id\":\"PRODUCT_ID\",\"variants\":[{\"ozellik\":\"deger\",\"price\":\"PRICE\",\"stock_count\":\"STOCK_COUNT\",\"code\":\"CODE\",\"gtin\":\"GTIN\",\"mpn\":\"MPN\"}]}", ParameterType.RequestBody); IRestResponse response = client.Execute(request);
Java ile istek atmak için bu örnek kullanılabilir. Örnekte Ok Http kullanılmaktadır.
OkHttpClient client = new OkHttpClient(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, "{\"product_id\":\"PRODUCT_ID\",\"variants\":[{\"ozellik\":\"deger\",\"price\":\"PRICE\",\"stock_count\":\"STOCK_COUNT\",\"code\":\"CODE\",\"gtin\":\"GTIN\",\"mpn\":\"MPN\"}]}"); Request request = new Request.Builder() .url("https://api.allesgo.com/v1.0/product/set-variants/store/{storeId}") .post(body) .addHeader("Content-Type", "application/json") .addHeader("cache-control", "no-cache") .build(); Response response = client.newCall(request).execute();
Go ile istek atmak için bu örnek kullanılabilir. Örnekte net/http kullanılmaktadır.
package main import ( "fmt" "strings" "net/http" "io/ioutil" ) func main() { url := "https://api.allesgo.com/v1.0/product/set-variants/store/{storeId}" payload := strings.NewReader("{\"product_id\":\"PRODUCT_ID\",\"variants\":[{\"ozellik\":\"deger\",\"price\":\"PRICE\",\"stock_count\":\"STOCK_COUNT\",\"code\":\"CODE\",\"gtin\":\"GTIN\",\"mpn\":\"MPN\"}]}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Content-Type", "application/json") req.Header.Add("cache-control", "no-cache") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) }
API Referansı
Request URL parameters
Parametre | Türkçe | Tür | Zorunlu | Geçerli Değerler | Varsayılan | Açıklama |
---|---|---|---|---|---|---|
storeId | Mağaza ID'si | ObjectId | true | Mağaza ID'si |
POST Request Payload
Parametre | Türkçe | Tür | Zorunlu | Geçerli Değerler | Varsayılan | Açıklama |
---|---|---|---|---|---|---|
product_id | Ürün ID'si | ObjectId | true | Varyant oluşturacağınız ürünün ID'si. | ||
variants | Varyant | Array |
true | Varyant bilgilerini oluşturmak için kullanılır. Daha önce oluşturulmuş varyantlar silinecektir. |
Sunucudan dönecek cevabın örneği.
{
"data": {
"status": "Boolean",
"variants": "Array"
}
}