### Example Usage of createVaultCardSetupToken Mutation Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/graphql/payment-services-extension/mutations/create-vault-card-setup-token.md Demonstrates how to execute the createVaultCardSetupToken mutation with payment details to generate a setup token. This setup token is then used to create a permanent vault token. ```graphql mutation { createVaultCardSetupToken( input: { setup_token: { payment_source: { card: { name: "John Doe", billing_address: { address_line_1: "123 Main Street", address_line_2: "Apt 4B", region: "California", city: "San Jose", postal_code: "90001", country_code: "US" } } } }, three_ds_mode: SCA_ALWAYS } ) { setup_token } } ``` ```json { "data": { "createVaultCardSetupToken": { "setup_token": "11M29729J2618171X" } } } ``` -------------------------------- ### RequestReturnInput Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/includes/autogenerated/graphql-api-saas-types-3.md Contains information needed to start a return request, including comments, contact email, items, and order UID. ```json { "comment_text": "xyz789", "contact_email": "abc123", "items": [RequestReturnItemInput], "order_uid": 4 } ``` -------------------------------- ### ProductMediaGalleryEntriesAssetVideo Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/includes/autogenerated/graphql-api-saas-types-3.md Example of the ProductMediaGalleryEntriesAssetVideo type, providing details for video assets. ```json { "media_type": "xyz789", "video_asset_id": "abc123", "video_media_url": "abc123" } ``` -------------------------------- ### UnitConfigInput Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/includes/autogenerated/graphql-api-saas-types-4.md Example of UnitConfigInput, used for configuring units. ```json { "unitName": "abc123", "storefrontLabel": "abc123", "pagePlacement": "xyz789", "displayNumber": 123, "pageType": "abc123", "unitStatus": "xyz789", "typeId": "abc123", "filterRules": [FilterRuleInput] } ``` -------------------------------- ### Example: Create Compare List with Products Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/graphql/schema/products/mutations/create-compare-list.md Demonstrates how to create a comparison list and add two products using their IDs. ```graphql mutation { createCompareList( input: { products: ["1", "2"] } ) { uid item_count attributes { code label } items { uid product { sku name description { html } } } } } ``` -------------------------------- ### Example GraphQL GET Request URL for Caching Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/graphql/usage/caching.md This example demonstrates a typical GraphQL GET request URL that Fastly will cache. Ensure the 'query' parameter is present in the URL. ```text http://example.com/graphql?query={ products(filter: {sku: {eq: "Test"}}) { items { name } } }&variables={} .... ``` -------------------------------- ### GraphQL Query Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/graphql/usage/headers.md This is an example of a GraphQL query that can be sent as a GET or POST request. It retrieves product information based on a SKU filter. ```graphql { products( filter: { sku: { eq: "24-WB01" } } ) { items { name sku } } } ``` -------------------------------- ### Create a customer Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/graphql/schema/customer/mutations/create-v2.md This example demonstrates how to create a new customer using the `createCustomerV2` mutation with basic customer information. ```APIDOC ## createCustomerV2 (Mutation) ### Description Creates a new customer account with basic information. ### Syntax mutation: {createCustomerV2(input: CustomerCreateInput!) {CustomerOutput}} ### Parameters #### Request Body - **input** (CustomerCreateInput!) - Required - The input object containing customer details. - **firstname** (String!) - Required - The first name of the customer. - **lastname** (String!) - Required - The last name of the customer. - **email** (String!) - Required - The email address of the customer. - **password** (String!) - Required - The password for the customer account. - **is_subscribed** (Boolean) - Optional - Indicates if the customer is subscribed to newsletters. ### Request Example ```graphql mutation { createCustomerV2( input: { firstname: "Bob" lastname: "Loblaw" email: "bobloblaw@example.com" password: "b0bl0bl@w" is_subscribed: true } ) { customer { firstname lastname email is_subscribed } } } ``` ### Response #### Success Response (200) - **customer** (CustomerOutput) - The created customer object. - **firstname** (String) - The first name of the customer. - **lastname** (String) - The last name of the customer. - **email** (String) - The email address of the customer. - **is_subscribed** (Boolean) - Indicates if the customer is subscribed to newsletters. #### Response Example ```json { "data": { "createCustomerV2": { "customer": { "firstname": "Bob", "lastname": "Loblaw", "email": "bobloblaw@example.com", "is_subscribed": true } } } } ``` ``` -------------------------------- ### initiateUploadOutput Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/includes/autogenerated/graphql-api-saas-types-4.md Output for initiating an upload, providing an expiration timestamp, a key, and the upload URL. ```json { "expires_at": "abc123", "key": "abc123", "upload_url": "abc123" } ``` -------------------------------- ### Example createCompany Mutation Request Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/graphql/schema/b2b/company/mutations/create.md Demonstrates how to create a company as a guest user, including company name, administrator details, and legal address. Ensure the email address is not already in use. ```graphql mutation { createCompany(input: { company_name: "TestCo" company_email: "tgarofalo@example.com" company_admin: { email: "tgarofalo@example.com" firstname: "Taina" lastname:"Garofalo" } legal_name: "TestCo Inc." legal_address: { street: [ "100 Big Oak Tree Dr" ] city: "San Francisco" region: { region_code: "CA" } postcode: "99999" country_id: US telephone: "555 867-5309" } }){ company { id name company_admin { email firstname lastname } legal_address { street city region { region_code region_id } postcode telephone } } } } ``` -------------------------------- ### Subtree Input Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/includes/autogenerated/graphql-api-saas-types-4.md Defines the depth and starting level for retrieving a subtree of categories. ```json {"depth": 123, "startLevel": 123} ``` -------------------------------- ### GET Request with searchCriteria and fields Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/rest/use-rest/retrieve-filtered-responses.md Use this GET request to retrieve specific product data based on attribute filters and limit the output fields. This example uses the host and store code. ```http GET https:///rest//V1/products/?searchCriteria[filter_groups][0][filters][0][field]=category_gear&searchCriteria[filter_groups][0][filters][0][value]=86&searchCriteria[filter_groups][0][filters][0][condition_type]=finset&fields=items[sku,name] ``` -------------------------------- ### Example Request for getPaymentSDK Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/graphql/payment-services-extension/queries/get-payment-sdk.md Demonstrates how to execute the `getPaymentSDK` query to retrieve SDK parameters for checkout. ```graphql query { getPaymentSDK(location: CHECKOUT) { sdkParams { code params { name value } } } } ``` -------------------------------- ### Returns Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/includes/autogenerated/graphql-api-saas-types-3.md Contains a list of customer return requests and pagination information. ```json { "items": [Return], "page_info": SearchResultPageInfo, "total_count": 123 } ``` -------------------------------- ### RequestGuestReturnInput Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/includes/autogenerated/graphql-api-saas-types-3.md Contains information needed to start a return request, including contact details, items, and order token. ```json { "comment_text": "xyz789", "contact_email": "xyz789", "items": [RequestReturnItemInput], "token": "abc123" } ``` -------------------------------- ### PaaS Bulk Route Transformation Examples Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/rest/use-rest/bulk-endpoints.md Illustrates the transformation of synchronous routes to bulk routes for PaaS environments, including handling input parameters by replacing ':' with 'by' and capitalizing the parameter name. ```text PUT /async/bulk/V1/products/bySku/media/byEntryId POST /async/bulk/V1/carts/byQuoteId/items ``` -------------------------------- ### Example GET response for filtered product data Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/rest/use-rest/retrieve-filtered-responses.md This JSON structure represents the filtered response for a product, containing only the requested fields. ```JSON { "sku": "MT12" "name": "Cassius Sparring Tank" "extension_attributes": { "category_links": { "position": 1 "category_id": "18" } "stock_item": { "item_id": 732 "qty": 0 } } } ``` -------------------------------- ### ProductViewVideo Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/includes/autogenerated/graphql-api-saas-types-3.md Represents details about a product video, including its preview image, URL, description, and title. ```json { "preview": ProductViewImage, "url": "xyz789", "description": "xyz789", "title": "xyz789" } ``` -------------------------------- ### PaypalExpressUrlList Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/includes/autogenerated/graphql-api-2-4-9-types-3.md Contains URLs for authorizing payment and adjusting checkout details in PayPal Express. Includes edit and start URLs. ```json { "edit": "abc123", "start": "xyz789" } ``` -------------------------------- ### Create Compare List Input Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/includes/autogenerated/graphql-api-2-4-9-types-1.md Provides an example of input for creating a compare list with product IDs. ```json {"products": ["4"]} ``` -------------------------------- ### ProductView Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/includes/autogenerated/graphql-api-saas-types-3.md Demonstrates the structure of a ProductView object, including product details and associated attributes, images, videos, and links. Note that several fields are deprecated. ```json { "addToCartAllowed": false, "inStock": true, "lowStock": false, "attributes": [ProductViewAttribute], "description": "abc123", "id": "4", "images": [ProductViewImage], "videos": [ProductViewVideo], "lastModifiedAt": "2007-12-03T10:15:30Z", "metaDescription": "abc123", "metaKeyword": "xyz789", "metaTitle": "abc123", "name": "xyz789", "shortDescription": "xyz789", "inputOptions": [ProductViewInputOption], "sku": "xyz789", "externalId": "abc123", "url": "abc123", "urlKey": "abc123", "links": [ProductViewLink], "queryType": "xyz789", "visibility": "abc123" } ``` -------------------------------- ### Verify Configurable Product Options and Links Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/rest/tutorials/configurable-product/define-config-product-options.md Call this GET endpoint to retrieve product details, including the `configurable_product_options` and `configurable_product_links` arrays, to verify the setup. ```json { "configurable_product_options": [ { "id": 338, "attribute_id": "141", "label": "Size", "position": 0, "values": [ { "value_index": 168 }, { "value_index": 169 }, { "value_index": 170 } ], "product_id": 2078 } ], "configurable_product_links": [ 2079, 2080, 2081 ] }, ... ``` -------------------------------- ### initiateUploadInput Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/includes/autogenerated/graphql-api-saas-types-4.md Input for initiating an upload, specifying the file key and the media resource type. ```json { "key": "abc123", "media_resource_type": "NEGOTIABLE_QUOTE_ATTACHMENT" } ``` -------------------------------- ### Filter Orders by Status (SaaS) Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/rest/use-rest/performing-searches.md Example GET request for SaaS environment to retrieve orders with 'pending' status, sorted by 'increment_id', and returning only 'increment_id' and 'entity_id'. ```HTTP GET https://.api.commerce.adobe.com//V1/orders? searchCriteria[filter_groups][0][filters][0][field]=status& searchCriteria[filter_groups][0][filters][0][value]=pending& searchCriteria[sortOrders][0][field]=increment_id& fields=items[increment_id,entity_id] ``` -------------------------------- ### Create Guest Cart Input Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/includes/autogenerated/graphql-api-2-4-9-types-1.md Example input for creating a guest cart, optionally including a client-generated cart UID. ```json {"cart_uid": 4} ``` -------------------------------- ### Filter Orders by Status (PaaS) Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/rest/use-rest/performing-searches.md Example GET request for PaaS environment to retrieve orders with 'pending' status, sorted by 'increment_id', and returning only 'increment_id' and 'entity_id'. ```HTTP GET https:///rest/V1/orders? searchCriteria[filter_groups][0][filters][0][field]=status& searchCriteria[filter_groups][0][filters][0][value]=pending& searchCriteria[sortOrders][0][field]=increment_id& fields=items[increment_id,entity_id] ``` -------------------------------- ### Product Interface Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/includes/autogenerated/graphql-api-saas-types-2.md Example structure for the ProductInterface, detailing various product attributes. ```json { "canonical_url": "xyz789", "categories": [CategoryInterface], "country_of_manufacture": "xyz789", "crosssell_products": [ProductInterface], "custom_attributesV2": ProductCustomAttributes, "description": ComplexTextValue, "gift_message_available": false, "gift_wrapping_available": false, "gift_wrapping_price": Money, "image": ProductImage, "is_returnable": "xyz789", "items": [GroupedProductItem], "manufacturer": 123, "max_sale_qty": 123.45, "media_gallery": [MediaGalleryInterface], "meta_description": "abc123", "meta_keyword": "abc123", "meta_title": "abc123", "min_sale_qty": 123.45, "name": "xyz789", "new_from_date": "xyz789", "new_to_date": "abc123", "only_x_left_in_stock": 123.45, "options_container": "abc123", "price_range": PriceRange, "price_tiers": [TierPrice], "product_links": [ProductLinksInterface], "quantity": 123.45, "related_products": [ProductInterface], "short_description": ComplexTextValue, "sku": "abc123", "small_image": ProductImage, "special_price": 987.65, "special_to_date": "abc123", "stock_status": "IN_STOCK", "swatch_image": "xyz789", "thumbnail": ProductImage, "uid": "4", "upsell_products": [ProductInterface], "url_key": "xyz789", "weight": 123.45 } ``` -------------------------------- ### Cart Response Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/rest/b2b/negotiable-order-workflow.md This JSON object represents the response from the `GET /V1/carts/mine` endpoint, detailing the cart's contents, customer information, and associated addresses. ```JSON { "id": 5, "created_at": "2017-09-14 21:14:15", "updated_at": "2017-09-15 16:15:54", "is_active": true, "is_virtual": false, "items": [ { "item_id": 12, "sku": "24-UG02", "qty": 15, "name": "Pursuit Lumaflex™ Tone Band", "price": 16, "product_type": "simple", "quote_id": "5" }, { "item_id": 13, "sku": "24-UG03", "qty": 10, "name": "Harmony Lumaflex™ Strength Band Kit ", "price": 22, "product_type": "simple", "quote_id": "5" } ], "items_count": 2, "items_qty": 25, "customer": { "id": 2, "group_id": 1, "default_billing": "2", "default_shipping": "2", "created_at": "2017-09-11 17:55:52", "updated_at": "2017-09-14 19:05:40", "created_in": "Default Store View", "email": "mshaw@example.com", "firstname": "Melanie", "lastname": "Shaw", "gender": 3, "store_id": 1, "website_id": 1, "addresses": [ { "id": 2, "customer_id": 2, "region": { "region_code": "CA", "region": "California", "region_id": 12 }, "region_id": 12, "country_id": "US", "street": [ "100 Big Tree Avenue" ], "telephone": "(415) 555-1212", "postcode": "99999", "city": "San Francisco", "firstname": "Melanie", "lastname": "Shaw", "default_shipping": true, "default_billing": true } ], "disable_auto_group_change": 0, "extension_attributes": { "company_attributes": { "customer_id": 2, "company_id": 1, "status": 1 } } }, "billing_address": { "id": 12, "region": "California", "region_id": 12, "region_code": "CA", "country_id": "US", "street": [ "100 Big Tree Avenue" ], "telephone": "415-555-1212", "postcode": "99999", "city": "San Francisco", "firstname": "Melanie", "lastname": "Shaw", "customer_id": 2, "email": "mshaw@example.com", "same_as_billing": 0, "save_in_address_book": 0 }, "orig_order_id": 0, "currency": { "global_currency_code": "USD", "base_currency_code": "USD", "store_currency_code": "USD", "quote_currency_code": "USD", "store_to_base_rate": 0, "store_to_quote_rate": 0, "base_to_global_rate": 1, "base_to_quote_rate": 1 }, "customer_is_guest": false, "customer_note_notify": true, "customer_tax_class_id": 3, "store_id": 1, "extension_attributes": { "shipping_assignments": [ { "shipping": { "address": { "id": 13, "region": "California", "region_id": 12, "region_code": "CA", "country_id": "US", "street": [ "100 Big Tree Avenue" ], "telephone": "415-555-1212", "postcode": "99999", "city": "San Francisco", "firstname": "Melanie", "lastname": "Shaw", "customer_id": 2, "email": "mshaw@example.com", "same_as_billing": 0, "save_in_address_book": 0 }, "method": "tablerate_bestway" }, "items": [ { "item_id": 12, "sku": "24-UG02", "qty": 15, "name": "Pursuit Lumaflex™ Tone Band", "price": 16, "product_type": "simple", "quote_id": "5" } ] } ] } } ``` -------------------------------- ### CreateProductReviewOutput Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/includes/autogenerated/graphql-api-2-4-9-types-1.md Example of the output object for a created product review, containing the review details. ```json {"review": ProductReview} ``` -------------------------------- ### Get Catalog Product Visibility Attribute Metadata Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/graphql/schema/attributes/queries/custom-attribute-metadata-v2.md Retrieves metadata for the 'visibility' attribute of a 'catalog_product'. This example shows catalog-specific metadata fields like is_filterable and used_in_product_listing. ```graphql {\n customAttributeMetadataV2(attributes: [{attribute_code: "visibility", entity_type: "catalog_product"}]) {\n items {\n code\n label\n entity_type\n frontend_input\n ...on CatalogAttributeMetadata {\n is_filterable\n is_html_allowed_on_front\n is_wysiwyg_enabled\n is_used_for_promo_rules\n used_in_product_listing\n }\n }\n errors {\n type\n message\n }\n }\n} ``` ```json {\n "data": {\n "customAttributeMetadataV2": {\n "items": [\n {\n "code": "visibility",\n "label": "Visibility",\n "entity_type": "CATALOG_PRODUCT",\n "frontend_input": "SELECT",\n "is_filterable": false,\n "is_html_allowed_on_front": false,\n "is_wysiwyg_enabled": false,\n "is_used_for_promo_rules": false,\n "used_in_product_listing": false\n }\n ],\n "errors": []\n }\n }\n} ``` -------------------------------- ### GraphQL API Configuration Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/includes/autogenerated/graphql-api-2-4-9-types-4.md An example JSON object demonstrating various configuration settings available through the GraphQL API. ```json { "absolute_footer": "abc123", "allow_gift_receipt": "xyz789", "allow_gift_wrapping_on_order": "xyz789", "allow_gift_wrapping_on_order_items": "abc123", "allow_guests_to_write_product_reviews": "abc123", "allow_items": "abc123", "allow_order": "xyz789", "allow_printed_card": "xyz789", "autocomplete_on_storefront": false, "base_currency_code": "xyz789", "base_link_url": "xyz789", "base_media_url": "abc123", "base_static_url": "abc123", "base_url": "abc123", "braintree_3dsecure_allowspecific": false, "braintree_3dsecure_always_request_3ds": false, "braintree_3dsecure_specificcountry": "abc123", "braintree_3dsecure_threshold_amount": "xyz789", "braintree_3dsecure_verify_3dsecure": false } ``` -------------------------------- ### List Gift Card Accounts with Search Criteria Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/rest/saas-integrations/gift-card-accounts/index.md Example of a GET request to list gift card accounts, filtering by status and paginating results. Use query parameters for search criteria. ```text GET /V1/giftcardaccounts?searchCriteria[filterGroups][0][filters][0][field]=status&searchCriteria[filterGroups][0][filters][0][value]=1&searchCriteria[pageSize]=10&searchCriteria[currentPage]=1 ``` -------------------------------- ### Authenticated API Request Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/rest/authentication/user.md Make an authenticated GET request to the /V1/products endpoint using the obtained access token. Ensure the Authorization header is correctly formatted with 'Bearer' followed by your token. ```http GET /V1/products Authorization: Bearer ``` -------------------------------- ### SaaS Bulk Route Transformation Examples Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/rest/use-rest/bulk-endpoints.md Illustrates the transformation of synchronous routes to bulk routes for SaaS environments, including handling input parameters by replacing ':' with 'by' and capitalizing the parameter name. ```text PUT /V1/async/bulk/products/bySku/media/byEntryId POST /V1/async/bulk/carts/byQuoteId/items ``` -------------------------------- ### Example Usage of ACCS API Client Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/rest/authentication/server-to-server.md Demonstrates how to instantiate the ACCSApiClient and make authenticated GET requests to Adobe Commerce REST API endpoints, such as retrieving product lists or specific product details. ```javascript // example-usage.js const ACCSApiClient = require('./accsClient'); async function main() { const client = new ACCSApiClient(); try { // Example API call using a real ACCS REST API endpoint const response = await client.request('GET', '/V1/products'); console.log('Products:', response); // Another example with a specific product SKU const productSku = 'example-sku'; const productDetails = await client.request('GET', `/V1/products/${productSku}`); console.log('Product Details:', productDetails); } catch (error) { console.error('API call failed:', error.message); } } main(); ``` -------------------------------- ### Retrieve specific product fields using GET Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/rest/use-rest/retrieve-filtered-responses.md Use the 'fields' parameter to specify which attributes to return for a product. This example retrieves the product's SKU, name, category links, and stock item details. ```HTTP GET https:///rest//V1/products/MT12?fields=name,sku,extension_attributes[category_links,stock_item[item_id,qty]] ``` ```HTTP GET https://.api.commerce.adobe.com//V1/products/MT12?fields=name,sku,extension_attributes[category_links,stock_item[item_id,qty]] ``` -------------------------------- ### Create a Simple Product Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/rest/tutorials/configurable-product/create-simple-products.md Use this payload to create a simple product. Ensure attribute values match your installation. The `sku` and `name` should reflect the configurable option (e.g., size). Set `type_id` to 'simple' and `visibility` to '1' for non-display on the store. Includes optional `stock_item` for visibility. ```json { "product": { "sku": "MS-Champ-S", "name": "Champ Tee Small", "attribute_set_id": 9, "price": 25, "status": 1, "visibility": 1, "type_id": "simple", "weight": "0.5", "extension_attributes": { "category_links": [ { "position": 0, "category_id": "11" }, { "position": 1, "category_id": "12" }, { "position": 2, "category_id": "16" } ], "stock_item": { "qty": "10", "is_in_stock": true } }, "custom_attributes": [ { "attribute_code": "description", "value": "The Champ Tee keeps you cool and dry while you do your thing. Let everyone know who you are by adding your name on the back for only $10." }, { "attribute_code": "tax_class_id", "value": "2" }, { "attribute_code": "material", "value": "148" }, { "attribute_code": "pattern", "value": "196" }, { "attribute_code": "color", "value": "52" }, { "attribute_code": "size", "value": "168" } ] } } ``` -------------------------------- ### Start Content Server Source: https://github.com/adobedocs/commerce-webapi/blob/main/README.md Starts the local content server for the Commerce Web API documentation. This is the first of three servers required for local development. ```bash npm run dev ``` -------------------------------- ### GraphQL Currency Query Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/graphql/schema/store/queries/currency.md This query retrieves detailed currency information for a store, including base currency, symbols, available codes, and exchange rates. Use this when you need to understand the store's multi-currency setup. ```graphql query { currency { base_currency_code base_currency_symbol default_display_currency_code default_display_currency_symbol available_currency_codes exchange_rates { currency_to rate } } } ``` -------------------------------- ### Example: Generate Customer Token Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/graphql/schema/customer/mutations/generate-token.md Demonstrates how to use the `generateCustomerToken` mutation with a specific customer email and password to obtain an authentication token. ```graphql mutation { generateCustomerToken( email: "bobloblaw@example.com" password: "b0bl0bl@w" ) { token } } ``` -------------------------------- ### Get Products with Price Range and Discount Information Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/graphql/schema/products/queries/products.md This query retrieves product details, including the minimum and maximum prices, and any applicable discounts. It's useful for displaying pricing information and sale details to users. The example demonstrates fetching data for a specific product SKU and shows how discounts are applied. ```APIDOC ## Get Products with Price Range and Discount Information ### Description Retrieves product details, including the minimum and maximum prices, and any applicable discounts. This is useful for displaying pricing information and sale details to users. The example demonstrates fetching data for a specific product SKU and shows how discounts are applied. ### Method GraphQL Query ### Endpoint `/graphql` ### Parameters #### Query Parameters - **filter** (object) - Optional - Filters for products based on criteria like SKU. - **sort** (object) - Optional - Sorts the returned products. #### Request Body ```graphql { products(filter: {sku: {eq: "24-WG080"}}, sort: {name: ASC}) { items { name sku price_range { minimum_price { regular_price { value currency } final_price { value currency } discount { amount_off percent_off } } maximum_price { regular_price { value currency } final_price { value currency } discount { amount_off percent_off } } } } } } ``` ### Response #### Success Response - **data.products.items** (array) - An array of product objects. - **name** (string) - The name of the product. - **sku** (string) - The SKU of the product. - **price_range** (object) - Contains minimum and maximum price information. - **minimum_price** (object) - Details about the minimum price. - **regular_price** (object) - The standard price. - **value** (float) - The price value. - **currency** (string) - The currency code. - **final_price** (object) - The price after discounts. - **value** (float) - The final price value. - **currency** (string) - The currency code. - **discount** (object) - Discount information. - **amount_off** (float) - The amount discounted. - **percent_off** (float) - The percentage discounted. - **maximum_price** (object) - Details about the maximum price (similar structure to minimum_price). #### Response Example ```json { "data": { "products": { "items": [ { "name": "Sprite Yoga Companion Kit", "sku": "24-WG080", "price_range": { "minimum_price": { "regular_price": { "value": 61, "currency": "USD" }, "final_price": { "value": 54.9, "currency": "USD" }, "discount": { "amount_off": 6.1, "percent_off": 10 } }, "maximum_price": { "regular_price": { "value": 77, "currency": "USD" }, "final_price": { "value": 69.3, "currency": "USD" }, "discount": { "amount_off": 7.7, "percent_off": 10 } } } } ] } } } ``` ``` -------------------------------- ### Create Vault Card Setup Token Mutation Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/includes/autogenerated/graphql-api-2-4-9-mutations.md Use this mutation to create a vault card setup token. It requires an input object with setup details and returns a setup token. ```graphql mutation createVaultCardSetupToken($input: CreateVaultCardSetupTokenInput!) { createVaultCardSetupToken(input: $input) { setup_token } } ``` ```json {"input": CreateVaultCardSetupTokenInput} ``` ```json { "data": { "createVaultCardSetupToken": { "setup_token": "abc123" } } } ``` -------------------------------- ### ProductVideo Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/includes/autogenerated/graphql-api-2-4-9-types-3.md Contains information about a product video, including its URL, label, and associated video content. ```json { "disabled": false, "label": "xyz789", "position": 123, "types": ["xyz789"], "url": "xyz789", "video_content": ProductMediaGalleryEntriesVideoContent } ``` -------------------------------- ### MediaGalleryInterface Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/includes/autogenerated/graphql-api-saas-types-2.md Contains basic information for product images or videos, including visibility and position. ```json { "disabled": true, "label": "xyz789", "position": 987, "url": "abc123" } ``` -------------------------------- ### DynamicBlockTypeEnum Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/includes/autogenerated/graphql-api-2-4-9-types-2.md An example of a DynamicBlockTypeEnum value. ```json "SPECIFIED" ``` -------------------------------- ### Example Response for Create Compare List Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/graphql/schema/products/mutations/create-compare-list.md Shows the expected JSON response structure after successfully creating a comparison list with products. ```json { "data": { "createCompareList": { "uid": "sssXyGZkTFksdPnxNoK1ut6OiV4bbchD", "item_count": 2, "attributes": [ { "code": "sku", "label": "SKU" }, { "code": "description", "label": "Description" }, { "code": "short_description", "label": "Short Description" }, { "code": "activity", "label": "Activity" } ], "items": [ { "uid": "1", "product": { "sku": "24-MB01", "name": "Joust Duffle Bag", "description": { "html": "

The sporty Joust Duffle Bag can\'t be beat - not in the gym, not on the luggage carousel, not anywhere. Big enough to haul a basketball or soccer ball and some sneakers with plenty of room to spare, it\'s ideal for athletes with places to go.

\n

    \n
  • Dual top handles.
  • \n
  • Adjustable shoulder strap.
  • \n
  • Full-length zipper.
  • \n
  • L 29\" x W 13\" x H 11\".
  • \n
" } } }, { "uid": "2", "product": { "sku": "24-MB04", "name": "Strive Shoulder Pack", "description": { "html": "

Convenience is next to nothing when your day is crammed with action. So whether you\'re heading to class, gym, or the unbeaten path, make sure you\'ve got your Strive Shoulder Pack stuffed with all your essentials, and extras as well.

\n
    \n
  • Zippered main compartment.
  • \n
  • Front zippered pocket.
  • \n
  • Side mesh pocket.
  • \n
  • Cell phone pocket on strap.
  • \n
  • Adjustable shoulder strap and top carry handle.
  • \n
" } } } ] } } } ``` -------------------------------- ### SwatchLayerFilterItemInterface Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/includes/autogenerated/graphql-api-2-4-9-types-4.md Example of a SwatchLayerFilterItemInterface object. ```json {"swatch_data": SwatchData} ``` -------------------------------- ### ThreeDSMode Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/includes/autogenerated/graphql-api-saas-types-4.md Example of a ThreeDSMode value. ```json "OFF" ``` -------------------------------- ### SearchSuggestion Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/includes/autogenerated/graphql-api-2-4-9-types-3.md Represents a search suggestion string for existing products. ```json {"search": "xyz789"} ``` -------------------------------- ### Create a customer with custom attributes Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/graphql/schema/customer/mutations/create-v2.md This example shows how to create a new customer and assign values for custom attributes using the `createCustomerV2` mutation. ```APIDOC ## createCustomerV2 (Mutation) - With Custom Attributes ### Description Creates a new customer account and assigns values for predefined custom attributes. ### Syntax mutation: {createCustomerV2(input: CustomerCreateInput!) {CustomerOutput}} ### Parameters #### Request Body - **input** (CustomerCreateInput!) - Required - The input object containing customer details and custom attributes. - **firstname** (String!) - Required - The first name of the customer. - **lastname** (String!) - Required - The last name of the customer. - **email** (String!) - Required - The email address of the customer. - **password** (String!) - Required - The password for the customer account. - **is_subscribed** (Boolean) - Optional - Indicates if the customer is subscribed to newsletters. - **custom_attributes** (Array) - Optional - An array of custom attributes to assign to the customer. - **attribute_code** (String!) - Required - The code of the custom attribute. - **value** (String) - Optional - The value for the custom attribute (for text-based attributes). - **selected_options** (Array) - Optional - For select-type attributes, the selected options. - **uid** (String!) - Required - The unique identifier for the option. - **value** (String!) - Required - The value of the option. ### Request Example ```graphql mutation { createCustomerV2( input: { firstname: "Bob" lastname: "Loblaw" email: "bobloblaw@example.com" password: "b0bl0bl@w" is_subscribed: true custom_attributes: [ { attribute_code: "alternative_email" value: "abc@example.com" }, { attribute_code: "studies" value: "501,502" selected_options: [ { uid: "NTEw" value: "501" }, { uid: "NTEx" value: "502" } ] } ] } ) { customer { firstname lastname email is_subscribed custom_attributes { code ... on AttributeValue { value } ... on AttributeSelectedOptions { selected_options { label value } } } } } } ``` ### Response #### Success Response (200) - **customer** (CustomerOutput) - The created customer object, including custom attributes. - **firstname** (String) - The first name of the customer. - **lastname** (String) - The last name of the customer. - **email** (String) - The email address of the customer. - **is_subscribed** (Boolean) - Indicates if the customer is subscribed to newsletters. - **custom_attributes** (Array) - The custom attributes assigned to the customer. - **code** (String) - The code of the custom attribute. - **value** (String) - The value of the custom attribute (for text-based attributes). - **selected_options** (Array) - For select-type attributes, the selected options. - **label** (String) - The display label for the option. - **value** (String) - The value of the option. #### Response Example ```json { "data": { "createCustomerV2": { "customer": { "firstname": "Bob", "lastname": "Loblaw", "email": "bobloblaw@example.com", "is_subscribed": true, "custom_attributes": [ { "code": "alternative_email", "value": "abc@example.com" }, { "code": "studies", "selected_options": [ { "label": "BSc", "value": "501" }, { "label": "MBA", "value": "502" } ] } ] } } } } ``` ``` -------------------------------- ### TaxWrappingEnum Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/includes/autogenerated/graphql-api-saas-types-4.md Example of a TaxWrappingEnum value. ```json "DISPLAY_EXCLUDING_TAX" ``` -------------------------------- ### Bundle Product Query Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/graphql/schema/products/interfaces/types/bundle.md This JSON structure represents a sample query response for a bundle product, detailing its options and associated simple products. Use this to understand the data returned for configurable bundle products. ```json { "uid": "YnVuZGxlLzM=", "title": "Sprite Yoga Strap", "required": true, "type": "radio", "position": 3, "sku": "24-WG080", "options": [ { "uid": "YnVuZGxlLzMvNS8x", "quantity": 1, "position": 1, "is_default": true, "price": 0, "price_type": "FIXED", "can_change_quantity": true, "label": "Sprite Yoga Strap 6 foot", "product": { "uid": "MzM=", "name": "Sprite Yoga Strap 6 foot", "sku": "24-WG085", "__typename": "SimpleProduct" } }, { "uid": "YnVuZGxlLzMvNi8x", "quantity": 1, "position": 2, "is_default": false, "price": 0, "price_type": "FIXED", "can_change_quantity": true, "label": "Sprite Yoga Strap 8 foot", "product": { "uid": "MzQ=", "name": "Sprite Yoga Strap 8 foot", "sku": "24-WG086", "__typename": "SimpleProduct" } }, { "uid": "YnVuZGxlLzMvNy8x", "quantity": 1, "position": 3, "is_default": false, "price": 0, "price_type": "FIXED", "can_change_quantity": true, "label": "Sprite Yoga Strap 10 foot", "product": { "uid": "MzU=", "name": "Sprite Yoga Strap 10 foot", "sku": "24-WG087", "__typename": "SimpleProduct" } } ] }, { "uid": "YnVuZGxlLzQ=", "title": "Sprite Foam Roller", "required": true, "type": "radio", "position": 4, "sku": "24-WG080", "options": [ { "uid": "YnVuZGxlLzQvOC8x", "quantity": 1, "position": 1, "is_default": true, "price": 0, "price_type": "FIXED", "can_change_quantity": true, "label": "Sprite Foam Roller", "product": { "uid": "MjI=", "name": "Sprite Foam Roller", "sku": "24-WG088", "__typename": "SimpleProduct" } } ] } ] ``` -------------------------------- ### SwatchType Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/includes/autogenerated/graphql-api-saas-types-4.md Example of a SwatchType value. ```json "TEXT" ``` -------------------------------- ### CreateRequisitionListInput Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/includes/autogenerated/graphql-api-2-4-9-types-1.md Example of the input object for creating a requisition list, including its name and an optional description. ```json { "description": "xyz789", "name": "abc123" } ``` -------------------------------- ### SwatchInputTypeEnum Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/includes/autogenerated/graphql-api-saas-types-4.md Example of a SwatchInputTypeEnum value. ```json "BOOLEAN" ``` -------------------------------- ### ProductViewImage Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/includes/autogenerated/graphql-api-saas-types-3.md An example of the ProductViewImage type, showing a product image with its label, roles, and URL. ```json { "label": "xyz789", "roles": ["xyz789"], "url": "abc123" } ``` -------------------------------- ### Create Vault Card Setup Token Output Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/includes/autogenerated/graphql-api-saas-types-1.md Provides the setup token ID as output after a vault card setup token is created. ```json {"setup_token": "xyz789"} ``` -------------------------------- ### Product Alert Price Input Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/includes/autogenerated/graphql-api-saas-types-3.md Input for setting up a product price alert, requiring a SKU. ```json {"sku": "abc123"} ``` -------------------------------- ### CountryCodeEnum Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/includes/autogenerated/graphql-api-2-4-9-types-1.md Example of a country code enum value. ```json "AF" ``` -------------------------------- ### ProductViewInputOption Example Source: https://github.com/adobedocs/commerce-webapi/blob/main/src/pages/includes/autogenerated/graphql-api-saas-types-3.md An example of the ProductViewInputOption type, used for configuring products with selectable options. ```json { "id": 4, "title": "abc123", "required": true, "type": "xyz789", "markupAmount": 987.65, "suffix": "xyz789", "sortOrder": 123, "range": ProductViewInputOptionRange, "imageSize": ProductViewInputOptionImageSize, "fileExtensions": "xyz789" } ```