### Response Example for Get Products Source: https://developers.mailerlite.com/docs/ecommerce-categories-products-api Example JSON response when retrieving products for a category, including product details and pagination metadata. ```json { "data": [ { "id": "31986843543567834", "name": "Product name", "price": 123.4, "url": "https://shop-url.com/product-name", "image": "https://shop-url.com/product-image.jpg", "exclude_from_automations": false, "categories": [ { "id": "1234566457534276", "name": "Category 1", "exclude_from_automations": false, "created_at": "2021-09-01 14:03:50", "updated_at": "2021-09-01 14:03:50" }, { "id": "1234566457534278", "name": "Category 2", "exclude_from_automations": false, "created_at": "2021-09-01 14:03:50", "updated_at": "2021-09-01 14:03:50" } ] } ], "links": { "first": "https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/categories/:category_id/products?page=1", "last": "https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/categories/:category_id/products?page=1", "prev": null, "next": null }, "meta": { "current_page": 1, "from": 1, "last_page": 1, "links": [ { "url": null, "label": "« Previous", "active": false }, { "url": "https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/categories/:category_id/products?page=1", "label": "1", "active": true }, { "url": null, "label": "Next »", "active": false } ], "path": "https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/categories/:category_id/products", "per_page": 100, "to": 1, "total": 1 } } ``` -------------------------------- ### Fetch Customer Request Example Source: https://developers.mailerlite.com/docs/ecommerce-customers-api Example of a GET request to fetch a specific customer using their ID and the shop ID. ```http GET https://connect.mailerlite.com/api/ecommerce/shops/31986843064993537/customers/319868430643456756 ``` -------------------------------- ### Fetch Category Example Request Source: https://developers.mailerlite.com/docs/ecommerce-categories-api Example of a GET request to fetch a specific category, including placeholder shop and category IDs. ```http GET https://connect.mailerlite.com/api/ecommerce/shops/31986843064993537/categories/319868430643456756 ``` -------------------------------- ### Fetch Order Request Example Source: https://developers.mailerlite.com/docs/ecommerce-orders-api This example shows a GET request to retrieve a specific order. Ensure you replace ':shop_id' and ':order_id' with valid identifiers. ```http GET https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/orders/:order_id ``` ```http GET https://connect.mailerlite.com/api/ecommerce/shops/31986843064993537/orders/319868430643456756 ``` -------------------------------- ### Example Response for Get Customers Source: https://developers.mailerlite.com/docs/ecommerce-customers-api This is an example of the JSON response structure when retrieving a list of customers. It includes customer details and pagination information. ```json { "data": [ { "id": "31986843064993537", "email": "customer@email.com", "accepts_marketing": true, "subscriber": { "id": "31986843064993537", "email": "customer@email.com", "status": "active", "source": "api", "sent": 0, "opens_count": 0, "clicks_count": 0, "open_rate": 0, "click_rate": 0, "ip_address": null, "subscribed_at": "2021-09-01 14:03:50", "unsubscribed_at": null, "created_at": "2021-09-01 14:03:50", "updated_at": "2021-09-01 14:03:50", "fields": { "city": null, "company": null, "country": null, "last_name": "Testerson", "name": "Dummy", "phone": null, "state": null, "z_i_p": null }, "groups": [], "opted_in_at": null, "optin_ip": null }, "created_at": "2021-09-01 14:03:50", "updated_at": "2021-09-01 14:03:50" } ], "links": { "first": "https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/customers?page=1", "last": "https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/customers?page=1", "prev": null, "next": null }, "meta": { "current_page": 1, "from": 1, "last_page": 1, "links": [ { "url": null, "label": "« Previous", "active": false }, { "url": "https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/customers?page=1", "label": "1", "active": true }, { "url": null, "label": "Next »", "active": false } ], "path": "https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/customers", "per_page": 100, "to": 1, "total": 1 } } ``` -------------------------------- ### Example Response: Create Group Source: https://developers.mailerlite.com/docs/groups This is an example of a successful response after creating a group. It returns the details of the newly created group. ```json { "data": { "id": "1", "name": "dummy group", "active_count": 0, "sent_count": 0, "opens_count": 0, "open_rate": { "float": 0, "string": "0%" }, "clicks_count": 0, "click_rate": { "float": 0, "string": "0%" }, "unsubscribed_count": 0, "unconfirmed_count": 0, "bounced_count": 0, "junk_count": 0, "created_at": "2022-05-25 14:22:44" } } ``` -------------------------------- ### Example Response: List Groups Source: https://developers.mailerlite.com/docs/groups This is an example of a successful response when listing all groups. It includes group details, pagination links, and metadata. ```json { "data": [ { "id": "1", "name": "dummy group", "active_count": 0, "sent_count": 0, "opens_count": 0, "open_rate": { "float": 0, "string": "0%" }, "clicks_count": 0, "click_rate": { "float": 0, "string": "0%" }, "unsubscribed_count": 0, "unconfirmed_count": 0, "bounced_count": 0, "junk_count": 0, "created_at": "2022-05-24 11:52:55" } ], "links": { "first": "https://connect.mailerlite.com/api/groups?page=1", "last": "https://connect.mailerlite.com/api/groups?page=1", "prev": null, "next": null }, "meta": { "current_page": 1, "from": 1, "last_page": 1, "links": [ { "url": null, "label": "« Previous", "active": false }, { "url": "https://connect.mailerlite.com/api/groups?page=1", "label": "1", "active": true }, { "url": null, "label": "Next »", "active": false } ], "path": "https://connect.mailerlite.com/api/groups", "per_page": 100, "to": 1, "total": 1 } } ``` -------------------------------- ### Get Form Response (200 OK) Source: https://developers.mailerlite.com/docs/forms Example of a successful response when retrieving a specific form. The response contains detailed attributes of the form. ```json { "data": { "id": "38965245585131492", "type": "embedded", "slug": "Ec7t3n", "name": "inventore provident ut", "created_at": "2021-11-17 14:42:33", "conversions_count": 0, "opens_count": 0, "conversion_rate": { "float": 0, "string": "0%" }, "settings": [], "last_registration_at": null, "active": false, "is_broken": false, "has_content": false, "can": { "update": true }, "used_in_automations": false, "warnings": [], "double_optin": null, "screenshot_url": null } } ``` -------------------------------- ### Product Creation Request Body Example Source: https://developers.mailerlite.com/docs/ecommerce-products-api This is an example of the JSON request body used for creating or updating a product. It includes fields like name, price, and descriptions. ```json { "name": "Product name", "price": 123.40, "url": "https://shop-url.com/product-name", "image": "https://shop-url.com/product-image.jpg", "exclude_from_automations": false, "short_description": "Product's short description.", "description": "Product's longer description." } ``` -------------------------------- ### GET Request to Fetch a Specific Product Source: https://developers.mailerlite.com/docs/ecommerce-products-api Use this GET request to retrieve a single product by its ID for a given shop. ```http GET https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/products/:product_id ``` -------------------------------- ### Example Error Response: Delete Group Source: https://developers.mailerlite.com/docs/groups This example shows an error response when attempting to delete a group that does not exist. A `404 Not Found` status code is returned. ```json ``` -------------------------------- ### Timezone Response Example Source: https://developers.mailerlite.com/docs/timezones This is an example of a successful response (200 OK) when requesting available timezones. It shows the structure of the data returned for each timezone. ```json { "data": [ { "id": "370", "name": "Europe/Vilnius", "name_for_humans": "Europe/Vilnius (+03:00)", "offset_name": "+03:00", "offset": 180 } ] } ``` -------------------------------- ### Example Response for Get Carts Source: https://developers.mailerlite.com/docs/ecommerce-cart-api This is an example of the JSON response structure when retrieving a list of carts. It includes cart data, pagination links, and metadata. ```json { "data": [ { "id": "12564435675647", "ecommerce_order_id": "3456678978907", "checkout_url": "https://url-to-cart-checkout.com", "cart_total": 1234.99, "customer": { "id": "319868430643456756", "email": "customer@email.com", "accepts_marketing": true, "subscriber": { "id": "31986843064993537", "email": "customer@email.com", "status": "active", "source": "api", "sent": 0, "opens_count": 0, "clicks_count": 0, "open_rate": 0, "click_rate": 0, "ip_address": null, "subscribed_at": "2021-09-01 14:03:50", "unsubscribed_at": null, "created_at": "2021-09-01 14:03:50", "updated_at": "2021-09-01 14:03:50", "fields": { "city": null, "company": null, "country": null, "last_name": "Testerson", "name": "Dummy", "phone": null, "state": null, "z_i_p": null }, "groups": [], "opted_in_at": null, "optin_ip": null } }, "items": [ { "id": "45676855678345", "product": { "id": "31986843543567834", "name": "Product name", "price": 123.4, "url": "https://shop-url.com/product-name", "image": "https://shop-url.com/product-image.jpg", "exclude_from_automations": false, "categories": [ { "id": "1234566457534276", "name": "Category 1", "exclude_from_automations": false, "created_at": "2021-09-01 14:03:50", "updated_at": "2021-09-01 14:03:50" }, { "id": "1234566457534278", "name": "Category 2", "exclude_from_automations": false, "created_at": "2021-09-01 14:03:50", "updated_at": "2021-09-01 14:03:50" } ] }, "variant": "product variant", "quantity": 1, "price": 123.4 } ] } ], "links": { "first": "https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/carts?page=1", "last": "https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/carts?page=1", "prev": null, "next": null }, "meta": { "current_page": 1, "from": 1, "last_page": 1, "links": [ { "url": null, "label": "« Previous", "active": false }, { "url": "https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/carts?page=1", "label": "1", "active": true }, { "url": null, "label": "Next »", "active": false } ], "path": "https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/carts", "per_page": 100, "to": 1, "total": 1 } } ``` -------------------------------- ### Import Report Response Example Source: https://developers.mailerlite.com/docs/subscribers This is an example of a successful response (200 OK) when fetching an import report. It details the outcome of the import process, including counts of imported, updated, errored, and unchanged subscribers. ```json { "data": { "id": "47366063630845932", "total": 3, "processed": 3, "imported": 0, "updated": 0, "errored": 3, "percent": 100, "done": true, "file_path": "", "invalid": [], "invalid_count": 0, "mistyped": [], "mistyped_count": 0, "changed": [], "changed_count": 0, "unchanged": [ { "id": "47366064023013357", "email": "dummy_one@import.com" }, { "id": "47366064023013358", "email": "dummy_two+two@import.com" }, { "id": "47366064023013359", "email": "dummy_three@new.com" } ], "unchanged_count": 3, "unsubscribed": [], "unsubscribed_count": 0, "role_based": [], "role_based_count": 0, "banned_import_emails_count": 0, "match_route": "", "source_label": "", "updated_at": "2022-02-18T08:09:58.000000Z", "undone_at": null, "stopped_at": null, "undo_started_at": null, "finished_at": "2022-02-18T08:09:58.000000Z" } } ``` -------------------------------- ### Webhook Response Example Source: https://developers.mailerlite.com/docs/webhooks This is an example of a successful webhook response, indicating a 200 OK status. It shows the structure of the data returned, including webhook details like ID, name, URL, events, and status. ```json { "data": [ { "id": "68079566047937883", "name": "Test 2", "url": "http://google.com", "events": [ "subscriber.created" ], "enabled": true, "secret": "ybmcD7PQ9R", "created_at": "2022-10-04 23:22:13", "updated_at": "2022-10-04 23:54:04", "batchable": true }, { "id": "68078863100413274", "name": "Test", "url": "http://google.com", "events": [ "subscriber.created" ], "enabled": true, "secret": "9JVEvb07Yq", "created_at": "2022-10-04 23:11:03", "updated_at": "2022-10-04 23:11:03", "batchable": false }, { "id": "68078820398204249", "name": "Test", "url": "http://google.com", "events": [ "subscriber.created" ], "enabled": true, "secret": "yXIrayUCWJ", "created_at": "2022-10-04 23:10:22", "updated_at": "2022-10-04 23:10:22", "batchable": true }, { "id": "68074372003267924", "name": "Eveniet vero minus.", "url": "http://www.marvin.com/omnis-accusamus-est-rem-delectus-quaerat.html", "events": [ "subscriber.bounced" ], "enabled": true, "secret": "Kn556GohSH", "created_at": "2022-10-04 21:59:40", "updated_at": "2022-10-04 21:59:40", "batchable": false }, { "id": "68074372003267926", "name": "Et voluptatibus et est voluptatibus.", "url": "http://harber.net/ipsa-molestias-voluptatem-fugiat-quis-tempora-ullam.html", "events": [ "subscriber.automation_completed" ], "enabled": true, "secret": "WXS0dF3FHc", "created_at": "2022-10-04 21:59:40", "updated_at": "2022-10-04 21:59:40", "batchable": true }, { "id": "68074372005365080", "name": "Perferendis dolorem aut nulla.", "url": "http://www.brekke.com/", "events": [ "subscriber.added_to_group" ], "enabled": true, "secret": "Ko17Uw3hiB", "created_at": "2022-10-04 21:59:40", "updated_at": "2022-10-04 21:59:40", "batchable": true }, { "id": "68074372004316503", "name": "Tenetur delectus eum fugiat.", "url": "http://www.cartwright.info/eligendi-soluta-corporis-in-quod-ullam", "events": [ "subscriber.bounced" ], "enabled": true, "secret": "4jQ3Y4UlLI", "created_at": "2022-10-04 21:59:40", "updated_at": "2022-10-04 21:59:40", "batchable": true }, { "id": "68074372001170769", "name": "Tempore voluptatem et voluptas.", "url": "http://www.pfeffer.net/quod-voluptatibus-explicabo-nihil-ipsum-accusamus-error", "events": [ "subscriber.removed_from_group" ], "enabled": true, "secret": "hvHGn2D4yu", "created_at": "2022-10-04 21:59:40", "updated_at": "2022-10-04 21:59:40", "batchable": true }, { "id": "68074372001170770", "name": "Vel inventore rem.", "url": "http://kautzer.com/consequatur-neque-eaque-ad-et-rem-labore-ut.html", "events": [ "subscriber.created" ], "enabled": true, "secret": "xbzp318Djs", "created_at": "2022-10-04 21:59:40", "updated_at": "2022-10-04 21:59:40", "batchable": true }, { "id": "68074372003267925", "name": "Voluptas animi consequatur.", "url": "http://www.oconner.org/laudantium-ipsa-ad-distinctio-eos-quasi-dicta.html", "events": [ "campaign.sent" ], "enabled": true, "secret": "3b1EMAhuoT", "created_at": "2022-10-04 21:59:40", "updated_at": "2022-10-04 21:59:40", "batchable": true }, { "id": "68074371998025039", "name": "Expedita esse est fugit.", "url": "https://www.deckow.com/aut-quae-voluptate-ab-qui-qui", "events": [ "subscriber.removed_from_group" ], "enabled": true, "secret": "QbVgXU0L93", "created_at": "2022-10-04 21:59:40", "updated_at": "2022-10-04 21:59:40", "batchable": true }, { "id": "68074372000122192", "name": "Autem culpa perferendis quaerat.", "url": "http://homenick.biz/tempora-asperiores-qui-alias-voluptas-eos-necessitatibus-et", "events": [ "subscriber.automation_completed" ], "enabled": true, "secret": "N3cZ5WO2ep", "created_at": "2022-10-04 21:59:40", "updated_at": "2022-10-04 21:59:40", "batchable": true }, { "id": "68074372002219347", "name": "Officia quia aut.", "url": "https://www.cartwright.org/mollitia-corporis-ipsam-reiciendis-dolor-error-amet-velit", "events": [ "subscriber.updated" ], "enabled": true, "secret": "xRyma5WnWP", "created_at": "2022-10-04 21:59:40", "updated_at": "2022-10-04 21:59:40", "batchable": true } ] } ``` -------------------------------- ### Create a Product Source: https://developers.mailerlite.com/docs/cli Creates a new product within an e-commerce shop. Requires shop ID, name, price, URL, and optionally a description. ```bash mailerlite product create --shop \ --name "T-Shirt" \ --price 29.99 \ --url "https://mystore.com/tshirt" \ --description "A nice t-shirt" ``` -------------------------------- ### Create Customer Source: https://developers.mailerlite.com/docs/cli Creates a new customer in the specified shop with provided email and name details. Requires the `--shop` flag. ```bash mailerlite customer create --shop \ --email "customer@example.com" \ --first-name "John" \ --last-name "Doe" ``` -------------------------------- ### Create a Shop Source: https://developers.mailerlite.com/docs/cli Creates a new e-commerce shop. You must provide a name and the shop's URL. ```bash mailerlite shop create --name "My Store" --url "https://mystore.com" ``` -------------------------------- ### Install MailerLite CLI with Homebrew Source: https://developers.mailerlite.com/docs/cli Use Homebrew to install the MailerLite CLI on macOS. ```bash brew install --cask mailerlite/tap/mailerlite ``` -------------------------------- ### Get subscribers for a specific form Source: https://developers.mailerlite.com/docs/forms Fetch all subscribers who signed up to a specific form using this GET request. ```APIDOC ## GET /forms/{form_id}/subscribers ### Description Retrieves a list of subscribers who have signed up for a specific form. ### Method GET ### Endpoint https://connect.mailerlite.com/api/forms/{form_id}/subscribers ### Parameters #### Path Parameters - **form_id** (string) - Required - The unique identifier of the form. #### Query Parameters - **filter[status]** (string) - Optional - Filters subscribers by status. Must be one of: active, unsubscribed, unconfirmed, bounced, or junk. Defaults to 'active'. - **limit** (integer) - Optional - The number of results to return per page. Defaults to 25. - **cursor** (string) - Optional - A cursor for fetching the next page of results. Defaults to the first page. ### Response #### Success Response (200 OK) Returns a list of subscribers and pagination information. ```json { "data": [ { "id": "31986843064993537", "email": "dummy@example.com", "status": "active", "source": "api", "sent": 0, "opens_count": 0, "clicks_count": 0, "open_rate": 0, "click_rate": 0, "ip_address": null, "subscribed_at": "2021-09-01 14:03:50", "unsubscribed_at": null, "created_at": "2021-09-01 14:03:50", "updated_at": "2021-09-01 14:03:50", "fields": { "city": null, "company": null, "country": null, "last_name": "Testerson", "name": "Dummy", "phone": null, "state": null, "z_i_p": null }, "groups": [], "opted_in_at": null, "optin_ip": null } ], "links": { "first": null, "last": null, "prev": "https://connect.mailerlite.com/api/forms/1234567890/subscribers?cursor=eyJpZCI6NzI1ODIxNjQ2NDU5Mzg1NTksIl9wb2ludHNUb05leHRJdGVtcyI6ZmFsc2V9", "next": "https://connect.mailerlite.com/api/forms/1234567890/subscribers?cursor=eyJpZCI6NzI1ODIxNjQ2NDY5ODcxMzYsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0" }, "meta": { "path": "https://connect.mailerlite.com/api/forms/1234567890/subscribers", "per_page": 25, "next_cursor": "eyJpZCI6NzI1ODIxNjQ2NDY5ODcxMzYsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0", "prev_cursor": "eyJpZCI6NzI1ODIxNjQ2NDU5Mzg1NTksIl9wb2ludHNUb05leHRJdGVtcyI6ZmFsc2V9" } } ``` #### Error Response (404 Not Found) Returned when the provided form ID is invalid or does not exist. ``` -------------------------------- ### Create Order Source: https://developers.mailerlite.com/docs/cli Creates a new order for a customer in the specified shop with details like status, total, currency, and items. Requires the `--shop` flag. ```bash mailerlite order create --shop \ --customer \ --status complete \ --total 59.98 \ --currency USD \ --items '[{"product_id":"prod1","quantity":2,"price":29.99}]' ``` -------------------------------- ### Get All Campaign Languages Source: https://developers.mailerlite.com/docs/campaign-languages Use this GET request to retrieve a list of all campaign languages available for use in campaigns. ```APIDOC ## GET /campaigns/languages ### Description Retrieves a list of all available campaign languages. ### Method GET ### Endpoint https://connect.mailerlite.com/api/campaigns/languages ### Response #### Success Response (200) - **data** (array) - An array of language objects. - **id** (string) - The unique identifier for the language. - **shortcode** (string) - The short code for the language (e.g., 'en'). - **iso639** (string) - The ISO 639 language code (e.g., 'en-US'). - **name** (string) - The full name of the language (e.g., 'English'). - **direction** (string) - The text direction ('ltr' for left-to-right, 'rtl' for right-to-left). #### Response Example ```json { "data": [ { "id": "4", "shortcode": "en", "iso639": "en-US", "name": "English", "direction": "ltr" } ] } ``` ``` -------------------------------- ### Install MailerLite CLI with Go Source: https://developers.mailerlite.com/docs/cli Install the MailerLite CLI using the Go programming language. Requires Go 1.25+. ```bash go install github.com/mailerlite/mailerlite-cli@latest ``` -------------------------------- ### Example Request Body for Customer Creation/Update Source: https://developers.mailerlite.com/docs/ecommerce-customers-api This JSON object demonstrates the structure for the request body when creating or updating a customer. It includes fields for email, marketing preferences, and total spending. ```json { "email": "Customer name", "accepts_marketing": true, "total_spent": 1234.99, "create_subscriber": true } ``` -------------------------------- ### Get All Available Timezones Source: https://developers.mailerlite.com/docs/timezones Use this GET request to retrieve all available timezones supported by the API. The response includes details for each timezone. ```http GET https://connect.mailerlite.com/api/timezones ``` -------------------------------- ### Create a Webhook Source: https://developers.mailerlite.com/docs/cli Creates a new webhook. You must provide a name, URL, and specify the events to listen for. The webhook can be enabled or disabled. ```bash mailerlite webhook create \ --name "My Webhook" \ --url "https://example.com/webhook" \ --events "subscriber.created,campaign.sent" \ --enabled ``` -------------------------------- ### List Products in a Category Source: https://developers.mailerlite.com/docs/cli Retrieves a list of products associated with a specific category in a shop. ```bash mailerlite category products --shop ``` -------------------------------- ### Run MailerLite CLI with Nix Source: https://developers.mailerlite.com/docs/cli Execute the MailerLite CLI directly using Nix without a formal installation, or install it into your Nix profile. ```bash nix run git+ssh://git@github.com/mailerlite/mailerlite-cli.git ``` ```bash nix profile install git+ssh://git@github.com/mailerlite/mailerlite-cli.git ``` -------------------------------- ### Create/update product Source: https://developers.mailerlite.com/docs/ecommerce-products-api Create a new product or update an existing one for a given shop. ```APIDOC ## POST /ecommerce/shops/:shop_id/products ### Description Creates a new product for the given shop. ### Method POST ### Endpoint https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/products ### Parameters #### Path Parameters - **shop_id** (integer) - Required - The ID of the shop. #### Request Body - **name** (string) - Required - The product's name. - **price** (float) - Optional - The product's price in the shop's currency. Defaults to `0`. - **exclude_from_automations** (boolean) - Optional - If true, this product will not trigger any automations. Defaults to `false`. - **url** (string) - Optional - The products URL. - **image** (string) - Optional - The products main image URL. - **short_description** (string) - Optional - The product's short description. Max `255` characters. HTML tags are automatically removed. - **description** (string) - Optional - The product's description. HTML tags are automatically removed. ### Request Example { "name": "Product name", "price": 123.40, "url": "https://shop-url.com/product-name", "image": "https://shop-url.com/product-image.jpg", "exclude_from_automations": false, "short_description": "Product's short description.", "description": "Product's longer description." } ### Response #### Success Response (201 Created) - **data** (object) - The created product object. #### Response Example { "data": { "id": "31986843543567834", "name": "Product name", "price": 123.4, "url": "https://shop-url.com/product-name", "image": "https://shop-url.com/product-image.jpg", "exclude_from_automations": false, "short_description": "Product's short description.", "description": "Product's longer description.", "categories": [] } } #### Error Response (422 Unprocessable Entity) - **message** (string) - General error message. - **errors** (object) - Object containing specific validation errors. #### Error Example { "message": "The given data was invalid.", "errors": { "name": ["The name must be provided."] } } ``` ```APIDOC ## PUT /ecommerce/shops/:shop_id/products/:product_id ### Description Updates an existing product for the given shop. ### Method PUT ### Endpoint https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/products/:product_id ### Parameters #### Path Parameters - **shop_id** (integer) - Required - The ID of the shop. - **product_id** (string) - Required - The ID of the product to update. #### Request Body - **name** (string) - Optional - The product's name. - **price** (float) - Optional - The product's price in the shop's currency. Defaults to `0`. - **exclude_from_automations** (boolean) - Optional - If true, this product will not trigger any automations. Defaults to `false`. - **url** (string) - Optional - The products URL. - **image** (string) - Optional - The products main image URL. - **short_description** (string) - Optional - The product's short description. Max `255` characters. HTML tags are automatically removed. - **description** (string) - Optional - The product's description. HTML tags are automatically removed. ### Request Example { "name": "Updated Product Name", "price": 150.00 } ### Response #### Success Response (200 OK) - **data** (object) - The updated product object. #### Response Example { "data": { "id": "31986843543567834", "name": "Updated Product Name", "price": 150.00, "url": "https://shop-url.com/product-name", "image": "https://shop-url.com/product-image.jpg", "exclude_from_automations": false, "short_description": "Product's short description.", "description": "Product's longer description.", "categories": [] } } #### Error Response (422 Unprocessable Entity) - **message** (string) - General error message. - **errors** (object) - Object containing specific validation errors. #### Error Example { "message": "The given data was invalid.", "errors": { "name": ["The name must be provided."] } } ``` -------------------------------- ### Get Subscribers in a Group Source: https://developers.mailerlite.com/docs/groups Send a GET request to retrieve all subscribers associated with a specific group. Replace `{group_id}` with the actual ID of the group. ```http GET https://connect.mailerlite.com/api/groups/{group_id}/subscribers ``` -------------------------------- ### Get Product Details Source: https://developers.mailerlite.com/docs/cli Fetches detailed information about a specific product within an e-commerce shop. Requires both product and shop IDs. ```bash mailerlite product get --shop ``` -------------------------------- ### Get Customer Details Source: https://developers.mailerlite.com/docs/cli Fetches detailed information for a specific customer by their ID. Requires the `--shop` flag. ```bash mailerlite customer get --shop ``` -------------------------------- ### Category Request Body Example Source: https://developers.mailerlite.com/docs/ecommerce-categories-api Example of the JSON request body used for creating or updating a category. The 'name' is required, and 'exclude_from_automations' is optional. ```json { "id": "1234566457534276", "name": "Category 1", "exclude_from_automations": false, "created_at": "2021-09-01 14:03:50", "updated_at": "2021-09-01 14:03:50" } ``` -------------------------------- ### Get Shop Details Source: https://developers.mailerlite.com/docs/cli Fetches detailed information about a specific e-commerce shop. Requires the shop ID. ```bash mailerlite shop get ``` -------------------------------- ### Get Campaign Details Source: https://developers.mailerlite.com/docs/campaigns Use this GET request to fetch an existing campaign by its ID. Ensure the campaign ID is valid to avoid a 404 error. ```http GET https://connect.mailerlite.com/api/campaigns/{campaign_id} ``` ```json { "data": { "id": "1", "account_id": "1", "name": "Dummy campaign", "type": "regular", "status": "draft", "missing_data": [], "settings": { "track_opens": true, "use_google_analytics": false, "ecommerce_tracking": false }, "filter": [ [ { "operator": "in_any", "args": [ "groups", [ "42" ] ] } ] ], "filter_for_humans": [ [ "In any group: dummy group" ] ], "delivery_schedule": "instant", "language_id": "4", "created_at": "2022-07-26 15:07:52", "updated_at": "2022-07-26 15:12:17", "scheduled_for": "2022-07-26 15:11:51", "queued_at": "2022-07-26 15:12:04", "started_at": "2022-07-26 15:12:04", "finished_at": "2022-07-26 15:12:17", "stopped_at": null, "default_email_id": "61706700654118223", "emails": [ { "id": "1", "account_id": "1", "emailable_id": "12", "emailable_type": "campaigns", "type": "builder", "from": "dummy@mailerlite.io", "from_name": "Dummy Testerson", "reply_to": "reply-to@mailerlite.io", "name": null, "subject": "hello", "plain_text": "Hello,\n\nYou have received a newsletter from {$account}.\n\nHowever, your email software can\'t display HTML emails. You can view the newsletter by clicking here: {$url}\nYou\'re receiving this newsletter because you have shown interest in {$account}.\nNot interested anymore? Click here to unsubscribe:\n{$unsubscribe}", "screenshot_url": null, "preview_url": null, "created_at": "2022-07-26 15:08:15", "updated_at": "2022-07-26 15:15:29", "is_designed": true, "language_id": null, "is_winner": false, "stats": { "sent": 10, "opens_count": 0, "unique_opens_count": 0, "open_rate": { "float": 0, "string": "0%" }, "clicks_count": 0, "unique_clicks_count": 0, "click_rate": { "float": 0, "string": "0%" }, "unsubscribes_count": 0, "unsubscribe_rate": { "float": 0, "string": "0%" }, "spam_count": 0, "spam_rate": { "float": 0, "string": "0%" }, "hard_bounces_count": 0, "hard_bounce_rate": { "float": 0, "string": "0%" }, "soft_bounces_count": 0, "soft_bounce_rate": { "float": 0, "string": "0%" }, "forwards_count": 0 }, "send_after": null, "track_opens": true } ], "used_in_automations": false, "type_for_humans": "Regular", "is_stopped": false, "has_winner": null, "winner_version_for_human": null, "winner_sending_time_for_humans": null, "winner_selected_manually_at": null, "uses_ecommerce": false, "uses_survey": true, "can_be_scheduled": false, "warnings": [], "initial_created_at": null, "is_currently_sending_out": false } } ``` ```http Response code: 200 OK ``` ```http Response code: 404 Not Found ``` -------------------------------- ### Get Campaigns List Source: https://developers.mailerlite.com/docs/campaigns Use this GET request to retrieve a list of all campaigns. You can filter by status or type, and control pagination with limit and page parameters. ```http GET https://connect.mailerlite.com/api/campaigns ``` -------------------------------- ### GET Request to Retrieve Products Source: https://developers.mailerlite.com/docs/ecommerce-products-api Use this GET request to fetch products for a specific shop. You can control the number of results with 'limit' and 'page' parameters. ```http GET https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/products ``` -------------------------------- ### Import Products from JSON Source: https://developers.mailerlite.com/docs/cli Imports products into a shop from a specified JSON file. Requires the `--shop` flag. ```bash mailerlite import products --shop --file products.json ``` -------------------------------- ### Get Single Import Report Source: https://developers.mailerlite.com/docs/subscribers Use this GET request to retrieve the status and results of a specific subscriber import. Replace `{import_id}` with the actual ID of the import. ```http GET https://connect.mailerlite.com/api/subscribers/import/{import_id} ```