npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@dudadev/partner-api

v2.10.0

Published

Provides convenient access to Duda's public APIs from applications written in server-side Javascript.

Downloads

2,064

Readme

@dudadev/partner-api

The @dudadev/partner-api library provides convenient access to Duda's public APIs from applications written in server-side Javascript.

  1. Requirements
  2. Installation
  3. Usage
  4. Configuration
    1. Initialize with config object
    2. API Environments
    3. Network Retries
  5. Request Overrides
  6. Responses
    1. Success
    2. Errors
  7. Debugging
  8. App Store
    1. Authenticating requests
    2. Handling different api_endpoint values
    3. Utility functions
    4. Configuring at instantiation (beta)
  9. More Information

Requirements

Node v14 or higher.

Installation

Install the package with:

npm install @dudadev/partner-api --save
# or
yarn add @dudadev/partner-api

Usage

The package needs to be configured with your API credentials:

const { Duda } = require("@dudadev/partner-api");

const duda = new Duda({
  user: process.env.DUDA_API_USER,
  pass: process.env.DUDA_API_PASS,
  env: Duda.Envs.direct,
});

duda.sites
  .get({ site_name: "a-site-name" })
  .then((site) => console.log(site))
  .catch((error) => console.error(error));

Or using ES modules and async/await:

// async / await
(async function () {
  try {
    const site = await duda.sites.get({ site_name: "a-site-name" });
    console.log(site);
  } catch (error) {
    console.log(error.status, error.error);
    // handle error
  }
})();

Configuration

Initialize with config object

The package can be initialized with several options:

const duda = new Duda({
  user: "api-user",
  pass: "api-pass",
  env: Duda.Envs.sandbox, // also, .direct, .eu
});

API Environments

  • Duda.Envs.eu: api.eu.duda.co
  • Duda.Envs.direct: api.duda.co
  • Duda.Envs.sandbox: api-sandbox.duda.co

Request Timeout

The request timeout limit. The maximum number of milliseconds before a request is considered to be timed out. This will trigger a timeout event handler and reject the promise with an ECONNRESET error code. This option defaults to 10000ms.

const duda = new Duda({
  ...,
  timeout: 1000
});

Network Retries

Automatic network retries can be enabled with the maxNetworkRetries config option. This will retry requests n times with exponential backoff if they fail due to an intermittent network problem. It's recommended you also set the timeout config option when enabling retries. Keep in mind that the timeout config is related to the timeout of the request, it does not affect the timing of the exponential backoff.

const duda = new Duda({
  ...,
  maxNetworkRetries: 2,
  timeout: 1000
});

Request Overrides

You can override the http.RequestOptions of any method on a per-request basis by passing a second object with custom options:

const { Duda } = require("@dudadev/partner-api");

const duda = new Duda({
  user: process.env.DUDA_API_USER,
  pass: process.env.DUDA_API_PASS,
  env: Duda.Envs.direct,
});

duda.sites
  .get(
    { site_name: "a-site-name" },
    {
      host: "api-special.duda.co",
      auth: "another-username:another-password",
      headers: {
        "X-CUSTOM-HEADER": "a-value",
      },
    },
  )
  .then((site) => console.log(site))
  .catch((error) => console.error(error));

Responses

Success

The library will attempt to parse all successful responses as JSON, and will return the raw value if it can't.

Errors

The library will either throw (for promises) or return (for callbacks) the following payload after receiving a status code >= 400:

interface ErrorResponse<DudaError> {
  status: number;
  error: DudaError;
}

Debugging

You can debug requests made by the library by setting the DUDA_API_LOG_LEVEL environment variable to one of the following levels:

  1. error: only shows fatal errors
  2. warning: shows all errors and warnings
  3. info: high-level debugging information
  4. debug: verbose debugging information

The library will display logs that are >= DUDA_API_LOG_LEVEL. So, for example, setting the log level to warning (2) would log all warnings (2) and errors (1).

The logger will attempt to redact any sensitive information before it logs using the following regular expressions:

  • /(user(name)?|pass(word)?|auth(orization)?)":"[^"]+/gi
  • /(Bearer|Basic) [^"]+/gi

Example using debug

$ DUDA_API_LOG_LEVEL=debug node index.js
[debug] 8ce2a72d-d6b6-4fe8-bf39-45ebe99f7233 no http agent defined: received=undefined
[info] 8ce2a72d-d6b6-4fe8-bf39-45ebe99f7233 new request: method=get endpoint=api-sandbox.duda.co/api/sites/multiscreen/374f37ea1eff44e7966b2c685ded251a/pages
[debug] 8ce2a72d-d6b6-4fe8-bf39-45ebe99f7233 full request details: req={"headers":{},"method":"get","path":"/api/sites/multiscreen/374f37ea1eff44e7966b2c685ded251a/pages","auth": [redacted],"host":"api-sandbox.duda.co"}
[debug] 8ce2a72d-d6b6-4fe8-bf39-45ebe99f7233 data received: raw={"results":[{"uuid":"683340afe033436caab26cf8a548b1dd","title":"Home","path":"home","seo":{"no_index":false}}]}
[debug] 8ce2a72d-d6b6-4fe8-bf39-45ebe99f7233 request ended: status=200 time=0.51s

App Store API

If you're an app developer, you can access the App Store API under duda.appstore after calling new Duda(opts).

Authenticating requests

API Endpoints protected by an X-DUDA-ACCESS-TOKEN expect method calls to include a token property set to the authorization_code without Bearer included.

duda.appstore.sites.get({
  site_name: "a-site-name",
  token: "authorization-code",
});

Handling different api_endpoint values

You can use the request override feature to set the host of a method call to the correct api_endpoint for a particular site.

function getSite(site: string) {
  const { site_name, auth, api_endpoint } = getInstallFromDB(site);

  return duda.appstore.sites.get(
    {
      site_name: site_name,
      token: auth.authorization_code,
    },
    {
      host: api_endpoint,
    },
  );
}

getSite("a-site-name")
  .then((site) => console.log(site))
  .catch((err) => console.log(err.status, err.error));

Utility functions

Included under Duda.appstore is utils which contains useful methods for validating webhooks & signatures.

function validateWebook(req: YourRequestObject): boolean {
  // conform request object
  return duda.appstore.utils.validateWebook(
    process.env.SECRET_KEY,
    req.headers,
    req.body,
  );
}

function validateSSO(req: YourRequestObject): boolean {
  // conform request object
  return duda.appstore.utils.validateSSOLink(process.env.SECRET_KEY, req.query);
}

Configuring the Duda instance at instantiation for App Store requests (beta)

As of 2.8.0 you can configure an instance of the Duda class with an App Store configuration, negating the need to pass your token on each request. This configuration will also automatically handle refreshing your token if the expiration date has passed. Note: You are still responsible for saving your new authorization and expiration date into your database.

const duda = new Duda(
  {
    user: "testing",
    pass: "testing",
    env: Duda.Envs.direct,
  },
  {
    auth: appStoreAuthObject,
    uuid: appUuid,
  },
);

The optional second argument contains the UUID of your app (this is provided by Duda when starting your app build), and the entire auth object you receive when an app is installed onto a site.

Once configured in this fashion, any requests to methods under the appstore namespace will no longer require a token.

return duda.appstore.sites.get(
  {
    site_name: site_name,
  },
  {
    host: api_endpoint,
  },
);

A second benefit of this configuration is that the object will check the expiration_date on the supplied auth object before executing your App Store request. If the date has passed, it will call the token refresh endpoint and obtain a new auth object that contains an updated authorization_code.

After aquiring a new code. The object will emit an event containing the entire auth object, which you should save to your db.

const duda = new Duda(
  {
    user: "testing",
    pass: "testing",
    env: Duda.Envs.direct,
  },
  {
    auth: appStoreAuthObject,
    uuid: appUuid,
  },
);

duda.events.on("refresh", (auth) => {
  // save the updated auth object with the rest of the app install data.
});

This feature is currently in beta, if you experience any issues while implementing the new configuration, please open an issue.

Sites

Get Site

Get Site Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}

duda.sites.get({ site_name: site_name });

Get Site by External ID

Get Site by External ID Reference

Request

GET https://api.duda.co/api/sites/multiscreen/byexternalid/{external_uid}

duda.sites.getByExternalID({ external_uid: external_uid });

Create Site

Create Site Reference

Request

POST https://api.duda.co/api/sites/multiscreen/create

duda.sites.create({ template_id: template_id });

Update Site

Update Site Reference

Request

POST https://api.duda.co/api/sites/multiscreen/update/{site_name}

duda.sites.update({ site_name: site_name });

Duplicate Site

Duplicate Site Reference

Request

POST https://api.duda.co/api/sites/multiscreen/duplicate/{site_name}

duda.sites.duplicate({
  site_name: site_name,
  new_default_domain_prefix: new_default_domain_prefix,
});

Publish Site

Publish Site Reference

Request

POST https://api.duda.co/api/sites/multiscreen/publish/{site_name}

duda.sites.publish({ site_name: site_name });

Unpublish Site

Unpublish Site Reference

Request

POST https://api.duda.co/api/sites/multiscreen/unpublish/{site_name}

duda.sites.unpublish({ site_name: site_name });

Reset Site

Reset Site Reference

Request

POST https://api.duda.co/api/sites/multiscreen/reset/{site_name}

duda.sites.reset({ site_name: site_name, template_id: template_id });

Switch Template

Switch Template Reference

Request

POST https://api.duda.co/api/sites/multiscreen/switchTemplate/{site_name}

duda.sites.switchTemplate({ site_name: site_name, template_id: template_id });

Delete Site

Delete Site Reference

Request

DELETE https://api.duda.co/api/sites/multiscreen/{site_name}

duda.sites.delete({ site_name: site_name });

Get Site Theme

Get Site Theme Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}/theme

duda.sites.theme.get({ site_name: site_name });

Update Site Theme

Update Site Theme Reference

Request

PUT https://api.duda.co/api/sites/multiscreen/{site_name}/theme

duda.sites.theme.update({ site_name: site_name });

Templates

List Templates

List Templates Reference

Request

GET https://api.duda.co/api/sites/multiscreen/templates

duda.templates.list();

Get Template

Get Template Reference

Request

GET https://api.duda.co/api/sites/multiscreen/templates/{template_id}

duda.templates.get({ template_id: template_id });

Update Template

Update Template Reference

Request

POST https://api.duda.co/api/sites/multiscreen/templates/{template_id}

duda.templates.update({ template_id: template_id });

Create From Site

Create From Site Reference

Request

POST https://api.duda.co/api/sites/multiscreen/templates/fromsite

duda.templates.createFromSite({ site_name: site_name });

Create From Template

Create From Template Reference

Request

POST https://api.duda.co/api/sites/multiscreen/templates/fromtemplate

duda.templates.createFromTemplate({ template_id: template_id });

Delete Template

Delete Template Reference

Request

DELETE https://api.duda.co/api/sites/multiscreen/templates/{template_id}

duda.templates.delete({ template_id: template_id });

Pages v2

List Pages

List Pages Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}/pages

duda.pages.v2.list({ site_name: site_name });

Get Page

Get Page Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}/pages/{page_uuid}

duda.pages.v2.get({ site_name: site_name, page_uuid: page_uuid });

Update Page

Update Page Reference

Request

PUT https://api.duda.co/api/sites/multiscreen/{site_name}/pages/{page_uuid}

duda.pages.v2.update({ site_name: site_name, page_uuid: page_uuid });

Create Page

Create Page Reference

Request

POST https://api.duda.co/api/sites/multiscreen/{site_name}/pages

duda.pages.v2.create({ site_name: site_name });

Duplicate Page

Duplicate Page Reference

Request

POST https://api.duda.co/api/sites/multiscreen/{site_name}/pages/{page_uuid}/duplicate

duda.pages.v2.duplicate({ site_name: site_name, page_uuid: page_uuid });

Delete Page

Delete Page Reference

Request

DELETE https://api.duda.co/api/sites/multiscreen/{site_name}/pages/{page_uuid}

duda.pages.v2.delete({ site_name: site_name, page_uuid: page_uuid });

Page Elements

List Page Elements

List Page Elements Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}/pages/{page_uuid}/elements

duda.pages.elements.list({ site_name: site_name, page_uuid: page_uuid });

Create Page Element

Create Page Element Reference

Request

POST https://api.duda.co/api/sites/multiscreen/{site_name}/pages/{page_uuid}/elements

duda.pages.elements.create({ site_name: site_name, page_uuid: page_uuid });

Update Page Element

Update Page Element Reference

Request

PUT https://api.duda.co/api/sites/multiscreen/{site_name}/pages/{page_uuid}/elements/{element_id}

duda.pages.elements.update({
  site_name: site_name,
  page_uuid: page_uuid,
  element_id: element_id,
});

Delete Page Element

Delete Page Element Reference

Request

DELETE https://api.duda.co/api/sites/multiscreen/{site_name}/pages/{page_uuid}/elements/{element_id}

duda.pages.elements.delete({
  site_name: site_name,
  page_uuid: page_uuid,
  element_id: element_id,
});

Sections

List Sections

List Sections Reference

Request

GET https://api.duda.co/api/sections

duda.sections.list();

Get Section

Get Section Reference

Request

GET https://api.duda.co/api/sections/{section_uuid}

duda.sections.get({ section_uuid: section_uuid });

Navigation

List Navigation

List Navigation Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}/navigation

duda.navigation.list({ site_name: site_name });

Get Navigation By Language

Get Navigation By Language Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}/navigation/{lang}

duda.navigation.getByLang({ site_name: site_name, lang: lang });

Create Navigation

Create Navigation Reference

Request

POST https://api.duda.co/api/sites/multiscreen/{site_name}/navigation/{lang}/items

duda.navigation.create({ site_name: site_name, lang: lang });

Update Navigation

Update Navigation Reference

Request

PATCH https://api.duda.co/api/sites/multiscreen/{site_name}/navigation/{lang}/items/{navigation_id}

duda.navigation.update({
  site_name: site_name,
  lang: lang,
  navigation_id: navigation_id,
});

Blog

Import Blog

Import Blog Reference

Request

POST https://api.duda.co/api/sites/multiscreen/{site_name}/blog/import

duda.blog.import({ site_name: site_name });

Import Blog Post

Import Blog Post Reference

Request

POST https://api.duda.co/api/sites/multiscreen/{site_name}/blog/posts/import

duda.blog.importPost({ site_name: site_name });

Delete Blog Post

Delete Reference

Request

POST https://api.duda.co/api/sites/multiscreen/{site_name}/blog

duda.blog.delete({ site_name: site_name });

eComm

Get Settings

Get Settings Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce

duda.ecomm.get({ site_name: site_name });

Update Settings

Update Settings Reference

Request

PATCH https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce

duda.ecomm.update({ site_name: site_name });

eComm Carts

List Carts

List Carts Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/carts

duda.ecomm.carts.list({ site_name: site_name });

Get Cart

Get Cart Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/carts/{cart_id}

duda.ecomm.carts.get({ site_name: site_name, cart_id: cart_id });

eComm Orders

List Orders

List Orders Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/orders

duda.ecomm.orders.list({ site_name: site_name });

Get Order

Get Order Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/orders/{order_id}

duda.ecomm.orders.get({ site_name: site_name, order_id: order_id });

Update Order

Update Order Reference

Request

PATCH https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/orders/{order_id}

duda.ecomm.orders.update({ site_name: site_name, order_id: order_id });

List Refunds

List Refunds Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/orders/{order_id}/refunds

duda.ecomm.orders.listRefunds({ site_name: site_name, order_id: order_id });

Get Refund

Get Refund Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/orders/{order_id}/refunds/{refund_id}

duda.ecomm.orders.getRefund({
  site_name: site_name,
  order_id: order_id,
  refund_id: refund_id,
});

eComm Payment Gateways

List Payment Gateways

List Payment Gateways Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/payment-gateways

duda.ecomm.gateways.list({ site_name: site_name });

Get Payment Gateway

Get Payment Gateway Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/payment-gateways/{gateway_id}

duda.ecomm.gateways.get({ site_name: site_name, gateway_id: gateway_id });

Create Payment Gateway

Create Payment Gateway Reference

Request

POST https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/payment-gateways

duda.ecomm.gateways.create({
  site_name: site_name,
  live_payment_methods_url: live_payment_methods_url,
});

Update Payment Gateway

Update Payment Gateway Reference

Request

PATCH https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/payment-gateways/{gateway_id}

duda.ecomm.gateways.update({
  site_name: site_name,
  gateway_id: gateway_id,
  live_payment_methods_url: live_payment_methods_url,
});

Delete Payment Gateway

Delete Payment Gateway Reference

Request

DELETE https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/payment-gateways/{gateway_id}

duda.ecomm.gateways.delete({ site_name: site_name, gateway_id: gateway_id });

eComm Payments

Get Payment Session

Get Payment Session Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/payment-sessions/{session_id}

duda.ecomm.payments.get({ site_name: site_name, session_id: session_id });

Confirm Payment

Confirm Payment Reference

Request

POST https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/payment-sessions/{session_id}/confirm

duda.ecomm.payments.confirm({
  site_name: site_name,
  session_id: session_id,
  state: state,
});

eComm Categories

Get Categories

Get Categories Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/categories

duda.ecomm.categories.list({ site_name: site_name });

Get Category

Get Category Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/categories/{category_id}

duda.ecomm.categories.get({ site_name: site_name, category_id: category_id });

Create Category

Create Category Reference

Request

POST https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/categories

duda.ecomm.categories.create({ site_name: site_name });

Update Category

Update Category Reference

Request

PATCH https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/categories/{category_id}

duda.ecomm.categories.update({
  site_name: site_name,
  category_id: category_id,
});

Delete Category

Delete Category Reference

Request

DELETE https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/categories/{category_id}

duda.ecomm.categories.delete({
  site_name: site_name,
  category_id: category_id,
});

eComm Shipping Providers

List Shipping Providers

List Shipping Providers Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/shipping-providers

duda.ecomm.shipping.list({ site_name: site_name });

Get Shipping Provider

Get Shipping Provider Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{siteAlias}/ecommerce/shipping-providers/{id}

duda.ecomm.shipping.get({ site_name: site_name, id: id });

Create Shipping Provider

Create Shipping Provider Reference

Request

POST https://api.duda.co/api/sites/multiscreen/{siteAlias}/ecommerce/shipping-providers

duda.ecomm.shipping.create({
  site_name: site_name,
  live_shipping_rates_url: live_shipping_rates_url,
});

Update Shipping Provider

Update Shipping Provider Reference

Request

PATCH https://api.duda.co/api/sites/multiscreen/{siteAlias}/ecommerce/shipping-providers/{id}

duda.ecomm.shipping.update({ site_name: site_name, id: id });

Delete Shipping Provider

Delete Shipping Provider Reference

Request

DELETE https://api.duda.co/api/sites/multiscreen/{siteAlias}/ecommerce/shipping-providers/{id}

duda.ecomm.shipping.delete({ site_name: site_name, id: id });

eComm Products

List Products

List Products Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/products

duda.ecomm.products.list({ site_name: site_name });

Get Product

Get Product Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/products/{product_id}

duda.ecomm.products.get({ site_name: site_name, product_id: product_id });

Create Product

Create Product Reference

Request

CREATE https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/products

duda.ecomm.products.create({ site_name: site_name });

Update Product

Update Product Reference

Request

PATCH https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/products/{product_id}

duda.ecomm.products.update({ site_name: site_name, product_id: product_id });

Delete Product

Delete Product Reference

Request

DELETE https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/products/{product_id}

duda.ecomm.products.delete({ site_name: site_name, product_id: product_id });

eComm Variations

Get Product Variation

Get Product Variation Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/products/{product_id}/variations/{variation_id}

duda.ecomm.variations.get({
  site_name: site_name,
  product_id: product_id,
  variation_id: variation_id,
});

Update Product Variation

Update Product Variation Reference

Request

PATCH https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/products/{product_id}/variations/{variation_id}

duda.ecomm.variations.update({
  site_name: site_name,
  product_id: product_id,
  variation_id: variation_id,
});

eComm Product Options

List Product Options

List Product Options Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/options

duda.ecomm.options.list({ site_name: site_name });

Get Product Option

Get Product Option Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/options/{option_id}

duda.ecomm.options.get({ site_name: site_name, option_id: option_id });

Create Product Option

Create Product Option Reference

Request

CREATE https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/options

duda.ecomm.options.create({
  site_name: site_name,
  choices: choices,
  name: name,
});

Update Product Option

Update Product Option Reference

Request

PUT https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/options/{option_id}

duda.ecomm.options.update({
  site_name: site_name,
  option_id: option_id,
  name: name,
});

Delete Product Option

Delete Product Option Reference

Request

DELETE https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/options/{option_id}

duda.ecomm.options.delete({ site_name: site_name, option_id: option_id });

Create Product Option Choice

Create Product Option Choice Reference

Request

POST https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/options/{option_id}/choices

duda.ecomm.options.createChoice({
  site_name: site_name,
  option_id: option_id,
  value: value,
});

Update Product Option Choice

Update Product Option Choice Reference

Request

PUT https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/options/{option_id}/choices/{choice_id}

duda.ecomm.options.createChoice({
  site_name: site_name,
  option_id: option_id,
  choice_id: choice_id,
  value: value,
});

Delete Product Option Choice

Delete Product Option Choice Reference

Request

DELETE https://api.duda.co/api/sites/multiscreen/{site_name}/ecommerce/options/{option_id}/choices/{choice_id}

duda.ecomm.options.createChoice({
  site_name: site_name,
  option_id: option_id,
  choice_id: choice_id,
});

URL Rules

List Rules

List Rules Reference

Request

GET https://api.duda.co/api/sites/multiscreen/site/{site_name}/urlrules

duda.urlRules.list({ site_name: site_name });

Get Rule

Get Rule Reference

Request

GET https://api.duda.co/api/sites/multiscreen/site/{site_name}/urlrules/{id}

duda.urlRules.get({ site_name: site_name, id: id });

Create Rule

Create Rule Reference

Request

POST https://api.duda.co/api/sites/multiscreen/site/{site_name}/urlrules

duda.urlRules.create({ site_name: site_name });

Update Rule

Update Rule Reference

Request

PUT https://api.duda.co/api/sites/multiscreen/site/{site_name}/urlrules/{id}

duda.urlRules.update({ site_name: site_name, id: id });

Delete Rule

Delete Rule Reference

Request

DELETE https://api.duda.co/api/sites/multiscreen/site/{site_name}/urlrules/{id}

duda.urlRules.update({ site_name: site_name, id: id });

Site Plans

List Site Plans

List Site Plans Reference

Request

GET https://api.duda.co/api/sites/multiscreen/plans

duda.plans.list();

Get Site Plan

Get Site Plan Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}/plan

duda.plans.get({ site_name: site_name });

Update Site Plan

Update Site Plan Reference

Request

POST https://api.duda.co/api/sites/multiscreen/{site_name}/plan/{plan_id}

duda.plans.update({ site_name: site_name, plan_id: plan_id });

Accounts

Get Account

Get Account Reference

Request

GET https://api.duda.co/api/accounts/{account_name}

duda.accounts.get({ account_name: account_name });

Create Account

Create Account Reference

Request

POST https://api.duda.co/api/accounts/create

duda.accounts.create({ account_name: account_name });

Update Account

Update Account Reference

Request

POST https://api.duda.co/api/accounts/update/{account_name}

duda.accounts.update({ account_name: account_name });

Delete Account

Delete Account Reference

Request

DELETE https://api.duda.co/api/accounts/{account_name}

duda.accounts.delete({ account_name: account_name });

Authentication

Get SSO Link

Get SSO Link Reference

Request

GET https://api.duda.co/api/accounts/sso/{account_name}/link

duda.accounts.authentication.getSSOLink({ account_name: account_name });

Create Password Reset Link

Create Password Reset Link Reference

Request

POST https://api.duda.co/api/accounts/reset-password/{account_name}

duda.accounts.authentication.getResetPasswordLink({
  account_name: account_name,
});

Create Welcome Link

Create Welcome Link Reference

Request

POST https://api.duda.co/api/accounts/reset-password/{account_name}

duda.accounts.authentication.getWelcomeLink({ account_name: account_name });

Permissions

List Client Permissions

List Client Permissions Reference

Request

GET https://api.duda.co/api/accounts/permissions/multiscreen

duda.accounts.permissions.list();

Get Client Permissions

Get Client Permissions Reference

Request

GET https://api.duda.co/api/accounts/{account_name}/sites/{site_name}/permissions

duda.accounts.permissions.get({
  account_name: account_name,
  site_name: site_name,
});

List Client Sites

List Client Sites Reference

Request

GET https://api.duda.co/api/accounts/grant-access/{account_name}/sites/multiscreen

duda.accounts.permissions.listAccessibleSites({ account_name: account_name });

Grant Site Access

Grant Site Access Reference

Request

POST https://api.duda.co/api/accounts/{account_name}/sites/{site_name}/permissions

duda.accounts.permissions.grantSiteAccess({
  account_name: account_name,
  site_name: site_name,
});

Remove Site Access

Remove Site Access Reference

Request

DELETE https://api.duda.co/api/accounts/{account_name}/sites/{site_name}/permissions

duda.accounts.permissions.removeSiteAccess({
  account_name: account_name,
  site_name: site_name,
});

List Duda Team Groups

List Duda Team Groups Reference

Request

GET https://api.duda.co/api/permission-groups/default

duda.accounts.permissions.listDudaTeamGroups();

List Custom Team Groups

List Custom Team Groups Reference

Request

GET https://api.duda.co/api/permission-groups/custom

duda.accounts.permissions.listCustomTeamGroups();

Assign Team Member to Group

Assign Team Member to Group Reference

Request

POST https://api.duda.co/api/permission-groups/{group_name}/accounts/{account_name}/add

duda.accounts.permissions.assignTeamMemberGroup({
  group_name: group_name,
  account_name: account_name,
});

Content

Get Content Library

Get Content Library Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}/content

duda.content.get({ site_name: site_name });

Update Content Library

Update Content Library Reference

Request

POST https://api.duda.co/api/sites/multiscreen/{site_name}/content

duda.content.update({ site_name: site_name });

Publish Content Library

Publish Content Library Reference

Request

POST https://api.duda.co/api/sites/multiscreen/{site_name}/content/publish

duda.content.publish({ site_name: site_name });

Get Location

Get Location Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}/content/location/{location_id}

duda.content.multilocation.get({
  site_name: site_name,
  location_id: location_id,
});

Create Location

Create Location Reference

Request

POST https://api.duda.co/api/sites/multiscreen/{site_name}/content/location

duda.content.multilocation.create({ site_name: site_name });

Update Location

Update Location Reference

Request

POST https://api.duda.co/api/sites/multiscreen/{site_name}/content/location/{location_id}

duda.content.multilocation.update({
  site_name: site_name,
  location_id: location_id,
});

Delete Location

Delete Location Reference

Request

DELETE https://api.duda.co/api/sites/multiscreen/{site_name}/content/location/{location_id}

duda.content.multilocation.delete({
  site_name: site_name,
  location_id: location_id,
});

Get Injected Content

Get Injected Content Reference

Request

GET https://api.duda.co/api/sites/multiscreen/inject-content/{site_name}

duda.content.injectedContent.get({ site_name: site_name });

Create Injected Content

Create Injected Content Reference

Request

POST https://api.duda.co/api/sites/multiscreen/inject-content/{site_name}

duda.content.injectedContent.create({ site_name: site_name });

Create Injected Content (Single Page)

Create Injected Content (Single Page) Reference

Request

POST https://api.duda.co/api/sites/multiscreen/inject-content/{site_name}/pages/{page_name}

duda.content.injectedContent.createSPA({
  site_name: site_name,
  page_name: page_name,
});

Upload Resource

Upload Resource Reference

Request

POST https://api.duda.co/api/sites/multiscreen/resources/{site_name}/upload

duda.content.uploadResource({ site_name: site_name });

Snippets

List Snippets

List Snippets Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}/snippets

duda.snippets.list({ site_name: site_name });

Get Snippet

Get Snippet Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}/snippets/{id}

duda.snippets.get({ site_name: site_name, id: id });

Create Snippet

Create Snippet Reference

Request

POST https://api.duda.co/api/sites/multiscreen/{site_name}/snippets

duda.snippets.create({ site_name: site_name });

Update Snippet

Update Snippet Reference

Request

PATCH https://api.duda.co/api/sites/multiscreen/{site_name}/snippets/{id}

duda.snippets.update({ site_name: site_name, id: id });

Publish Snippet

Publish Snippet Reference

Request

POST https://api.duda.co/api/sites/multiscreen/{site_name}/snippets/{id}/publish

duda.snippets.publish({ site_name: site_name, id: id });

Delete Snippet

Delete Snippet Reference

Request

DELETE https://api.duda.co/api/sites/multiscreen/{site_name}/snippets/{id}

duda.snippets.delete({ site_name: site_name, id: id });

Collections

List Collections

List Collections Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}/collection

duda.collections.list({ site_name: site_name });

Get Collection

Get Collection Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}/collection/{collection_name}

duda.collections.get({
  site_name: site_name,
  collection_name: collection_name,
});

Create Collection

Create Collection Reference

Request

POST https://api.duda.co/api/sites/multiscreen/{site_name}/collection

duda.collections.create({ site_name: site_name, name: name });

Update Collection

Update Collection Reference

Request

PUT https://api.duda.co/api/sites/multiscreen/{site_name}/collection/{current_collection_name}

duda.collections.update({
  site_name: site_name,
  current_collection_name: current_collection_name,
});

Delete Collection

Delete Collection Reference

Request

DELETE https://api.duda.co/api/sites/multiscreen/{site_name}/collection/{collection_name}

duda.collections.delete({
  site_name: site_name,
  collection_name: collection_name,
});

Clear Cache

Clear Cache Reference

Request

POST https://api.duda.co/api/sites/multiscreen/{site_name}/collection/{collection_name}/revalidate

duda.collections.clearCache({
  site_name: site_name,
  collection_name: collection_name,
});

Clear Cache by External ID

Clear Cache by External ID Reference

Request

POST https://api.duda.co/api/sites/multiscreen/collections/revalidate/{external_id}

duda.collections.clearCacheByExtID({ external_id: external_id });

Create Rows

Create Rows Reference

Request

POST https://api.duda.co/api/sites/multiscreen/{site_name}/collection/{collection_name}/row

duda.collections.rows.create({
  site_name: site_name,
  collection_name: collection_name,
});

Update Rows

Update Rows Reference

Request

PUT https://api.duda.co/api/sites/multiscreen/{site_name}/collection/{collection_name}/row

duda.collections.rows.update({
  site_name: site_name,
  collection_name: collection_name,
});

Delete Row

Delete Row Reference

Request

DELETE https://api.duda.co/api/sites/multiscreen/{site_name}/collection/{collection_name}/row/{row_id}

duda.collections.rows.deleteRow({
  site_name: site_name,
  collection_name: collection_name,
  row_id: row_id,
});

Delete Rows

Delete Rows Reference

Request

DELETE https://api.duda.co/api/sites/multiscreen/{site_name}/collection/{collection_name}/row

duda.collections.rows.delete({
  site_name: site_name,
  collection_name: collection_name,
});

Create Fields

Create Fields Reference

Request

POST https://api.duda.co/api/sites/multiscreen/{site_name}/collection/{collection_name}/field

duda.collections.fields.create({
  site_name: site_name,
  collection_name: collection_name,
});

Update Field

Update Field Reference

Request

PUT https://api.duda.co/api/sites/multiscreen/{site_name}/collection/{collection_name}/field/{field_name}

duda.collections.fields.update({
  site_name: site_name,
  collection_name: collection_name,
  field_name: field_name,
});

Delete Field

Delete Field Reference

Request

DELETE https://api.duda.co/api/sites/multiscreen/{site_name}/collection/{collection_name}/field/{field_name}

duda.collections.fields.delete({
  site_name: site_name,
  collection_name: collection_name,
  field_name: field_name,
});

Reporting

Site Created

Site Created Reference

Request

GET https://api.duda.co/api/sites/multiscreen/created

duda.reporting.sites.created();

Sites Published

Sites Published Reference

Request

GET https://api.duda.co/api/sites/multiscreen/published

duda.reporting.sites.published();

Sites Unpublished

Sites Unpublished Reference

Request

GET https://api.duda.co/api/sites/multiscreen/unpublished

duda.reporting.sites.unpublished();

Form Submissions

Form Submissions Reference

Request

GET https://api.duda.co/api/sites/multiscreen/get-forms/{site_name}

duda.reporting.forms.submissions({ site_name: site_name });

Activities

Activities Reference

Request

GET https://api.duda.co/api/sites/multiscreen/{site_name}/activities

duda.reporting.activities.get({ site_name: site_name });

Analytics

Analytics Reference

Request

GET https://api.duda.co/api/analytics/site/{site_name}

duda.reporting.analytics.get({ site_name: site_name });

Get Client Settings

Get Client Settings Reference

Request

GET https://api.duda.co/api/accounts/{account_name}/sites/{site_name}/stats-email

duda.reporting.emailSettings.get({
  account_name: account_name,
  site_name: site_name,
});

Create Subscription

Create Subscription Reference

Request

POST https://api.duda.co/api/accounts/{account_name}/sites/{site_name}/stats-email

duda.reporting.emailSettings.subscribe({
  account_name: account_name,
  site_name: site_name,
  frequency: frequency,
});

Unsubscribe

Unsubscribe Reference

Request

DELETE https://api.duda.co/api/accounts/{account_name}/sites/{site_name}/stats-email

duda.reporting.emailSettings.unsubscribe({
  account_name: account_name,
  site_name: site_name,
});

Other

List Backups

List Backups Reference

Request

GET https://api.duda.co/api/sites/multiscreen/backups/{site_name}

duda.other.backups.list({ site_name: site_name });

Create Backup

Create Backup Reference

Request

POST https://api.duda.co/api/sites/multiscreen/backups/{site_name}/create

duda.other.backups.create({ site_name: site_name });

Restore Backup

Restore Backup Reference

Request

POST https://api.duda.co/api/sites/multiscreen/backups/{site_name}/restore/{backup_name}

duda.other.backups.restore({ site_name: site_name, backup_name: backup_name });

Delete Backup

Delete Backup Reference

Request

DELETE https://api.duda.co/api/sites/multiscreen/backups/{site_name}/{backup_name}

duda.other.backups.delete({ site_name: site_name, backup_name: backup_name });

Create Certificate

Create Certificate Reference

Request

POST https://api.duda.co/api/sites/multiscreen/{site_name}/certificate

duda.other.ssl.create({ site_name: site_name });

Renew Certificate

Renew Certificate Reference

Request

POST https://api.duda.co/api/sites/multiscreen/{site_name}/certificate/renew

duda.other.ssl.renew({ site_name: site_name });

Delete Certificate

Delete Certificate Reference

Request

DELETE https://api.duda.co/api/sites/multiscreen/{site_name}/certificate

duda.other.ssl.delete({ site_name: site_name });

Simple Editor

Update Simple Editor Settings

Update Simple Editors Settings Reference

Request

PATCH https://api.duda.co/api/sites/multiscreen/{site_name}/simple-editor

duda.diyEditor.update({
  site_name: site_name,
  onboarding_required: onboarding_required,
});

Appstore Accounts

Get Account Details

Get Account Details Reference

Request

GET https://api.duda.co/api/integrationhub/application/site/{site_name}/account/details

duda.appstore.accounts.getOwner({ site_name: site_name });

Appstore Sites

Get Site

Get Site Reference

Request

GET https://api.duda.co/api/integrationhub/application/site/{site_name}

duda.appstore.sites.get({ site_name: site_name });

Update Site

Update Site Reference

Request

POST https://api.duda.co/api/integrationhub/application/site/{site_name}

duda.appstore.sites.update({ site_name: site_name });

Get Branding Details

Get Branding Details Reference

Request

GET https://api.duda.co/api/integrationhub/application/site/{site_name}/branding

duda.appstore.sites.getBrandingDetails({ site_name: site_name });

Republish Site

Republish Site Reference

Request

POST https://api.duda.co/api/integrationhub/application/site/{site_name}/republish

duda.appstore.sites.republish({ site_name: site_name });

Upload Resources

Upload Resources Reference

Request

POST https://api.duda.co/api/integrationhub/application/site/{site_name}/resources/upload

duda.appstore.sites.uploadResources({ site_name: site_name });

Appstore Content

Get Content Library

Get Content Library Reference

Request

GET https://api.duda.co/api/integrationhub/application/site/{site_name}/content

duda.appstore.content.get({ site_name: site_name });

Update Content Library

Update Content Library Reference

Request

POST https://api.duda.co/api/integrationhub/application/site/{site_name}/content

duda.appstore.content.update({ site_name: site_name });

Publish Content Library

Publish Content Library Reference

Request

POST https://api.duda.co/api/integrationhub/application/site/{site_name}/content/publish

duda.appstore.content.publish({ site_name: site_name });

Get Location

Get Location Reference

Request

GET https://api.duda.co/api/integrationhub/application/site/{site_name}/content/location/{location_id}

duda.appstore.content.locations.get({
  site_name: site_name,
  location_id: location_id,
});

Create Location

Create Location Reference

Request

POST https://api.duda.co/api/integrationhub/application/site/{site_name}/content/location

duda.appstore.content.locations.create({ site_name: site_name });

Update Location

Update Location Reference

Request

POST https://api.duda.co/api/integrationhub/application/site/{site_name}/content/location/{location_id}

duda.appstore.content.locations.update({
  site_name: site_name,
  location_id: location_id,
});

Delete Location

Delete Location Reference

Request

DELETE https://api.duda.co/api/integrationhub/application/site/{site_name}/content/location/{location_id}

duda.appstore.content.locations.delete({
  site_name: site_name,
  location_id: location_id,
});

Appstore Pages

Get Pages

Get Pages Reference

Request

GET https://api.duda.co/api/integrationhub/application/site/{site_name}/v2/pages

duda.appstore.pages.get({ site_name: site_name });

Update Page

Update Page Reference

Request

PUT https://api.duda.co/api/integrationhub/application/site/{site_name}/v2/pages/{page_uuid}

duda.appstore.pages.update({ site_name: site_name, page_uuid: page_uuid });

Appstore eComm

Get Settings

Get Settings Reference

Request

GET https://api-sandbox.duda.co/api/integrationhub/application/site/{site_name}/ecommerce

duda.appstore.ecomm.get({ site_name: site_name });

Update Settings

Update Settings Reference

Request

PATCH https://api-sandbox.duda.co/api/integrationhub/application/site/{site_name}/ecommerce

duda.appstore.ecomm.update({ site_name: site_name });

Appstore eComm Products

List Products

List Products Reference

Request

GET https://api-sandbox.duda.co/api/integrationhub/application/site/{site_name}/ecommerce/products

duda.appstore.ecomm.products.list({ site_name: site_name });

Get Product

Get Product Reference

Request

GET https://api-sandbox.duda.co/api/integrationhub/application/site/{site_name}/ecommerce/products/{product_id}

duda.appstore.ecomm.products.get({
  site_name: site_name,
  product_id: product_id,
});

Create Product

Create Product Reference

Request

POST https://api-sandbox.duda.co/api/integrationhub/application/site/{site_name}/ecommerce/products

duda.appstore.ecomm.products.create({ site_name: site_name });

Update Product

Update Product Reference

Request

PATCH https://api-sandbox.duda.co/api/integrationhub/application/site/{site_name}/ecommerce/products/{product_id}

duda.appstore.ecomm.products.update({
  site_name: site_name,
  product_id: product_id,
});

Delete Product

Delete Product Reference

Request

DELETE https://api-sandbox.duda.co/api/integrationhub/application/site/{site_name}/ecommerce/products/{product_id}

duda.appstore.ecomm.products.delete({
  site_name: site_name,
  product_id: product_id,
});

Appstore eComm Variations

Get Product Variation

Get Product Variation Reference

Request

GET https://api-sandbox.duda.co/api/integrationhub/application/site/{site_name}/ecommerce/products/{product_id}/variations/{variation_id}

duda.appstore.ecomm.variations.get({
  site_name: site_name,
  product_id: product_id,
  variation_id: variation_id,
});

Update Product Variation

Update Product Variation Reference

Request

PATCH https://api-sandbox.duda.co/api/integrationhub/application/site/{site_name}/ecommerce/products/{product_id}/variations/{variation_id}

duda.appstore.ecomm.variations.update({
  site_name: site_name,
  product_id: product_id,
  variation_id: variation_id,
});

Appstore eComm Product Options

List Product Options

List Product Options Reference

Request

GET https://api-sandbox.duda.co/api/integrationhub/application/site/{site_name}/ecommerce/options

duda.appstore.ecomm.options.list({ site_name: site_name });

Get Product Option

Get Product Option Reference

Request

GET https://api-sandbox.duda.co/api/integrationhub/application/site/{site_name}/ecommerce/options/{option_id}

duda.appstore.ecomm.options.get({ site_name: site_name, option_id: option_id });

Create Product Option

Create Product Option Reference

Request

POST https://api-sandbox.duda.co/api/integrationhub/application/site/{site_name}/ecommerce/options

duda.appstore.ecomm.options.create({
  site_name: site_name,
  name: name,
  choices: choices,
});

Update Product Option

Update Product Option Reference

Request

PUT https://api-sandbox.duda.co/api/integrationhub/application/site/{site_name}/ecommerce/options/{option_id}

duda.appstore.ecomm.options.update({
  site_name: site_name,
  option_id: option_id,
  name: name,
});

Delete Product Option

Delete Product Option Reference

Request

DELETE https://api-sandbox.duda.co/api/integrationhub/application/site/{site_name}/ecommerce/options/{option_id}

duda.appstore.ecomm.options.delete({
  site_name: site_name,
  option_id: option_id,
});

Create Product Option Choice

Create Product Option Choice Reference

Request

POST https://api-sandbox.duda.co/api/integrationhub/application/site/{site_name}/ecommerce/options/{option_id}/choices

duda.appstore.ecomm.options.createChoice({
  site_name: site_name,
  option_id: option_id,
  value: value,
});

Update Product Option Choice

Update Product Option Choice Reference

Request

PUT https://api-sandbox.duda.co/api/integrationhub/application/site/{site_name}/ecommerce/options/{option_id}/choices/{choice_id}

duda.appstore.ecomm.options.createChoice({
  site_name: site_name,
  option_id: option_id,
  choice_id: choice_id,
  value: value,
});

Delete Product Option Choice

Delete Product Option Choice Reference

Request

DELETE https://api-sandbox.duda.co/api/integrationhub/application/site/{site_name}/ecommerce/options/{option_id}/choices/{choice_id}

duda.appstore.ecomm.options.createChoice({
  site_name: site_name,
  option_id: option_id,
  choice_id: choice_id,
});

Appstore eComm Orders

List Orders

List Orders Reference

Request

GET https://api-sandbox.duda.co/api/integrationhub/application/site/{site_name}/ecommerce/orders

duda.appstore.ecomm.orders.list({ site_name: site_name });

Get Order

Get Order Reference

Request

GET https://api-sandbox.duda.co/api/integrationhub/application/site/{site_name}/ecommerce/orders/{order_id}

duda.appstore.ecomm.orders.get({ site_name: site_name, order_id: order_id });

Update Order

[Update Order Referen