🧑‍🏫

【Shopify.dev和訳】API Examples/ Shop

2021/09/18に公開

この記事について

この記事は、API   Examples/Shopの記事を和訳したものです。

記事内で使用する画像は、公式ドキュメント内の画像を引用して使用させていただいております。

Shopify アプリのご紹介

Shopify アプリである、「商品ページ発売予告アプリ | リテリア Coming Soon」は、商品ページを買えない状態のまま、発売日時の予告をすることができるアプリです。Shopify で Coming Soon 機能を実現することができます。

https://apps.shopify.com/shopify-application-314?locale=ja&from=daniel

Shopify アプリである、「らくらく日本語フォント設定|リテリア Font Picker」は、ノーコードで日本語フォントを使用できるアプリです。日本語フォントを導入することでブランドを演出することができます。

https://apps.shopify.com/font-picker-1?locale=ja&from=daniel

ショップデータを取得する

以下は、ショップの GraphQL クエリの例です。 詳細については、shop object reference.を参照してください。

最初の 3 つの製品のショップ ID、名前、およびハンドルを取得します

Query: POST /api/2021-07/graphql.json

{
  shop {
    id
    name
  }
  products(first: 3) {
    edges {
      node {
        handle
      }
    }
  }
}
json response
{
  "data": {
    "shop": {
      "id": "gid://shopify/Shop/1111111",
      "name": "John's Apparel"
    },
    "products": {
      "edges": [
        {
          "node": {
            "handle": "personal-shopping"
          }
        },
        {
          "node": {
            "handle": "digital-product"
          }
        },
        {
          "node": {
            "handle": "free-product"
          }
        }
      ]
    }
  }
}

ショップのフィールドと接続を取得する

Query: POST /api/2021-07/graphql.json

{
  shop {
    alerts {
      action {
        title
      }
      description
    }
    availableChannelApps(first: 3) {
      edges {
        node {
          handle
        }
      }
    }

    billingAddress {
      address1
      city
      company
      country
      name
    }
    checkoutApiSupported
    contactEmail
    countriesInShippingZones {
      countryCodes
    }
    currencyCode
    customerAccounts
    customerTags(first: 3) {
      edges {
        node
      }
    }
    description
    draftOrderTags(first: 3) {
      edges {
        node
      }
    }
    email
    enabledPresentmentCurrencies
    features {
      branding
    }
    fulfillmentServices {
      handle
    }
    ianaTimezone
    id
    limitedPendingOrderCount {
      count
    }
    marketingEvents(first: 3) {
      edges {
        node {
          description
        }
      }
    }
    metafields(first: 3) {
      edges {
        node {
          description
        }
      }
    }
    myshopifyDomain
    name
    navigationSettings {
      title
    }
    orderTags(first: 3) {
      edges {
        node
      }
    }
    paymentSettings {
      supportedDigitalWallets
    }
    plan {
      displayName
    }
    primaryDomain {
      host
    }
    productImages(first: 3) {
      edges {
        node {
          id
        }
      }
    }
    productTags(first: 3) {
      edges {
        node
      }
    }
    productTypes(first: 3) {
      edges {
        node
      }
    }
    productVendors(first: 3) {
      edges {
        node
      }
    }
    publicationCount
    resourceLimits {
      maxProductOptions
    }
    richTextEditorUrl
    search(first: 3, query: "shoes") {
      edges {
        node {
          title
        }
      }
    }
    searchFilters {
      productAvailability {
        label
      }
    }
    setupRequired
    shipsToCountries
    storefrontAccessTokens(first: 3) {
      edges {
        node {
          title
        }
      }
    }
    taxShipping
    taxesIncluded
    timezoneOffset
    timezoneOffsetMinutes
    url
    weightUnit
  }
}

Query: POST /api/2021-07/graphql.json

json response
{
  "data": {
    "shop": {
      "alerts": [],
      "availableChannelApps": {
        "edges": [
          {
            "node": {
              "handle": "instagram"
            }
          },
          {
            "node": {
              "handle": "amazon"
            }
          },
          {
            "node": {
              "handle": "ebay"
            }
          }
        ]
      },
      "billingAddress": {
        "address1": "3143 Buchanan Drive",
        "city": "Minneapolis",
        "company": "John's Apparel",
        "country": "United States",
        "name": ""
      },
      "checkoutApiSupported": true,
      "contactEmail": "greg.dodd@shopify.com",
      "countriesInShippingZones": {
        "countryCodes": [
          "CA",
          "US"
        ]
      },
      "currencyCode": "USD",
      "customerAccounts": "DISABLED",
      "customerTags": {
        "edges": []
      },
      "description": "",
      "draftOrderTags": {
        "edges": []
      },
      "email": "greg.dodd@shopify.com",
      "enabledPresentmentCurrencies": [
        "USD"
      ],
      "features": {
        "branding": "SHOPIFY"
      },
      "fulfillmentServices": [
        {
          "handle": "manual"
        },
        {
          "handle": "oberlo"
        }
      ],
      "ianaTimezone": "America/New_York",
      "id": "gid://shopify/Shop/22954687",
      "limitedPendingOrderCount": {
        "count": 21
      },
      "marketingEvents": {
        "edges": [
          {
            "node": {
              "description": "test activity"
            }
          }
        ]
      },
      "metafields": {
        "edges": [
          {
            "node": {
              "description": null
            }
          },
          {
            "node": {
              "description": null
            }
          }
        ]
      },
      "myshopifyDomain": "gregds-test-shop.myshopify.com",
      "name": "John's Apparel",
      "navigationSettings": [
        {
          "title": "General"
        },
        {
          "title": "Payments"
        },
        {
          "title": "Checkout"
        },
        {
          "title": "Shipping"
        },
        {
          "title": "Taxes"
        },
        {
          "title": "Locations"
        },
        {
          "title": "Notifications"
        },
        {
          "title": "Gift cards"
        },
        {
          "title": "Files"
        },
        {
          "title": "Sales channels"
        },
        {
          "title": "Account"
        },
        {
          "title": "Billing"
        },
        {
          "title": "Legal"
        }
      ],
      "orderTags": {
        "edges": [
          {
            "node": "test tag"
          }
        ]
      },
      "paymentSettings": {
        "supportedDigitalWallets": [
          "SHOPIFY_PAY",
          "APPLE_PAY"
        ]
      },
      "plan": {
        "displayName": "staff"
      },
      "primaryDomain": {
        "host": "gregds-test-shop.myshopify.com"
      },
      "productImages": {
        "edges": [
          {
            "node": {
              "id": "gid://shopify/ProductImage/23213976130"
            }
          },
          {
            "node": {
              "id": "gid://shopify/ProductImage/23213976258"
            }
          },
          {
            "node": {
              "id": "gid://shopify/ProductImage/23213976322"
            }
          }
        ]
      },
      "productTags": {
        "edges": [
          {
            "node": "accessories"
          },
          {
            "node": "spring"
          },
          {
            "node": "summer"
          }
        ]
      },
      "productTypes": {
        "edges": [
          {
            "node": "Bags"
          },
          {
            "node": "Books"
          },
          {
            "node": "Candy"
          }
        ]
      },
      "productVendors": {
        "edges": [
          {
            "node": "ABETTERLOOKINGSHOP"
          },
          {
            "node": "Bella"
          },
          {
            "node": "Case-Mate"
          }
        ]
      },
      "publicationCount": 5,
      "resourceLimits": {
        "maxProductOptions": 3
      },
      "richTextEditorUrl": "https://cdn.shopify.com/s/assets/mobile_app/rte-795d4ef8402c1048dbc21cfb928db3e1bd349e8dba8f1633485b2264579aeb08.html",
      "search": {
        "edges": [
          {
            "node": {
              "title": "Order #1047"
            }
          },
          {
            "node": {
              "title": "Calracha Shoes"
            }
          },
          {
            "node": {
              "title": "Tom Leather Shoes"
            }
          }
        ]
      },
      "searchFilters": {
        "productAvailability": [
          {
            "label": "available on Facebook"
          },
          {
            "label": "unavailable on Facebook"
          },
          {
            "label": "available on Google Shopping"
          },
          {
            "label": "unavailable on Google Shopping"
          },
          {
            "label": "available on Online Store"
          },
          {
            "label": "unavailable on Online Store"
          },
          {
            "label": "available on Point of Sale"
          },
          {
            "label": "unavailable on Point of Sale"
          },
          {
            "label": "available on gregs private test app"
          },
          {
            "label": "unavailable on gregs private test app"
          }
        ]
      },
      "setupRequired": false,
      "shipsToCountries": [
        "AD",
        "AE",
        "AF",
        "AG",
        "AI",
        "AL",
        "AM",
        "AN",
        "AO",
        "AR",
        "AT",
        "AU",
        "AW",
        "AX",
        "AZ",
        "BA",
        "BB",
        "BD",
        "BE",
        "BF",
        "BG",
        "BH",
        "BI",
        "BJ",
        "BL",
        "BM",
        "BN",
        "BO",
        "BQ",
        "BR",
        "BS",
        "BT",
        "BV",
        "BW",
        "BY",
        "BZ",
        "CA",
        "CC",
        "CD",
        "CF",
        "CG",
        "CH",
        "CI",
        "CK",
        "CL",
        "CM",
        "CN",
        "CO",
        "CR",
        "CU",
        "CV",
        "CW",
        "CX",
        "CY",
        "CZ",
        "DE",
        "DJ",
        "DK",
        "DM",
        "DO",
        "DZ",
        "EC",
        "EE",
        "EG",
        "EH",
        "ER",
        "ES",
        "ET",
        "FI",
        "FJ",
        "FK",
        "FO",
        "FR",
        "GA",
        "GB",
        "GD",
        "GE",
        "GF",
        "GG",
        "GH",
        "GI",
        "GL",
        "GM",
        "GN",
        "GP",
        "GQ",
        "GR",
        "GS",
        "GT",
        "GW",
        "GY",
        "HK",
        "HM",
        "HN",
        "HR",
        "HT",
        "HU",
        "ID",
        "IE",
        "IL",
        "IM",
        "IN",
        "IO",
        "IQ",
        "IR",
        "IS",
        "IT",
        "JE",
        "JM",
        "JO",
        "JP",
        "KE",
        "KG",
        "KH",
        "KI",
        "KM",
        "KN",
        "KP",
        "KR",
        "KW",
        "KY",
        "KZ",
        "LA",
        "LB",
        "LC",
        "LI",
        "LK",
        "LR",
        "LS",
        "LT",
        "LU",
        "LV",
        "LY",
        "MA",
        "MC",
        "MD",
        "ME",
        "MF",
        "MG",
        "MK",
        "ML",
        "MM",
        "MN",
        "MO",
        "MQ",
        "MR",
        "MS",
        "MT",
        "MU",
        "MV",
        "MW",
        "MX",
        "MY",
        "MZ",
        "NA",
        "NC",
        "NE",
        "NF",
        "NG",
        "NI",
        "NL",
        "NO",
        "NP",
        "NR",
        "NU",
        "NZ",
        "OM",
        "PA",
        "PE",
        "PF",
        "PG",
        "PH",
        "PK",
        "PL",
        "PM",
        "PN",
        "PS",
        "PT",
        "PY",
        "QA",
        "RE",
        "RO",
        "RS",
        "RU",
        "RW",
        "SA",
        "SB",
        "SC",
        "SD",
        "SE",
        "SG",
        "SH",
        "SI",
        "SJ",
        "SK",
        "SL",
        "SM",
        "SN",
        "SO",
        "SR",
        "SS",
        "ST",
        "SV",
        "SX",
        "SY",
        "SZ",
        "TC",
        "TD",
        "TF",
        "TG",
        "TH",
        "TJ",
        "TK",
        "TL",
        "TM",
        "TN",
        "TO",
        "TR",
        "TT",
        "TV",
        "TW",
        "TZ",
        "UA",
        "UG",
        "UM",
        "US",
        "UY",
        "UZ",
        "VA",
        "VC",
        "VE",
        "VG",
        "VN",
        "VU",
        "WF",
        "WS",
        "XK",
        "YE",
        "YT",
        "ZA",
        "ZM",
        "ZW"
      ],
      "storefrontAccessTokens": {
        "edges": []
      },
      "taxShipping": false,
      "taxesIncluded": false,
      "timezoneOffset": "-0500",
      "timezoneOffsetMinutes": -300,
      "url": "https://gregds-test-shop.myshopify.com",
      "weightUnit": "KILOGRAMS"
    }
  }
}

Shopify アプリのご紹介

Shopify アプリである、「商品ページ発売予告アプリ | リテリア Coming Soon」は、商品ページを買えない状態のまま、発売日時の予告をすることができるアプリです。Shopify で Coming Soon 機能を実現することができます。

https://apps.shopify.com/shopify-application-314?locale=ja&from=daniel

Shopify アプリである、「らくらく日本語フォント設定|リテリア Font Picker」は、ノーコードで日本語フォントを使用できるアプリです。日本語フォントを導入することでブランドを演出することができます。

https://apps.shopify.com/font-picker-1?locale=ja&from=daniel

Discussion

ログインするとコメントできます