このAPIを使用して、すべての製品を収集し、製品/バリアントを検索して、アセットをリンク/リンク解除します。
製品検索
製品を表示するには、GETリクエストを送信してください:
https://app.digital-downloads.com/api/v1/products
製品を検索するには、クエリー文字列パラメータを追加することができます。結果はページ分割されます。クエリー文字列パラメータを使用する page
をご覧いただくか、回答にあるリンクをご利用ください。
JSON
{
"limit": 100, // max of 1000 will be retuned
"name": "my new book", // searches name of product/vairant
"sku": "my-sku",
"product_id": 123456, // product_id that is generated by Shopify
"vendor": "my-store",
"tag": "books",
"page": 3,
"with_assets": false // show linked assets
}
応答
JSON
{
"data": [
{
"id": "82664d96-6dfd-4343-96b0-05c46f412a5q",
"name": "My new Book",
"variant_name": "Paper back",
"sku": "my-sku",
"product_id": 123456,
"variant_id": 1234567,
"vendor": "my-store",
"tags": [
"books",
"paper-books"
]
},
{
"id": "82664d96-6dfd-4343-96b0-05c46f412a5r",
"name": "My new Book",
"variant_name": "Hard back",
"sku": "my-sku",
"product_id": 123456,
"variant_id": 1234563,
"vendor": "my-store",
"tags": [
"books",
"hardback-books"
]
}
],
"links": {
"first": "https://app.digital-downloads.com/api/v1/products?page=1",
"last": "https://app.digital-downloads.com/api/v1/products?page=4",
"prev": null,
"next": "https://app.digital-downloads.com/api/v1/products?page=2"
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 4,
"links": [
{
"url": null,
"label": "« Previous",
"active": false
},
{
"url": "https://app.digital-downloads.com/api/v1/products?page=1",
"label": "1",
"active": true
},
{
"url": "https://app.digital-downloads.com/api/v1/products?page=2",
"label": "2",
"active": false
},
{
"url": "https://app.digital-downloads.com/api/v1/products?page=3",
"label": "3",
"active": false
},
{
"url": "https://app.digital-downloads.com/api/v1/products?page=4",
"label": "4",
"active": false
},
{
"url": "https://app.digital-downloads.com/api/v1/products?page=2",
"label": "Next »",
"active": false
}
],
"path": "https://app.digital-downloads.com/api/v1/products",
"per_page": 25,
"to": 25,
"total": 76
}
}
製品を見る
個々の製品を表示するには、オプションでリンクされた資産をロードします。GETリクエストを送信する:
https://app.digital-downloads.com/api/v1/products/:id
例
https://app.digital-downloads.com/api/v1/products/82664d96-6dfd-4343-96b0-05c46f412a5q?with_assets=true
応答
JSON
{
"data": {
"id": "82664d96-6dfd-4343-96b0-05c46f412a5q",
"name": "My new Book",
"variant_name": "Paper back",
"sku": "my-sku",
"product_id": 123456,
"variant_id": 1234567,
"vendor": "my-store",
"tags": [
"books",
"paper-books"
],
"assets": [
{
"id": "82664d96-6dfd-4343-96b0-05c46f412a5b",
"filename": "My new book",
"size": "10MB",
"is_file": false,
"is_link": true,
"url": "https://www.my-website.com/download/my-book.pdf"
}
]
}
}