Fetch data from api

Banggood Affiliate Data API
Banggood Affiliate Data API
Update Note
Introduction
Get Access Token
Request Address
Request Parameters
Signature description
Return Value
Object
Return Data Example
Errors
400 (Bad Request)
401 (Unauthorized)
403 (Forbidden)
Get Coupou List
Request Address
Request Parameters
Return Value
Object
coupon object
Return Data Example
Errors
400 (Bad Request)
401 (Unauthorized)
403 (Forbidden)
Get Coupon Detail
Request Address
Request Parameters
Return Value
Object
product object
Return Data Example
Errors
400 (Bad Request)
401 (Unauthorized)
403 (Forbidden)
Get Product Category
Request Address
Request Parameters
Return Value
Object
category object
Return Data Example
Errors
400 (Bad Request)
401 (Unauthorized)
403 (Forbidden)
Get Product List
Request Address
Request Parameters
Return Value
Object
updated_at note
2020-02-20 Coupon.list API: Modify the category_id parameter as optional
Attribute Type Default Required Description
api_key string Yes
The Api Key. It is unique credential of
the affiliate. You can obtain it by contact
us.
noncestr string Yes
A random string, which is set and
passed by affiliate to enhance security,
which must be not greater than 32
characters.
The timestamp generated by affiliate
user, which is the number of seconds
elapsed from January 1, 1970 at
product object
product object
Return Data Example
Get Product Detail
Request Address
Request Parameters
Return Value
Object
Return Data Example
Common Error
400 (Bad Request)
401 (Unauthorized)
403 (Forbidden)
Update Note
Introduction
The Bangggood Affiliate data API allows affiliate user to build their own programs using affilaite
data.
Get Access Token
Request Address
GET https://affapi.banggood.com/getAccessToken
Request Parameters
Attribute Type Default Required Description
timestamp string Yes
p J y
00:00:00 to the current time and needs
to be converted into a string. This
parameter is passed after generated by
the affiliate, and its value must be
dynamically generated for each addition
request. Duplicate values may cause
claim failure.
signature string Yes
A signature. The signs parameters in the
API list as required using md5. See
below for specific signature methods.
This parameter is passed by the affiliate
according to the signature rules.
Attribute Type Description
access_token string The obtained credential.
expires_in number
The time when the credential expires, in seconds. Its value is
within 7,200 seconds.
code number Result code, 200 is successful, others are failed
msg string Error message
Signature description

  1. Sort the string values of api_key, api_secret, noncestr, timestamp in lexicographical order.
  2. Join the strings of the parameters into a string and hash the string with md5 to generate
    signature.
    For example. If api_key=EZrwQGmWOOjxIfBV, api_secret=yrTdFSKftSmxRmAZQbkHMnJLLfvEXlWI,
    nonce_str=5K8264ILTKCH16CQ2502SI8ZNMTM67VS, timestamp= 1577169825, then
    signature=md5(‘api_key=EZrwQGmWOOjxIfBV&api_secret=yrTdFSKftSmxRmAZQbkHMnJLLfvEXlW
    I&noncestr=5K8264ILTKCH16CQ2502SI8ZNMTM67VS&timestamp=1577169825’)=c0a217e73345b
    ccebc45f2c18714a831.
    Return Value
    Object
    JSON data package that is returned
    Return Data Example
    Attribute Type Default Required Description
    category_id string No Identifier of category
    currency string USD No
    Code of the currency symbol. use for
    fields relating to money.
    lang string en-GB No
    Code of the language symbol. Use for
    fields existing multiply languages. For
    example product_name.
    Errors
    400 (Bad Request)
  3. Invalid HTTP Method
  4. Missing required Parameters
    401 (Unauthorized)
  5. API key is invalid
  6. API key is expired
  7. Signature is invalid
    403 (Forbidden)
  8. Quota exceeded
    Get Coupou List
    Request Address
    GET https://affapi.banggood.com/coupon/list
    Request Parameters
    To access the API, The request need an access-token to be passed in the request header.
    access-token: 7d83c1601e45168eb8f5dc8f13aacd21
    You can get the access-token using the Get request to /getAccessToken . Detail to see
    getAccessToken Page.
    {
    “code”: 200,
    “result”: {
    “access_token”: “7d83c1601e45168eb8f5dc8f13aacd21”,
    “expires_in”: 7200
    },
    “msg”: “”
    }
    Attribute Type Description
    page_total number Page total
    coupon_list array of coupon coupon list
    Attribute Type Description
    coupon_name string Discount method of the coupon, such as 90% off
    coupon_code string The coupon code
    coupon_description string The coupon description
    coupon_date_start string Effective datetime start from
    coupon_date_end string The expiration datetime, It’s based on UTC+8 timezone
    url string The coupon campaign url
    Return Value
    Object
    JSON data package that is returned
    coupon object
    Return Data Example
    Errors
    {
    “code”: 200,
    “result”: {
    “page_total”: 1,
    “coupon_list”: [
    {
    “coupon_code”: “7e83e6”,
    “coupon_name”: “%13 OFF”,
    “coupon_description”: “”,
    “coupon_residual”: 500,
    “coupon_date_start”: “2020-01-06”,
    “coupon_date_end”: “2020-01-31”,
    “url”: “https://www.banggood.com/NITECORE-TIKITIKI-LE-300-Lumen-
    USB-Rechargeable-LED-Keychain-Flashlight-p-1619198.html?
    utm_campaign=BGTIKI&p=5E160673791674720180”
    }
    ]
    },
    “msg”: “”
    }
    Attribute Type Default Required Description
    coupon_code string Yes The coupon code
    currency string USD No
    Code of the currency symbol. use for
    fields relating to money.
    lang string en-GB No
    Code of the language symbol. Use for
    fields existing multiply languages. For
    example product_name.
    400 (Bad Request)
  9. Invalid HTTP Method
  10. Missing required Parameters
  11. Parameter is invalid
    401 (Unauthorized)
  12. Access token was expired
    403 (Forbidden)
  13. Quota exceeded
  14. Don’t have right to access the API
    Get Coupon Detail
    Request Address
    GET https://affapi.banggood.com/coupon/detail
    Request Parameters
    To access the API, The request need an access-token to be passed in the request header.
    access-token: 7d83c1601e45168eb8f5dc8f13aacd21
    You can get the access-token using the Get request to /getAccessToken . Detail to see
    getAccessToken Page.
    Return Value
    Object
    JSON data package that is returned
    Attribute Type Description
    coupon_id number The coupon ID
    coupon_code string The coupon code
    coupon_name string The coupon name
    coupon_description string The coupon description
    coupon_residual number
    Remaining number of times (Minus sent count
    with used)
    coupon_date_start string Effective datetime start from
    coupon_date_end string
    The expiration datetime, It’s based on UTC+8
    timezone
    product_list
    array of
    product
    Coupons can be used in products
    Attribute Type Description
    product_id number Identifier of product
    product_url string Web page URL of the product
    category_id number Identifier of product category.
    product_name string Name of product.
    product_price string Price for product(formatted with currency)
    product_coupon_price string
    Price for product after use coupon(formatted with
    currency)
    commission string Total lead commission (formatted with currency)
    coupon_name string Discount method of the coupon, such as 90% off
    small_image string The thumbnail image. It’s 50px wide and 50px tall.
    list_grid_image string The thumbnail image. It’s 120px wide and 120px tall.
    product object
    Attribute Type Description
    view_image string The thumbnail image. It’s 360px wide and 360px tall.
    modify_date string Last updated time of the product
    Return Data Example
    Errors
    400 (Bad Request)
  15. Invalid HTTP Method
  16. Missing required Parameters
  17. Parameter is invalid
    {
    “code”: 200,
    “result”: {
    “coupon_id”: 273590,
    “coupon_code”: “7e83e6”,
    “coupon_name”: “SKU932513”,
    “coupon_description”: “SKU932513”,
    “coupon_residual”: 0,
    “coupon_date_start”: “2019-12-04 00:00:00”,
    “coupon_date_end”: “2020-02-16 00:00:00”,
    “product_list”: [
    {
    “product_id”: 1094163,
    “product_url”: “https://www.banggood.com/Suleve-M3CH2-M3-Carbon-
    Steel-Allen-Bolt-4-20mm-Button-Head-Hex-Socket-Cap-Screw-Bolt-Metric-120pcs-p-
    1094163.html?p=3r23fdvcdwfywef34”,
    “category_id”: 6536,
    “product_name”: “Suleve™ M3CH2 M3 Carbon Steel Allen Bolt 4-20mm
    Button Head Hex Socket Cap Screw Bolt Metric 120pcs”,
    “product_price”: “US$8.75”,
    “product_coupon_price”: “US$8.14”,
    “commission”: “US$0.96”,
    “coupon_name”: “7% OFF”,
    “small_image”:
    https://imgaz.staticbg.com/thumb/gallery/oaupload/banggood/images/FE/2E/8c07dd4
    5-b894-400d-85eb-cb2bd3b15c33.jpg”,
    “list_grid_image”:
    https://imgaz.staticbg.com/thumb/view/oaupload/banggood/images/FE/2E/8c07dd45-
    b894-400d-85eb-cb2bd3b15c33.jpg”,
    “view_image”:
    https://imgaz1.staticbg.com/thumb/list_grid/oaupload/banggood/images/FE/2E/8c07
    dd45-b894-400d-85eb-cb2bd3b15c33.jpg”,
    “modify_date”: “2018-09-06 14:55:14”
    }
    ]
    },
    “msg”: “”
    }
    Attribute Type Default Required Description
    lang string en-GB No
    Code of the language symbol. Use
    for fields existing multiply languages.
    For example cat_name.
    category_id number No Identifier of category
    Attribute Type Description
    category_id number Identifier of category
    category_name string name of the category
    children array of category children category list under category_id
    401 (Unauthorized)
  18. Access token was expired
    403 (Forbidden)
  19. Quota exceeded
  20. Don’t have right to access the API
    Get Product Category
    Request Address
    GET https://affapi.banggood.com/product/category
    Request Parameters
    To access the API, The request need an access-token to be passed in the request header.
    access-token: 7d83c1601e45168eb8f5dc8f13aacd21
    You can get the access-token using the Get request to /getAccessToken . Detail to see
    getAccessToken Page.
    Return Value
    Object
    JSON data package that is returned
    category object
    The category object is same as above
    Return Data Example
    {
    “code”: 200,
    “result”: [
    {
    “category_id”: “2365”,
    “category_name”: “Electronic Cigarette & Acc”,
    “children”: [
    {
    “category_id”: “2367”,
    “category_name”: “Electronic Cigarette”,
    “children”: null
    },
    {
    “category_id”: “3803”,
    “category_name”: “Kits”,
    “children”: [
    {
    “category_id”: “3806”,
    “category_name”: “Mod Kits”,
    “children”: null
    },
    {
    “category_id”: “3808”,
    “category_name”: “Cartomizer Kits”,
    “children”: null
    },
    {
    “category_id”: “3809”,
    “category_name”: "E-cigar Kits ",
    “children”: null
    }
    ]
    },
    {
    “category_id”: “3493”,
    “category_name”: “Mods”,
    “children”: [
    {
    “category_id”: “3804”,
    “category_name”: “Box Mods”,
    “children”: null
    },
    {
    “category_id”: “3805”,
    “category_name”: “VV&VM Mods”,
    “children”: null
    },
    {
    “category_id”: “3807”,
    “category_name”: “Mechanical Mods”,
    “children”: null
    }
    ]
    },
    {
    “category_id”: “2524”,
    “category_name”: “Atomizers”,
    “children”: [
    {
    “category_id”: “3810”,
    “category_name”: “Bottom Vertical Coil
    Clearomizers”,
    “children”: null
    },
    {
    “category_id”: “3811”,
    “category_name”: “Bottom Coil Clearomizers”,
    “children”: null
    },
    {
    “category_id”: “3815”,
    “category_name”: “Top Coil Clearomizers”,
    “children”: null
    },
    {
    “category_id”: “3814”,
    “category_name”: “Dual Coil Clearomizers”,
    “children”: null
    },
    {
    “category_id”: “3812”,
    “category_name”: “Airflow Adjustable Clearomizers”,
    “children”: null
    },
    {
    “category_id”: “3813”,
    “category_name”: “Pyrex Glass Clearomizers”,
    “children”: null
    }
    ]
    },
    {
    “category_id”: “2366”,
    “category_name”: “E-liquid”,
    “children”: null
    },
    {
    “category_id”: “2525”,
    “category_name”: “Batteries”,
    “children”: null
    },
    {
    “category_id”: “3802”,
    “category_name”: "Coils ",
    “children”: null
    },
    {
    “category_id”: “2527”,
    “category_name”: “Accessories”,
    “children”: [
    {
    “category_id”: “3819”,
    “category_name”: “chargers”,
    Errors
    400 (Bad Request)
  21. Invalid HTTP Method
  22. Missing required Parameters
  23. Parameter is invalid
    401 (Unauthorized)
  24. Access token was expired
    403 (Forbidden)
  25. Quota exceeded
  26. Don’t have right to access the API
    Get Product List
    Request Address
    GET https://affapi.banggood.com/product/list
    “children”: null
    },
    {
    “category_id”: “3818”,
    “category_name”: "Bottles ",
    “children”: null
    },
    {
    “category_id”: “3817”,
    “category_name”: "Tools ",
    “children”: null
    }
    ]
    },
    {
    “category_id”: “3073”,
    “category_name”: “Drip Tips”,
    “children”: null
    },
    {
    “category_id”: “3801”,
    “category_name”: “Other E-cigarettes”,
    “children”: null
    }
    ]
    }
    ],
    “msg”: “”
    }
    Attribute Type Default Required Description
    lang string en-GB No
    Code of the language symbol. Use
    for fields existing multiply languages.
    For example cat_name.
    category_id number No Identifier of category
    currency string USD No
    Code of the currency symbol. use for
    fields relating to money.
    Attribute Type Description
    page_total number Page total
    product_list array of product product list
    Attribute Type Description
    product_id number Identifier of product
    product_url string Web page URL of the product
    category_id number Identifier of product category.
    product_name string Name of product.
    product_price string Price for product(formatted with currency)
    product_coupon_price string
    Price for product after use coupon(formatted with
    currency)
    commission string Total lead commission (formatted with currency)
    coupon_name string Discount method of the coupon, such as 90% off
    Request Parameters
    To access the API, The request need an access-token to be passed in the request header.
    access-token: 7d83c1601e45168eb8f5dc8f13aacd21
    You can get the access-token using the Get request to /getAccessToken . Detail to see
    getAccessToken Page.
    Return Value
    Object
    JSON data package that is returned
    product object
    product object
    Attribute Type Description
    coupon_code string The coupon code
    small_image string The thumbnail image. It’s 50px wide and 50px tall.
    list_grid_image string The thumbnail image. It’s 120px wide and 120px tall.
    view_image string The thumbnail image. It’s 360px wide and 360px tall.
    modify_date string Last updated time of the product
    Return Data Example
    {
    “code”: 200,
    “result”: {
    “page_total”: 10,
    “product_list”: [
    {
    “product_id”: 8255,
    “product_url”: “https://www.banggood.com/Wholesale-Nail-Art-
    Stainless-Steel-Cuticle-Cutter-Nippers-Clipper-p-8255.html?
    p=5E160673791674720180”,
    “category_id”: 1367,
    “product_name”: “Nail Art Stainless Steel Cuticle Cutter Nippers
    Clipper”,
    “product_price”: 7.56,
    “product_coupon_price”: 7.56,
    “commission”: 1.51,
    “coupon_name”: “”,
    “coupon_code”: “”,
    “small_image”:
    https://imgaz2.staticbg.com/thumb/gallery/upload/beauty/SKU005967.jpg”,
    “list_grid_image”:
    https://imgaz2.staticbg.com/thumb/view/upload/beauty/SKU005967.jpg”,
    “view_image”:
    https://imgaz3.staticbg.com/thumb/list_grid/upload/beauty/SKU005967.jpg”,
    “modify_date”: “2018-09-18 08:58:36”
    },
    {
    “product_id”: 9125,
    “category_id”: 5333,
    “product_name”: "BT-168 Universal Battery Tester AA AAA C D 9V
    Button Checker ",
    “product_price”: 2.94,
    “product_coupon_price”: 2.94,
    “commission”: 0.32,
    “coupon_name”: “”,
    “coupon_code”: “”,
    “small_image”:
    https://imgaz3.staticbg.com/thumb/gallery/oaupload/banggood/images/BC/63/441eb8
    28-79c6-4b5e-a44d-1f1bddd5c15b.jpg”,
    “list_grid_image”:
    https://imgaz.staticbg.com/thumb/view/oaupload/banggood/images/BC/63/441eb828-
    79c6-4b5e-a44d-1f1bddd5c15b.jpg”,
    Attribute Type Default Required Description
    product_id string Yes Identifier of product
    currency string USD No
    Code of the currency symbol. use for
    fields relating to money.
    lang string en-GB No
    Code of the language symbol. Use for
    fields existing multiply languages. For
    example product_name.
    Get Product Detail
    Request Address
    GET https://affapi.banggood.com/product/detail
    Request Parameters
    To access the API, The request need an access-token to be passed in the request header.
    access-token: 7d83c1601e45168eb8f5dc8f13aacd21
    “view_image”:
    https://imgaz.staticbg.com/thumb/list_grid/oaupload/banggood/images/BC/63/441eb
    828-79c6-4b5e-a44d-1f1bddd5c15b.jpg”,
    “modify_date”: “2018-09-25 06:49:57”
    },
    {
    “product_id”: 16666,
    “category_id”: 1327,
    “product_name”: “500pcs Clear French Acrylic False 3D nail Tips
    Nail Art”,
    “product_price”: 9.32,
    “product_coupon_price”: 9.32,
    “commission”: 1.86,
    “coupon_name”: “”,
    “coupon_code”: “”,
    “small_image”:
    https://imgaz1.staticbg.com/thumb/gallery/oaupload/banggood/images/42/3F/b30159
    99-06a6-4688-b326-990d50caf327.jpg”,
    “list_grid_image”:
    https://imgaz2.staticbg.com/thumb/view/oaupload/banggood/images/42/3F/b3015999-
    06a6-4688-b326-990d50caf327.jpg”,
    “view_image”:
    https://imgaz3.staticbg.com/thumb/list_grid/oaupload/banggood/images/42/3F/b301
    5999-06a6-4688-b326-990d50caf327.jpg”,
    “modify_date”: “2018-09-22 16:45:59”
    }

    ]
    }
    }
    Attribute Type Description
    product_id number Identifier of product
    product_url string Web page URL of the product
    category_id number Identifier of product category.
    product_name string Name of product.
    product_price string Price for product(formatted with currency)
    product_coupon_price string
    Price for product after use coupon(formatted with
    currency)
    commission string Total lead commission (formatted with currency)
    coupon_code string The coupon code
    coupon_name string Discount method of the coupon, such as 90% off
    small_image string The thumbnail image. It’s 50px wide and 50px tall.
    list_grid_image string The thumbnail image. It’s 120px wide and 120px tall.
    view_image string The thumbnail image. It’s 360px wide and 360px tall.
    modify_date string Last updated time of the product
    You can get the access-token using the Get request to /getAccessToken . Detail to see
    getAccessToken Page.
    Return Value
    Object
    JSON data package that is returned
    Return Data Example
    {
    “code”: 200,
    “result”: {
    “product_id”: 1094163,
    “category_id”: 6536,
    “product_url”: “https://www.banggood.com/Suleve-M3CH2-M3-Carbon-Steel-
    Allen-Bolt-4-20mm-Button-Head-Hex-Socket-Cap-Screw-Bolt-Metric-120pcs-p-
    1094163.html?p=3r23fdvcdwfywef34”,
    “product_name”: “Suleve™ M3CH2 M3 Carbon Steel Allen Bolt 4-20mm Button
    Head Hex Socket Cap Screw Bolt Metric 120pcs”,
    “product_price”: “₱468.99”,
    “product_coupon_price”: “₱415.39”,
    “commission”: “₱51.46”,
    “coupon_name”: “$1 OFF”,
    Common Error
    400 (Bad Request)
  27. Invalid HTTP Method
  28. Missing required Parameters
  29. Parameter is invalid
    401 (Unauthorized)
  30. Access token was expired
    403 (Forbidden)
  31. Quota exceeded
  32. Don’t have right to access the API

I WANT TO ACCESS IT WITH FULL DETAILS ALONG WITH IMAGES IN DASHDASH.
IS THERE PROPER STEPWISE PROCEDURE TO DO SO.
SO PLEASE PROVIDE IT IN DETAILS VIEW.
i want it in step by step details

Hi @amit1234,

I can see that you are trying to access the Banggood Open Platform APIs. Can you please let me know which one of their APIs are you interested in using and which data do you want to retrieve? That way, I can look it up and help you set up your spreadsheet.

Looking forward to your reply!

1 Like

All data of the product I want to retrieve

https://api.banggood.com/index.php?com=document&article_id=8

Based on the API documentation, you will need an API ID and an API secret to retrieve an access token that you will use in the API calls.
You can set up the spreadsheet as follows:

A1: app_id
A2: app_secret
A3: Get token
A4: Access token
B1: [Enter API ID here]
B2: [Enter API Secret here]
B3: =GET(“https://api.banggood.com/getAccessToken?app_id="&B1&"&app_secret=”&B2)
B4: =PARSE(B3,“access_token”)

If the request is executed successfully, the access token will be shown in B4. You can then reference it in other calls.
For example, to use the GetProductInfo API, it would look something like this:

B6: =GET(“https://api.banggood.com/product/getProductInfo?access_token="&B4&"&product_id=123&currency=USD&lang=en”)

Finally, every access token retrieved is only valid for two hours. So one way to always have a valid access token is to set up an automation that refreshes the request, retrieving a new access token right before it expires.

B5: =REFRESH(B3,119)

Please let me know if this works for you or if you have any questions.

error i am getting now query is not a valid jsonpath

That means that the GET request in B3 didn’t return an access token for some reason.
Can you please check the JSON object returned in B3 and let me know what it shows you? Is there an error message there?

apikey hTYuxsGrgNTZChWB
apisecret UBhQDpwIuYusfGrmpfwPeBdybNZcadxF
please try it yourself as i am still getting error

The request is returning a 31020 error which according to the documentation indicates an incorrect APPid or APPsecret. Can you please double-check? As the Appid might be different from the API key.

Please find in the article below a guide on how to obtain both the Appid and AppSecret.
https://api.banggood.com/index.php?com=document&article_id=8

i had double checked it and it is correct word by word