Lazada API 調用過程記錄

官方SDK的下載

Downloading SDK

Before you can download SDK, you need to have registered as a developer and able to login to Lazada Open Platform. The downloaded SDK is associated with the application.node

Take the following steps to download SDK for your application:python

  1. Login Lazada Open Platform and open the APP Console page.
  2. Click Manage in the App list to open the App Overview page.
  3. In the App Management navigation panel, click SDK Download.
  4. Click the Download button to download the SDK for the specific programming language.

Downloading SDK
Lazada開放平臺
Lazada賣家中心json

SDK簡單測試

使用import lazop導入官方SDKsegmentfault

簡單測試返回目錄列表示例
# -*- coding: utf-8 -*-

import lazop

# params 1 : gateway url
# params 2 : appkey
# params 3 : appSecret
client = lazop.LazopClient(url, appkey, appSecret)

# create a api request set GET mehotd
# default http method is POST
request = lazop.LazopRequest('/category/tree/get','GET')

# simple type params ,Number ,String
request.add_api_param('api_id','1')

response = client.execute(request)
#response = client.execute(request,access_token)

# response type nil,ISP,ISV,SYSTEM
# nil :no error
# ISP : API Service Provider Error
# ISV : API Request Client Error
# SYSTEM : Lazop platform Error
print(response.type)

# response code, 0 is no error
print(response.code)

# response error message
print(response.message)

# response unique id
print(response.request_id)

# full response
print(response.body)

對於馬來站params 1參數設置爲'https://api.lazada.com.my/rest'
appkey是int變量,appSecret是string變量,去後臺App Console查看。
response.body最後返回的是json格式數據api

變量添加

經過request.add_api_param('api_id','1')以鍵值對的方式添加須要的變量
須要添加的變量在API說明頁面的Request Parametersapp

完整的API調用文檔ide

添加商品

獲取類目ID

1.可使用GetCategoryTree獲取目錄樹
文檔測試

client = lazop.LazopClient(url, appkey ,appSecret)
request = lazop.LazopRequest('/category/tree/get','GET')
response = client.execute(request)
print(response.type)
print(response.body)

2.也能夠在賣家後臺Batch上傳裏面下載Excel文件url

clipboard.png

經常使用IDspa

Men's Shoes and Clothing > Men Clothing > T-Shirts & Tanks > T-Shirts --- 4195

CreateProduct API
CreateProduct payload and parameter description

相關文章
相關標籤/搜索