Mağaza sorularının yönetimi için kullanılır.
Soruları Listeleme
Belirtilen mağazaya sorulmuş tüm soruları belirtilen kriterlere göre listelemek 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/question/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/question/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. Örnekte requests kullanılmaktadır.
import requests
url = "https://api.allesgo.com/v1.0/question/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/question/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/question/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/question/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/question/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/category/question/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 | Limit | Integer | false | 1 | Kaçıncı sayfayı getireceğinizi belirlersiniz. | |
| start_date | Başlangıç Tarihi | Integer | false | Belirlenen tarihten sonraki tüm sorular getirilir.Format: UnixTimeStamp . | ||
| end_date | Bitiş Tarihi | Integer | false | Belirtilen tarihe kadar olan tüm sorular listelenir. Format: UnixTimeStamp . | ||
| sort_by_date | Tarihe Göre Sırala | String | false | ascending, descending | descending | Mağazaya sorulmuş olan sorular kronolojik sıraya göre getirilir. |
| answered | Cevaplanmış Sorular | Integer | false | 1 | Cevaplanmış olan tüm sorular listelenir. | |
| unanswered | Cevaplanmamış Sorular | Integer | false | 1 | Cevaplanmamış olan tüm sorular listelenir. | |
| title | Başlık | String | false | Soruları başlıklarına göre getirebilirsiniz. | ||
| questions_for_product | Ürüne Sorulan Sorular | Integer | false | 1 | Belirlenen ürünlere sorulan soruları getirir. | |
| questions_for_store | Mağazaya Sorulan Sorular | Integer | false | 1 | Belirlenen mağazaya sorulan soruları getirir. |
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",
"product": "Product|undefined",
"full_name": "String",
"title": "String",
"message": "String",
"subject": "String",
"answer": "Answer|null",
"question_for": "String",
"created_at": "Date",
"updated_at": "Date"
}
]
}
}
Soruları Cevaplama
Mağazaya sorulmuş belirtilen soruyu cevaplamak 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/question/reply/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'
-d '{
"product_question_id": "{PRODUCT_QUESTION_ID}",
"title": "{REPLY_TITLE}",
"message": "{REPLY_MESSAGE}",
}'
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/question/reply/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 => "POST",
CURLOPT_POSTFIELDS => array(
"product_question_id" => "{PRODUCT_QUESTION_ID}",
"title" => "{REPLY_TITLE}",
"message" => "{REPLY_MESSAGE}",
),
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. Örnekte requests kullanılmaktadır.
import requests
url = "https://api.allesgo.com/v1.0/question/reply/store/{{STORE_ID}}"
querystring = {"access_token":"{{ACCESS_TOKEN}}"}
payload = {
'product_question_id': '{{PRODUCT_QUESTION_ID}}',
'title': '{{REPLY_TITLE}}',
'message': '{{REPLY_MESSAGE}}'
}
headers = {
'Accept': "application/json",
'Cache-Control': "no-cache",
'Host': "api.allesgo.com",
'Connection': "keep-alive",
'cache-control': "no-cache"
}
response = requests.request("POST", url, data=payload, 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: 'POST',
url: 'https://api.allesgo.com/v1.0/question/reply/store/{STORE_ID}',
qs: { access_token: '{ACCESS_TOKEN}' },
headers: {
'cache-control': 'no-cache',
Connection: 'keep-alive',
Host: 'api.allesgo.com',
Accept: 'application/json',
},
body: {
title: '{REPLY_TITLE}',
message: '{REPLY_MESSAGE}',
product_question_id: '{PRODUCT_QUESTION_ID}',
},
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_question_id: '{PRODUCT_QUESTION_ID}',
title: '{REPLY_TITLE}',
message: '{REPLY_MESSAGE}',
});
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/question/reply/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/question/reply/store/{STORE_ID}?access_token={ACCESS_TOKEN}");
var request = new RestRequest(Method.POST);
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");
var body = new
{
product_question_id = "{PRODUCT_QUESTION_ID}",
title = "{REPLY_TITLE}",
message = "{REPLY_MESSAGE}"
};
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_question_id\": \"{PRODUCT_QUESTION_ID}\", \"title\": \"{REPLY_TITLE}\",\"message\": \"{REPLY_MESSAGE}\"}");
Request request = new Request.Builder()
.url("https://api.allesgo.com/v1.0/question/reply/store/{STORE_ID}?access_token={ACCESS_TOKEN}")
.post(body)
.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"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.allesgo.com/v1.0/question/reply/store/{STORE_ID}?access_token={ACCESS_TOKEN}"
payload := strings.NewReader("{\"product_question_id\": \"{PRODUCT_QUESTION_ID}\", \"title\": \"{REPLY_TITLE}\",\"message\": \"{REPLY_MESSAGE}\"}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
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 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_question_id | Ürün Sorusu ID'si | ObjectId | true | Ürün Sorusu ID'si | ||
| title | Cevabın Başlığı | String | false | Cevabın Başlığı | ||
| message | Cevabın Mesajı | String | true | Cevabın Mesajı |
Sunucudan dönecek cevabın örneği.
{
"data": {
"success": true
}
}