Create Gifts
Function
To create new gift with Open API
透過Open API 建立新贈品
URL
POST <<api_domain>>/v1 /gifts
Request Parameters
Field | Type | Description | Example |
---|---|---|---|
title_translations | Hash | Gift Title 贈品名稱 | { "en": "create by open api"} |
media_ids | Array | Array of Media ID 一組圖片ID | ["603f06f7f6ba0c00451d0f12"] |
unlimited_quantity | Boolean | Gift unlimited quantity or not 贈品是否無限數量 | true |
sku | String | 贈品SKU | SKU-456344881 |
cost | Hash | Gift Cost 贈品成本 | { "dollars": 12} |
weight | Float | Gift Weight 贈品重量 | 12.1 |
quantity | Float | Gift Quantity 贈品數量 | 200 |
JSON Response Sample
{
"_id": "60d5b2b0ca4c5b00176ba405",
"cost": {
"cents": 12,
"currency_symbol": "NT$",
"currency_iso": "TWD",
"label": "NT$12",
"dollars": 12.0
},
"title_translations": {
"en": "create by open api"
},
"description_translations": {},
"media_ids": [
"603f06f7f6ba0c00451d0f12"
],
"owner_id": "5d8aecb7f21e4e00014d5ae7",
"sku": "GIFT-SKU-0001",
"status": "active",
"unlimited_quantity": true,
"weight": 12.1,
"created_at": "2021-06-25T10:40:48.970Z",
"updated_at": "2021-06-25T10:40:48.970Z",
"stock_ids": null,
"root_product_id": null,
"media": [],
"quantity": 0
}
Sample CURL Example
curl --location --request POST '<<api_domain>>/v1/gifts' \
--header 'Authorization: Bearer ${token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"title_translations": { "en": "Sample Gift 0001"},
"media_ids": ["603f06f7f6ba0c00451d0f12"],
"unlimited_quantity": true,
"sku": "GIFT-SKU-0001",
"cost": { "dollars": 12},
"weight": 12.1
}'
Updated about 3 years ago