商品レコメンデーションの取得
curl --request GET \
--url https://api.example.com/endpointimport requests
url = "https://api.example.com/endpoint"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/endpoint', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/endpoint",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/endpoint"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/endpoint")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/endpoint")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_bodyおすすめ
商品レコメンデーションの取得
レコメンダーコードを使用して、Kameleoon Product Recommendation API からパーソナライズされた商品レコメンデーションを取得します。
GET
/
endpoint
商品レコメンデーションの取得
curl --request GET \
--url https://api.example.com/endpointimport requests
url = "https://api.example.com/endpoint"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/endpoint', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/endpoint",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/endpoint"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/endpoint")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/endpoint")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_bodyこのエンドポイントは商品レコメンデーションを取得します。
リクエスト
GET https://api.products.kameleoon.com/recommend/{%recommender_code%}
クエリパラメーター
| パラメーター | 型 | 必須 | 説明 |
|---|---|---|---|
did | String | True | デバイス ID。KameleoonProducts_device_id クッキーからこの ID を取得します。このエンドポイントを呼び出す前に、バックエンドから取得してください。“Recently Viewed” や “Recommended for You” など、過去のデバイスデータに依存するフィルターまたはアルゴリズムを使用する場合にのみ did を提供します。 |
shop_id | String | True | ストアキー。Kameleoon アプリの Recommendations > Settings > Store settings で確認できます。必要に応じてカスタマーサクセスマネージャーにキーをお問い合わせください。 |
sid | String | True | 一時的なユーザーセッション ID。KameleoonProducts_session_code クッキーからこの ID を取得します。このエンドポイントを呼び出す前に、バックエンドから取得してください。“Recently Viewed” や “Recommended for You” など、過去のユーザーデータに依存するフィルターまたはアルゴリズムを使用する場合にのみ sid を提供します。 |
recommender_code | String | True | 商品レコメンデーションブロックの ID。recommender_code はブロック管理 UI で確認できます。 |
resize_image | Integer | Optional | リサイズ用の画像サイズ(px)。サポートされる値: 120、140、160、180、200、220。 |
extended | Integer or empty | Optional | 推奨商品の拡張情報を追加します。1 の場合、API はすべての商品情報を返します。空の場合、API は商品 ID のみを返します。 |
with_locations | Boolean | False | true で、かつ extended パラメーターも true の場合、レスポンスにはすべての在庫場所の location_ids が含まれます。extended が指定されていないか false の場合、API は with_locations を無視し、デフォルトで false になります。 |
レスポンス
| 名前 | 型 | 説明 |
|---|---|---|
html | string | 商品ブロックの HTML コード。Kameleoon の個人アカウントで HTML テンプレートをカスタマイズします。 |
title | string | ブロックのタイトル。ブロックルールの “Action” 要素の値と一致します。 |
recommends | array | 商品 ID のリスト。 |
id | number | 一意のブロック識別子。Kameleoon の個人アカウントのブロック ID と一致します。 |
このページは役に立ちましたか?
⌘I