HomeGuidesAPI ReferenceChangelogDiscussions
HomeLog In
Guides

OpenAPI request example

📘

Open API時間均採用 UTC +0 時區, 開發時請注意時差的轉換

Example:
台灣時間時區為 GMT +8 ,
台灣時間 2018-04-07 00:00:00 ,換算為UTC時間為 2018-04-06 16:00:00

❗️

Same IP requesting more than 1000 requests in 5 min will be banned.

為維護使用效能,如果同一個IP在五分鐘內超過1000次requests,則會被暫時封鎖
It is a moving window so the banned time would be 5 minutes.

Get Products

Get Products document

# 需帶入 :per_page, :page, :access_token, :user_agent
# * user_agent:為 Shopline OpenAPI 必帶的一個 header value, example 使用 "Shopline", 需替換為貴司的handle代號

# Must fill-in :per_page, :page, :access_token, :user_agent
# * user_agent:It's a must-have Shopline OpenAPI header value,such as "Shopline". This should be your "handle code."

curl -X GET \
  'https://open.shopline.io/v1/products?per_page=:per_page&page=:page' \
  -H 'accept: application/json' \
  -H 'authorization: Bearer :access_token' \
  -H 'User-Agent: :user_agent'

# e.g 
curl -X GET \
  'https://open.shopline.io/v1/products?per_page=100&page=1' \
  -H 'accept: application/json' \
  -H 'authorization: Bearer 6e3130f448177e5f64bab4b1718008c6e146cfbc54e5b894f7f48e385600d26d'
  -H 'User-Agent: Shopline test'

Update Product Quantity

Update Product Quantity Document

# 需帶入 :product_id, :access_token, :quantity, :user_agent, :length
# 帶入form parameters 時, 請帶在body內(-F quantity=:quantity),不要帶在url上
# Header內必須加入 Content-Length (即 request body length)
# * user_agent:為 Shopline OpenAPI 必帶的一個 header value, example 使用 "Shopline", 需替換為貴司的handle代號

# Must fill-in :product_id, :access_token, :quantity, :user_agent, :length
# When filling in form parameters, please enter in body(-F quantity=:quantity),not in the url.
# Please fill in Content-Length(length of request body) in the Header
# * user_agent:It's a must-have Shopline OpenAPI header value,such as "Shopline". This should be your "handle code."

curl -X PUT \
  https://open.shopline.io/v1/products/:product_id/update_quantity \
  -H 'accept: application/json' \
  -H 'authorization: Bearer :access_token' \
  -H 'content-type: multipart/form-data;' \
  -H 'Content-Length: :length' \
  -H 'User-Agent: :user_agent' \
  -F quantity=:quantity


# e.g 
curl -X PUT \
https://open.shopline.io/v1/products/5a5c7c14e388094206000034/update_quantity \
  -H 'accept: application/json' \
  -H 'authorization: Bearer 6e3130f448177e5f64bab4b1718008c6e146cfbc54e5b894f7f48e385600d26d' \
  -H 'content-type: multipart/form-data;' \
  -H 'Content-Length: 0' \
  -H 'User-Agent: shopline test' \
  -F quantity=10