いよいよ電脳卸ウェブサービスの商品検索API(以下、商品一覧検索APIと記載)を研究するのだ。
商品一覧検索APIで取得に成功
object(SimpleXMLElement)#4440 (1) {
[“Responce“]=>
object(SimpleXMLElement)#4603 (5) {
[“Hid”]=>
string(5) “38097”
[“TotalItems”]=>
string(3) “146”
[“TotalPages”]=>
string(1) “8”
[“Details”]=>
array(20) {
[0]=>
object(SimpleXMLElement)#4590 (39) {
[“ItemID”]=>
string(7) “2751030”
[“ShopID”]=>
string(5) “12355”
[“ProductName”]=>
string(82) “新感覚ニップレス【NEW ニップルシリコンパッド(10cm) Ver2】”
[“Price”]=>
string(3) “980”
[“DefaultPrice”]=>
string(1) “0”
[“ImageUrlSmall”]=>(以下略)
商品一覧検索APIでキーワードに該当するものがない(商品数ゼロ)
object(SimpleXMLElement)#4440 (1) {
[“Responce“]=>
object(SimpleXMLElement)#4603 (5) {
[“Hid”]=>
string(5) “38097”
[“TotalItems”]=>
string(1) “0”
[“TotalPages”]=>
string(1) “0”
[“Details”]=>
object(SimpleXMLElement)#4590 (0) {
}
[“CategoryTree”]=>
object(SimpleXMLElement)#4653 (0) {
}
}
}
This XML file does not appear to have any style information associated with it. The document tree is shown below.
上記の商品数0のときでも、カテゴリ検索では商品数カウントに値が存在している。
object(SimpleXMLElement)#4603 (2) {
[“Category”]=>
object(SimpleXMLElement)#4653 (3) {
[“CategoryId”]=>
string(2) “36”
[“CategoryName”]=>
string(39) “キッズ・ベビー・マタニティ”
[“Count”]=>
string(3) “126”
}
[“SubCategorys”]=>
object(SimpleXMLElement)#4659 (1) {
[0]=>
string(1) ”
”
}
}
商品一覧検索APIで要素指定が足りない
object(SimpleXMLElement)#4440 (1) {
[“error“]=>
object(SimpleXMLElement)#4603 (2) {
[“code”]=>
string(1) “1”
[“message”]=>
string(117) “検索には検索語、カテゴリーID、商品ID、ショップID、対象年齢のいずれかが必要です。”
}
}
商品一覧検索APIでカテゴリが存在しない
object(SimpleXMLElement)#4590 (1) {
[“error“]=>
object(SimpleXMLElement)#4440 (2) {
[“code”]=>
string(1) “1”
[“message”]=>
string(62) “入力されたカテゴリーIDは正しくありません。”
}
}
おそらく深夜バッチ中で、空のデータが返ってくる(しかしエラー表記はない)
(たぶん上記の商品数0データと同じ)
- 電脳卸…ログイン画面で詳しい情報が公開されています(PHPサンプルスクリプトあり)