### NPM Installation and Execution Source: https://github.com/spencerlepine/printify-sdk-js/blob/main/examples/README.md These commands demonstrate the basic steps to install the Printify SDK dependencies and start the project using npm. Ensure you have Node.js and npm installed before running these commands. ```sh $ npm install $ npm start ``` -------------------------------- ### Initialize and Use Printify SDK (Node.js) Source: https://github.com/spencerlepine/printify-sdk-js/wiki/Home Provides an example of initializing the Printify SDK with a shop ID and access token, and then making an asynchronous call to submit an order. It shows basic setup and a common API interaction. ```js import Printify from 'printify-sdk-js'; // const Printify = require('printify-sdk-js'); // CommonJS const printify = new Printify({ shopId: '123456', // global query by shop_id accessToken: process.env.API_TOKEN, }); (async () => { const data = {/* ... */}; const result = await printify.orders.submit(data); console.log(result); // { "id": "5a96f649b2439217d070f507" } })(); ``` -------------------------------- ### Install Printify SDK Source: https://github.com/spencerlepine/printify-sdk-js/blob/main/README.md Instructions for installing the Printify SDK for Node.js using popular package managers like npm, yarn, or pnpm. ```sh npm install printify-sdk-js # or yarn add printify-sdk-js # or pnpm add printify-sdk-js ``` -------------------------------- ### Printify SDK Catalog Methods Source: https://github.com/spencerlepine/printify-sdk-js/wiki/Home Examples of using the Printify JavaScript SDK to interact with the catalog API. Demonstrates calling methods to fetch print provider data. ```javascript import PrintifySDK from 'printify-sdk-js'; const printify = new PrintifySDK({ // Optional: Add your API key here if required for authentication // apiKey: 'YOUR_API_KEY' }); // Example 1: List all print providers async function listAllProviders() { try { const providers = await printify.catalog.listProviders(); console.log('Available Print Providers:', providers); } catch (error) { console.error('Error listing providers:', error); } } // Example 2: Get details for a specific print provider async function getSpecificProvider(providerId) { try { const providerDetails = await printify.catalog.getProvider(providerId); console.log(`Details for Provider ID ${providerId}:`, providerDetails); } catch (error) { console.error(`Error getting provider ${providerId}:`, error); } } // To run these examples: // listAllProviders(); // getSpecificProvider(1); // Replace 1 with an actual provider ID ``` -------------------------------- ### Sample Response for Variant Shipping Source: https://github.com/spencerlepine/printify-sdk-js/wiki/Home Provides an example of the JSON response structure returned by the `getVariantShipping` API call. It includes handling time, shipping profiles with variant IDs, costs, currency, and destination countries. ```json { "handling_time": { "value": 30, "unit": "day" }, "profiles": [ { "variant_ids": [ 42716, 42717, 42718, 42719, 42720, 12144, 12143, 12142, 12145, 12146, 12150, 12149, 12148, 12151, 12152, 12162, 12161, 12160, 12163, 12164, 12180, 12179, 12178, 12181, 12182, 12192, 12191, 12190, 12193, 12194, 11874, 11873, 11872, 11875, 11876, 11892, 11891, 11890, 11893, 11894, 11898, 11897, 11896, 11899, 11900, 11934, 11933, 11932, 11935, 11936, 11946, 11945, 11944, 11947, 11948, 11952, 11951, 11950, 11953, 11954, 11958, 11957, 11956, 11959, 11960, 11976, 11975, 11974, 11977, 11978, 11988, 11987, 11986, 11989, 11990, 12012, 12011, 12010, 12013, 12014, 12018, 12017, 12016, 12019, 12020, 12024, 12023, 12022, 12025, 12026, 12030, 12029, 12028, 12031, 12032, 12054, 12053, 12052, 12055, 12056, 12072, 12071, 12070, 12073, 12074, 12102, 12101, 12100, 12103, 12104, 12126, 12125, 12124, 12127, 12128 ], "first_item": { "cost": 450, "currency": "USD" }, "additional_items": { "cost": 0, "currency": "USD" }, "countries": ["US"] }, { "variant_ids": [ 42716, 42717, 42718, 42719, 42720, 12144, 12143, 12142, 12145, 12146, 12150, 12149, 12148, 12151, 12152, 12162, 12161, 12160, 12163, 12164, 12180, 12179, 12178, 12181, 12182, 12192, 12191, 12190, 12193, 12194, 11874, 11873, 11872, 11875, 11876, 11892, 11891, 11890, 11893, 11894, 11898, 11897, 11896, 11899, 11900, 11934, 11933, 11932, 11935, 11936, 11946, 11945, 11944, 11947, 11948, 11952, 11951, 11950, 11953, 11954, 11958, 11957, 11956, 11959, 11960, 11976, 11975, 11974, 11977, 11978, 11988, 11987, 11986, 11989, 11990, 12012, 12011, 12010, 12013, 12014, 12018, 12017, 12016, 12019, 12020, 12024, 12023, 12022, 12025, 12026, 12030, 12029, 12028, 12031, 12032, 12054, 12053, 12052, 12055, 12056, 12072, 12071, 12070, 12073, 12074, 12102, 12101, 12100, 12103, 12104, 12126, 12125, 12124, 12127, 12128 ], "first_item": { "cost": 650, "currency": "USD" }, "additional_items": { "cost": 0, "currency": "USD" }, "countries": [ "CA", "AU", "AT", "BE", "BG", "HR", "CY", "CZ", "DK", "EE", "FI", "FR", "DE", "GR", "HU", "IS", "IE", "IT", "LT", "LV", "LU", "MT", "NL", "NO", "PT", "PL", "RO", "SK", "SI", "ES", "SE", "CH", "TR", "GB", "GI", "AX" ] }, { "variant_ids": [ 42716, 42717, 42718, 42719, 42720, 12144, 12143, 12142, 12145, 12146, 12150, 12149, 12148, 12151, 12152, 12162, 12161, 12160, 12163, 12164, 12180, 12179, 12178, 12181, 12182, 12192, 12191, 12190, 12193, 12194, 11874, 11873, 11872, 11875, 11876, 11892, 11891, 11890, 11893, 11894, 11898, 11897, 11896, 11899, 11900, 11934, 11933, 11932, 11935, 11936, 11946, 11945, 11944, 11947, 11948, 11952, 11951, 11950, 11953, 11954, 11958, 11957, 11956, 11959, 11960, 11976, 11975, 11974, 11977, 11978, 11988, 11987, 11986, 11989, 11990, 12012, 12011, 12010, 12013, 12014, 12018, 12017, 12016, 12019, 12020, 12024, 12023, 12022, 12025, 12026, 12030, 12029, 12028, 12031, 12032, 12054, 12053, 12052, 12055, 12056, 12072, 12071, 12070, 12073, 12074, 12102, 12101, 12100, 12103, 12104, 12126, 12125, 12124, 12127, 12128 ], "first_item": { "cost": 1100, "currency": "USD" }, "additional_items": { "cost": 0, "currency": "USD" }, "countries": ["REST_OF_THE_WORLD"] } ] } ``` -------------------------------- ### List Blueprints - Printify SDK JS Source: https://github.com/spencerlepine/printify-sdk-js/blob/main/docs/API.md Retrieves a comprehensive list of all available product blueprints from the Printify catalog. This function corresponds to the `GET /v1/catalog/blueprints.json` API endpoint. ```js await printify.catalog.listBlueprints(); ``` ```APIDOC APIDOC: printify.catalog.listBlueprints() - Method: GET - Endpoint: /v1/catalog/blueprints.json - Description: Retrieve a list of all available blueprints. - Returns: An array of blueprint objects, each containing 'id', 'title', 'description', 'brand', 'model', and 'images'. ``` -------------------------------- ### Sample Response for Variant Shipping Source: https://github.com/spencerlepine/printify-sdk-js/blob/main/docs/API.md Provides an example of the JSON response structure returned by the `getVariantShipping` API call. It includes handling time, shipping profiles with variant IDs, costs, currency, and destination countries. ```json { "handling_time": { "value": 30, "unit": "day" }, "profiles": [ { "variant_ids": [ 42716, 42717, 42718, 42719, 42720, 12144, 12143, 12142, 12145, 12146, 12150, 12149, 12148, 12151, 12152, 12162, 12161, 12160, 12163, 12164, 12180, 12179, 12178, 12181, 12182, 12192, 12191, 12190, 12193, 12194, 11874, 11873, 11872, 11875, 11876, 11892, 11891, 11890, 11893, 11894, 11898, 11897, 11896, 11899, 11900, 11934, 11933, 11932, 11935, 11936, 11946, 11945, 11944, 11947, 11948, 11952, 11951, 11950, 11953, 11954, 11958, 11957, 11956, 11959, 11960, 11976, 11975, 11974, 11977, 11978, 11988, 11987, 11986, 11989, 11990, 12012, 12011, 12010, 12013, 12014, 12018, 12017, 12016, 12019, 12020, 12024, 12023, 12022, 12025, 12026, 12030, 12029, 12028, 12031, 12032, 12054, 12053, 12052, 12055, 12056, 12072, 12071, 12070, 12073, 12074, 12102, 12101, 12100, 12103, 12104, 12126, 12125, 12124, 12127, 12128 ], "first_item": { "cost": 450, "currency": "USD" }, "additional_items": { "cost": 0, "currency": "USD" }, "countries": ["US"] }, { "variant_ids": [ 42716, 42717, 42718, 42719, 42720, 12144, 12143, 12142, 12145, 12146, 12150, 12149, 12148, 12151, 12152, 12162, 12161, 12160, 12163, 12164, 12180, 12179, 12178, 12181, 12182, 12192, 12191, 12190, 12193, 12194, 11874, 11873, 11872, 11875, 11876, 11892, 11891, 11890, 11893, 11894, 11898, 11897, 11896, 11899, 11900, 11934, 11933, 11932, 11935, 11936, 11946, 11945, 11944, 11947, 11948, 11952, 11951, 11950, 11953, 11954, 11958, 11957, 11956, 11959, 11960, 11976, 11975, 11974, 11977, 11978, 11988, 11987, 11986, 11989, 11990, 12012, 12011, 12010, 12013, 12014, 12018, 12017, 12016, 12019, 12020, 12024, 12023, 12022, 12025, 12026, 12030, 12029, 12028, 12031, 12032, 12054, 12053, 12052, 12055, 12056, 12072, 12071, 12070, 12073, 12074, 12102, 12101, 12100, 12103, 12104, 12126, 12125, 12124, 12127, 12128 ], "first_item": { "cost": 650, "currency": "USD" }, "additional_items": { "cost": 0, "currency": "USD" }, "countries": [ "CA", "AU", "AT", "BE", "BG", "HR", "CY", "CZ", "DK", "EE", "FI", "FR", "DE", "GR", "HU", "IS", "IE", "IT", "LT", "LV", "LU", "MT", "NL", "NO", "PT", "PL", "RO", "SK", "SI", "ES", "SE", "CH", "TR", "GB", "GI", "AX" ] }, { "variant_ids": [ 42716, 42717, 42718, 42719, 42720, 12144, 12143, 12142, 12145, 12146, 12150, 12149, 12148, 12151, 12152, 12162, 12161, 12160, 12163, 12164, 12180, 12179, 12178, 12181, 12182, 12192, 12191, 12190, 12193, 12194, 11874, 11873, 11872, 11875, 11876, 11892, 11891, 11890, 11893, 11894, 11898, 11897, 11896, 11899, 11900, 11934, 11933, 11932, 11935, 11936, 11946, 11945, 11944, 11947, 11948, 11952, 11951, 11950, 11953, 11954, 11958, 11957, 11956, 11959, 11960, 11976, 11975, 11974, 11977, 11978, 11988, 11987, 11986, 11989, 11990, 12012, 12011, 12010, 12013, 12014, 12018, 12017, 12016, 12019, 12020, 12024, 12023, 12022, 12025, 12026, 12030, 12029, 12028, 12031, 12032, 12054, 12053, 12052, 12055, 12056, 12072, 12071, 12070, 12073, 12074, 12102, 12101, 12100, 12103, 12104, 12126, 12125, 12124, 12127, 12128 ], "first_item": { "cost": 1100, "currency": "USD" }, "additional_items": { "cost": 0, "currency": "USD" }, "countries": ["REST_OF_THE_WORLD"] } ] } ``` -------------------------------- ### Get Shops via Curl Source: https://github.com/spencerlepine/printify-sdk-js/wiki/Home Demonstrates how to retrieve a list of shops associated with a Printify account using a curl command. It requires an API token for authentication. ```sh curl -X GET --header "Authorization: Bearer $PRINTIFY_API_TOKEN" ``` -------------------------------- ### Get Standard Shipping Info (JavaScript) Source: https://github.com/spencerlepine/printify-sdk-js/blob/main/docs/API.md Retrieves detailed information about the standard shipping method for a given blueprint and print provider. This includes pricing and handling times. ```javascript await printify.v2.catalog.getStandardShippingInfo('3', '8'); ``` -------------------------------- ### Printify API: Get Product Details Source: https://github.com/spencerlepine/printify-sdk-js/wiki/Home Fetches detailed information for a specific product within a Printify shop. This API endpoint requires both the shop ID and the product ID to identify the target resource. ```APIDOC GET /v1/shops/{shop_id}/products/{product_id}.json Description: Retrieve a product Response Example: ```json { "id": "5d39b159e7c48c000728c89f", "title": "Mug 11oz", "description": "Perfect for coffee, tea and hot chocolate, this classic shape white, durable ceramic mug in the most popular size. High quality sublimation printing makes it an appreciated gift to every true hot beverage lover.Perfect for coffee, tea and hot chocolate, this classic shape white, durable ceramic mug in the most popular size. High quality sublimation printing makes it an appreciated gift to every true hot beverage lover. .: White ceramic .: 11 oz (0.33 l) .: Rounded corners .: C-Handle", "tags": ["Home & Living", "Mugs", "11 oz", "White base", "Sublimation"], "options": [{ "name": "Sizes", "type": "size", "values": [{ "id": 1189, "title": "11oz" }] }], "variants": [ { "id": 33719, "sku": "866366009", "cost": 516, "price": 860, "title": "11oz", "grams": 460, "is_enabled": true, "is_default": true, "is_available": true, "is_printify_express_eligible": true, "options": [1189] } ], "images": [ { "src": "https://images.printify.com/mockup/5d39b159e7c48c000728c89f/33719/145/mug-11oz.jpg", "variant_ids": [33719], "position": "front", "is_default": false }, { "src": "https://images.printify.com/mockup/5d39b159e7c48c000728c89f/33719/146/mug-11oz.jpg", "variant_ids": [33719], "position": "other", "is_default": false }, { "src": "https://images.printify.com/mockup/5d39b159e7c48c000728c89f/33719/147/mug-11oz.jpg", "variant_ids": [33719], "position": "other", "is_default": true } ], "created_at": "2019-07-25 13:40:41+00:00", "updated_at": "2019-07-25 13:40:59+00:00", "visible": true, "is_locked": false, "is_printify_express_eligible": true, "is_printify_express_enabled": true, "is_economy_shipping_eligible": true, "is_economy_shipping_enabled": true, "blueprint_id": 68, "user_id": 1337, "shop_id": 1337, "print_provider_id": 9, "print_areas": [ { "variant_ids": [33719], "placeholders": [ { "position": "front", "images": [{ "id": "5c7665205342af161e1cb26e", "name": "Test.png", "type": "image/png", "height": 5850, "width": 4350, "x": 0.5, "y": 0.5, "scale": 1.01, "angle": 0 }] } ], "background": "#ffffff" } ], "sales_channel_properties": [] } ``` ``` -------------------------------- ### Initialize and Use Printify SDK (JavaScript) Source: https://github.com/spencerlepine/printify-sdk-js/blob/main/README.md Demonstrates how to initialize the Printify SDK with an access token and shop ID, and then use it to fetch orders. Includes logging and optional shop ID configuration. ```javascript import Printify from 'printify-sdk-js'; const printify = new Printify({ accessToken: process.env.PRINTIFY_API_TOKEN, // generate a token: https://printify.com/app/account/api shopId: '123456', // (optional) find using `printify.shops.list()` enableLogging: true, }); const orders = await printify.orders.list({ limit: 5, status: 'fulfilled' }); console.log(orders); // { current_page: 1, data: [{ id: "5a9", address_to: {}, line_items: [], total_price: 2200, status: "fulfilled" } ] ``` -------------------------------- ### Get Specific Order by ID using Printify SDK JS Source: https://github.com/spencerlepine/printify-sdk-js/wiki/Home Fetches detailed information for a single order using its unique identifier. This operation maps to a GET request on a specific order resource within a shop. ```javascript await printify.orders.getOne(orderId); ``` ```APIDOC Printify Orders API - Get Order by ID GET /v1/shops/{shop_id}/orders/{order_id}.json Description: Get order details by id. Parameters: - shop_id (path, required): The ID of the shop. - order_id (path, required): The ID of the order to retrieve. Returns: A JSON object containing the details of the specified order. The response includes address, line items, status, and fulfillment information. ``` -------------------------------- ### Create Product using Printify SDK (JavaScript) Source: https://github.com/spencerlepine/printify-sdk-js/wiki/Home Demonstrates how to create a new product via the Printify SDK. It requires a data object containing product details, blueprint ID, print provider ID, variants, and print areas. The function is asynchronous and returns the created product details. ```javascript const data = { "title": "Product", "description": "Good product", "blueprint_id": 384, "print_provider_id": 1, "variants": [ { "id": 45740, "price": 400, "is_enabled": true }, { "id": 45742, "price": 400, "is_enabled": true }, { "id": 45744, "price": 400, "is_enabled": false }, { "id": 45746, "price": 400, "is_enabled": false } ], "print_areas": [ { "variant_ids": [45740, 45742, 45744, 45746], "placeholders": [{ "position": "front", "images": [{ "id": "5d15ca551163cde90d7b2203", "x": 0.5, "y": 0.5, "scale": 1, "angle": 0 }] }] } ] }; await printify.products.create(data); ``` -------------------------------- ### Get Blueprint Details - Printify SDK JS Source: https://github.com/spencerlepine/printify-sdk-js/blob/main/docs/API.md Fetches detailed information for a specific product blueprint identified by its ID. This operation uses `printify.catalog.getBlueprint(blueprintId)` and maps to the `GET /v1/catalog/blueprints/{blueprint_id}.json` API endpoint. ```js await printify.catalog.getBlueprint(blueprintId); ``` ```APIDOC APIDOC: printify.catalog.getBlueprint(blueprintId) - Method: GET - Endpoint: /v1/catalog/blueprints/{blueprint_id}.json - Description: Retrieve a specific blueprint. - Parameters: - blueprintId: The unique identifier for the blueprint. - Returns: A blueprint object with detailed information including 'id', 'title', 'description', 'brand', 'model', and 'images'. ``` -------------------------------- ### Get Specific Order by ID using Printify SDK JS Source: https://github.com/spencerlepine/printify-sdk-js/blob/main/docs/API.md Fetches detailed information for a single order using its unique identifier. This operation maps to a GET request on a specific order resource within a shop. ```javascript await printify.orders.getOne(orderId); ``` ```APIDOC Printify Orders API - Get Order by ID GET /v1/shops/{shop_id}/orders/{order_id}.json Description: Get order details by id. Parameters: - shop_id (path, required): The ID of the shop. - order_id (path, required): The ID of the order to retrieve. Returns: A JSON object containing the details of the specified order. The response includes address, line items, status, and fulfillment information. ``` -------------------------------- ### List Shops - Printify SDK JS Source: https://github.com/spencerlepine/printify-sdk-js/blob/main/docs/API.md Retrieves a list of all shops associated with a Printify account. This operation corresponds to the `GET /v1/shops.json` API endpoint. ```js await printify.shops.list(); ``` ```APIDOC APIDOC: printify.shops.list() - Method: GET - Endpoint: /v1/shops.json - Description: Retrieve a list of shops in a Printify account. - Returns: An array of shop objects, each containing 'id', 'title', and 'sales_channel'. ``` -------------------------------- ### Printify SDK Configuration Options Source: https://github.com/spencerlepine/printify-sdk-js/blob/main/README.md Details the configuration options available when initializing the Printify SDK, including accessToken, shopId, enableLogging, host, and timeout. ```javascript import Printify from 'printify-sdk-js'; const printify = new Printify({ accessToken: process.env.PRINTIFY_API_TOKEN, shopId: '123456', enableLogging: true, host: 'api.printify.com', timeout: 5000, // in ms }); /* | Option | Default | Description | | --------------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------- | | `accessToken` | `null` | The API access token for authenticating requests. Generate one at [Printify API](https://printify.com/app/account/api). | | `shopId` | `null` | (optional) Your personal shop ID. Can be found using `printify.shops.list()`. | | `enableLogging` | `true` | (optional) Enables logging of API requests and errors. Enabled by default. | | `host` | `'api.printify.com'` | (optional) The host for API requests. | | `timeout` | `5000` | (optional) Request timeout in ms. | */ ``` -------------------------------- ### Get Single Product Source: https://github.com/spencerlepine/printify-sdk-js/wiki/Home Retrieves a specific product from a Printify shop using its unique identifier. This function is part of the products module in the Printify SDK. ```javascript await printify.products.getOne(productId); ``` -------------------------------- ### Get Single Product Source: https://github.com/spencerlepine/printify-sdk-js/blob/main/docs/API.md Retrieves a specific product from a Printify shop using its unique identifier. This function is part of the products module in the Printify SDK. ```javascript await printify.products.getOne(productId); ``` -------------------------------- ### Create Product using Printify SDK (JavaScript) Source: https://github.com/spencerlepine/printify-sdk-js/blob/main/docs/API.md Demonstrates how to create a new product via the Printify SDK. It requires a data object containing product details, blueprint ID, print provider ID, variants, and print areas. The function is asynchronous and returns the created product details. ```javascript const data = { "title": "Product", "description": "Good product", "blueprint_id": 384, "print_provider_id": 1, "variants": [ { "id": 45740, "price": 400, "is_enabled": true }, { "id": 45742, "price": 400, "is_enabled": true }, { "id": 45744, "price": 400, "is_enabled": false }, { "id": 45746, "price": 400, "is_enabled": false } ], "print_areas": [ { "variant_ids": [45740, 45742, 45744, 45746], "placeholders": [{ "position": "front", "images": [{ "id": "5d15ca551163cde90d7b2203", "x": 0.5, "y": 0.5, "scale": 1, "angle": 0 }] }] } ] }; await printify.products.create(data); ``` -------------------------------- ### List Print Providers (JavaScript) Source: https://github.com/spencerlepine/printify-sdk-js/blob/main/docs/API.md Fetches a list of all available print providers from the Printify catalog. This function makes a GET request to the /v1/catalog/print_providers.json endpoint. ```javascript await printify.catalog.listProviders(); ``` -------------------------------- ### Development and Contribution Source: https://github.com/spencerlepine/printify-sdk-js/blob/main/README.md Provides commands for setting up the development environment, running tests, and contributing to the Printify SDK project. ```sh yarn install yarn test # (optional) test the bundle locally cd examples/typescript && yarn && cd ../../ yarn build rm -rf examples/typescript/node_modules/printify-sdk-js/dist && mv dist examples/typescript/node_modules/printify-sdk-js cd examples/typescript yarn start ``` -------------------------------- ### Initialize and Use Printify SDK (CommonJS) Source: https://github.com/spencerlepine/printify-sdk-js/blob/main/README.md Demonstrates initializing and using the Printify SDK with CommonJS module syntax, including handling promises with .then() and .catch(). ```javascript const Printify = require('printify-sdk-js'); const printify = new Printify({ accessToken: process.env.PRINTIFY_API_TOKEN, shopId: '123456', }); printify.orders .list({ limit: 5, status: 'fulfilled' }) .then(orders => console.log(orders)) .catch(error => console.error(error)); ``` -------------------------------- ### Get Uploaded Image By ID (JavaScript) Source: https://github.com/spencerlepine/printify-sdk-js/blob/main/docs/API.md Retrieves a specific uploaded image by its unique ID. This function allows fetching details of a previously uploaded image. ```javascript await printify.uploads.getById(imageId); ``` -------------------------------- ### Get Uploaded Image By ID (JavaScript) Source: https://github.com/spencerlepine/printify-sdk-js/wiki/Home Retrieves a specific uploaded image by its unique ID. This function allows fetching details of a previously uploaded image. ```javascript await printify.uploads.getById(imageId); ``` -------------------------------- ### Initialize and Use Printify SDK (TypeScript) Source: https://github.com/spencerlepine/printify-sdk-js/blob/main/README.md Shows how to use the Printify SDK with TypeScript, including importing specific types like 'Webhook' and fetching webhooks. ```typescript import Printify, { Webhook } from 'printify-sdk-js'; const printify = new Printify({ accessToken: process.env.PRINTIFY_API_TOKEN, shopId: '123456', }); const webhooks: Webhook[] = await printify.webhooks.list(); console.log(webhooks[0]); // { "topic": "order:created", "url": "https://example.com/webhooks/order/created", "shop_id": "1", "id": "5cb87a8cd490a2ccb256cec4" } ``` -------------------------------- ### Printify Catalog API Endpoints Source: https://github.com/spencerlepine/printify-sdk-js/wiki/Home Documentation for the Printify Catalog API, including methods to list all print providers and retrieve details for a specific provider. Covers HTTP methods, endpoints, and response structures. ```APIDOC Printify Catalog API: 1. List Print Providers: - Method: GET - Endpoint: /v1/catalog/print_providers.json - Description: Retrieve a list of all available print-providers. - Parameters: None - Returns: An array of print provider objects, each containing id, title, and location details. - Example Response Structure: [ { "id": 1, "title": "SPOKE Custom Products", "location": { "address1": "89 Weirfield St", "address2": null, "city": "Brooklyn", "country": "US", "region": "NY", "zip": "11221-5120" } }, ... ] 2. Get Specific Print Provider: - Method: GET - Endpoint: /v1/catalog/print_providers/{print_provider_id}.json - Description: Retrieve a specific print-provider and a list of associated blueprint offerings. - Parameters: - print_provider_id (path parameter): The unique identifier for the print provider. - Returns: A print provider object including its details and a list of available blueprints. - Example Response Structure: { "id": 1, "title": "SPOKE Custom Products", "location": { "address1": "89 Weirfield St", "address2": null, "city": "Brooklyn", "country": "US", "region": "NY", "zip": "11221-5120" }, "blueprints": [ { "id": 265, "title": "Slim Iphone 8", "brand": "Case Mate", "model": "Slim Iphone 8", "images": ["https://images.printify.com/59b261c9b8e7e361c9147b1b.png"] }, ... ] } ``` -------------------------------- ### Publish Product - Printify SDK JS Source: https://github.com/spencerlepine/printify-sdk-js/wiki/Home Publishes a product to a connected sales channel. This operation uses a POST request and requires the product ID and a data object specifying which product details to publish. Note that actual publishing depends on sales channel integration; otherwise, it triggers events. ```APIDOC printify.products.publishOne(productId, data) - **HTTP Method:** POST - **Endpoint:** `/v1/shops/{shop_id}/products/{product_id}/publish.json` - **Description:** Publish a product. - **Parameters:** - `productId` (string): The unique identifier of the product to publish. - `data` (object): An object specifying which product details to publish. Example: `{ title: true, description: true, images: true, variants: true, tags: true, keyFeatures: true, shipping_template: true }`. - **Returns:** An empty object `{}` upon successful request. - **Notes:** - Publishing actions require the Printify store to be connected to a sales channel. - If no sales channel is connected, this triggers `product::publish::started` events with the provided data. - Refer to [product events](https://developers.printify.com/#product-events) for more details. - **Example Usage:** ```js const data = { title: true, description: true, images: true, variants: true, tags: true, keyFeatures: true, shipping_template: true }; await printify.products.publishOne('productId', data); ``` ``` ```javascript const data = { title: true, description: true, images: true, variants: true, tags: true, keyFeatures: true, shipping_template: true }; await printify.products.publishOne('productId', data); ``` ```json {} ``` -------------------------------- ### Get Shipping List Info (JavaScript) Source: https://github.com/spencerlepine/printify-sdk-js/blob/main/docs/API.md Fetches a list of available shipping methods for a specific blueprint and print provider. This function is part of the Catalog V2 API. ```javascript await printify.v2.catalog.getShippingListInfo('3', '8'); ``` -------------------------------- ### Get Specific Print Provider (JavaScript) Source: https://github.com/spencerlepine/printify-sdk-js/blob/main/docs/API.md Retrieves details for a specific print provider, including their associated blueprint offerings. Requires the print provider's ID as an argument. ```javascript await printify.catalog.getProvider(printProviderId); ``` -------------------------------- ### List Products with Printify SDK Source: https://github.com/spencerlepine/printify-sdk-js/wiki/Home Retrieves a list of products from a Printify shop. Supports optional pagination and limiting results. The default limit is 10, with a maximum of 100. ```javascript await printify.products.list(); await printify.products.list({ page: 2 }); await printify.products.list({ limit: 5 }); ```