1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Qoo10 APIの使い方

Last updated at Posted at 2024-07-14

Qoo10とは、eBay Japan合同会社が運営する日本国内向けの総合ECモールです。

API/FTPの発行申請

下記公式資料で簡単に発行できる。

Qoo10_12.PNG

APIの認証キー取得

CertificationAPI.CreateCertificationKey
販売認証キー発行時に使用するAPIです。
1つのAPIキーでリクエストが可能。

import requests
import xml.etree.ElementTree as ET

def CreateCertificationKey(USER_ID, PASS, API_KEY):
	url = "https://api.qoo10.jp/GMKT.INC.Front.QAPIService/ebayjapan.qapi/CertificationAPI.CreateCertificationKey"
	headers = {"Content-Type":"application/x-www-form-urlencoded","Content-Length":"length","GiosisCertificationKey":API_KEY,"QAPIVersion":"1.0"}
	params = {"returnType":"text/xml","user_id":USER_ID,"pwd":PASS}
	req = requests.post(url=url,headers=headers,data=params)
	print(req.text)

USER_ID = #QSMのログインID
PASS = #QSMのログインPASS
API_KEY = #事前に発行したAPIキー
xml_data = CreateCertificationKey(USER_ID,PASS,API_KEY)

xml_root = ET.fromstring(xml_data)
result_msg = xml_root.find('ResultMsg').text
SAK = xml_root.find('ResultObject').text
print(result_msg, SAK)

成功 S5bnbfynQvOITqzcbzMRK7Yy_g_1_w4CZi*********************************************************************

販売情報取得

ShippingBasic.GetShippingInfo_v3
販売の内訳を照会するためのAPIメソッドです。

下記リンクで、Input ParameterとOutput Parameterが確認できる。

def GetShippingInfo_v3(SAK, StartDate, EndDate):
    url = "https://api.qoo10.jp/GMKT.INC.Front.QAPIService/ebayjapan.qapi/ShippingBasic.GetShippingInfo_v3"
    headers = {"Content-Type":"application/x-www-form-urlencoded","Content-Length":"length","GiosisCertificationKey":SAK,"QAPIVersion":"1.0"}
    params = {"returnType":"application/json","ShippingStatus":'5',"SearchStartDate":StartDate,"SearchEndDate":EndDate,"SearchCondition":'4'}
    req = requests.post(url=url,headers=headers,data=params)
    result = json.loads(req.text)
    return result

now = datetime.now()
one_month_ago_rms = now + timedelta(hours=9) - timedelta(days=30)
monthagodate = one_month_ago_rms.strftime("%Y%m%d")
yesterdaydate = now + timedelta(hours=9) - timedelta(days=1)
yesterdaydate = yesterdaydate.strftime("%Y%m%d")
res = GetShippingInfo_v3(SAK, wookagodate, yesterdaydate)

登録商品の全商品情報取得

ItemsLookup.GetAllGoodsInfo
販売者が登録した商品の取引の状態別照会をするためのAPIメソッドです。
(1ページに最大500個までの商品が照会が可能。ページを指定表示することができます。)

ファイルをダウンロード

ItemsLookup.RequestFileDownload
情報(item、inventory、order、ship)をダウンロードをするためのAPIメソッドです

商品登録

様々な商品情報を設定することで、1商品ごとに商品登録することができる。
既に登録している商品コードをリクエストした場合、重複はできないとエラーがでる。

def SetNewGoods(SAK, params):
    url = "https://api.qoo10.jp/GMKT.INC.Front.QAPIService/ebayjapan.qapi/ItemsBasic.SetNewGoods"
    headers = {"Content-Type":"application/x-www-form-urlencoded","Content-Length":"length","GiosisCertificationKey":SAK,"QAPIVersion":"1.1"}
    req = requests.post(url=url,headers=headers,data=params)
    result = json.loads(req.text)
    return result

params = {
    "returnType":"application/json",
    "SecondSubCat":"320002604", # 商品の種類に対応したQoo10カテゴリーコードです。 * QSM BulK-data ManagementでQoo10カテゴリーコード情報をダウンロードすることができます。
    "OuterSecondSubCat":"", # 販売者が使用している外部または独自のカテゴリーコードです。
    "Drugtype":"", # 医薬品カテゴリーを選択する際は必ず入力してください。 (1C : 第1類医薬品, 2C : 第2類医薬品, 3C : 第3類医薬品, D2 : 指定第2類医薬品, QD : 医薬部外品)
    "BrandNo":"", # Qoo10に登録されたブランドのコードです。新規ブランド登録要請は、QSMを通じてリクエストすることができます。
    "ItemTitle":"Test Product name2",
    "PromotionName":"説明文", # 広告文
    "SellerCode":"codea4567", # 販売商品コード:販売者が管理する商品番号です。この情報をKey値に今後の価格などの修正が可能です。
    "IndustrialCodeType":"J",
    "IndustrialCode":"", # JAN
    "ModelNM":"", # モデル名
    "ManufactureDate":"", # 製造日 YYY-MM-DD
    "ProductionPlaceType":"1", # 原産地タイプ(国内=1、海外=2、その他=3)
    "ProductionPlace":"", # 商品の原産情報(国または地域名)
    "Weight":"", # 重量
    "Material":"", # 素材(ex: Polyester50%、Synthetic50%)
    "AdultYN":"N", # アダルトグッズかどうか:アダルトグッズの場合”Y”、アダルトグッズではない場合”N”
    "ContactInfo":"", # アフターサービス情報
    "StandardImage":"https://************.jpg", # 商品の代表画像。商品画像のURLを入力してください。 (ex.standardimage = http://image.qoo10.jo.img.jpg)
    "VideoURL":"", # 動画URL
    "ItemDescription":"", # 商品説明。商品ページに案内されている商品説明です。 HTML形式で入力して下さい。
    "AdditionalOption":"", # 追加オプション
    "ItemType":"", # オプション(組み合わせ型)
    "RetailPrice":"0", # 売価格です。もし小売価格がわからない場合は、0を入力してください
    "ItemPrice":"12500", # 商品の販売価格
    "TaxRate":"S", # 消費税率
    "ItemQty":"1", # 商品の数量
    "ExpireDate":"2050-01-01", # 商品の販売終了日。(yyyy-mm-dd)
    "ShippingNo":"687813", # Qoo10送料コード。QSM送料管理メニューで、使用する送料のコードを確認してください。 0を入力すると送料無料が設定されます。
    "AvailableDateType":"0", # "商品発送可能日タイプです。数字で入力してください。(0,1,2,3)
    "AvailableDateValue":"3", # "商品発送可能日タイプの詳細内容です。
    "Keyword":"" # 検索ワード 10個まで設定可能(ex: シャツ,デニム,春)
}
res = SetNewGoods(SAK, params)
print(res)

カテゴリーリスト取得

Qoo10の全カテゴリーリストと対応するカテゴリーIDを取得することができる。
カテゴリーIDは商品登録時に使用する。

def GetCatagoryListAll(SAK):
    url = "https://api.qoo10.jp/GMKT.INC.Front.QAPIService/ebayjapan.qapi/CommonInfoLookup.GetCatagoryListAll"
    headers = {"Content-Type":"application/x-www-form-urlencoded","Content-Length":"length","GiosisCertificationKey":SAK,"QAPIVersion":"1.0"}
    params = {"returnType":"application/json","lang_cd":"JP"}
    req = requests.post(url=url,headers=headers,data=params)
    result = json.loads(req.text)
    return result

path_w = 'qoo10_category.txt'
with open(path_w, mode='w') as f:
    f.write('CATE_L_CD, CATE_L_NM, CATE_M_CD, CATE_M_NM, CATE_S_CD, CATE_S_NM\n')

res = GetCatagoryListAll(SAK)
for item in res['ResultObject']:
    CATE_L_CD = item['CATE_L_CD']
    CATE_L_NM = item['CATE_L_NM']
    CATE_M_CD = item['CATE_M_CD']
    CATE_M_NM = item['CATE_M_NM']
    CATE_S_CD = item['CATE_S_CD']
    CATE_S_NM = item['CATE_S_NM']
    print(CATE_L_CD, CATE_L_NM, CATE_M_CD, CATE_M_NM, CATE_S_CD, CATE_S_NM)
    with open(path_w, mode='a', errors='ignore') as f:
        f.write('{},{},{},{},{},{}\n'.format(CATE_L_CD, CATE_L_NM, CATE_M_CD, CATE_M_NM, CATE_S_CD, CATE_S_NM))

配送情報の取得

QSMに登録されているユーザー固有の配送設定を取得することができる。
配送IDは商品登録時に使用する。

def GetSellerDeliveryGroupInfo(SAK):
    url = "https://api.qoo10.jp/GMKT.INC.Front.QAPIService/ebayjapan.qapi/ItemsLookup.GetSellerDeliveryGroupInfo"
    headers = {"Content-Type":"application/x-www-form-urlencoded","Content-Length":"length","GiosisCertificationKey":SAK,"QAPIVersion":"1.0"}
    params = {"returnType":"application/json"}
    req = requests.post(url=url,headers=headers,data=params)
    result = json.loads(req.text)
    return result

res = GetSellerDeliveryGroupInfo(SAK)
for ShippingInfo in res['ResultObject']:
    print(ShippingInfo)
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?