Advanced Coupons API
  • REST API
  • coupons/v1
    • Virtual Coupons (Premium)
      • Query a list of virtual coupons
      • Fetch virtual coupon stats
      • Create a virtual coupon
      • Retrieve a virtual coupon
      • Update a virtual coupon
      • Delete a virtual coupon
      • Bulk create virtual coupons
      • Bulk delete virtual coupons
    • Search Customers (Premium)
    • Settings
  • loyalty-program/v1
    • Dashboard
    • Customers
    • Settings
    • My Points
  • wc-loyalty-program/v1
    • Dashboard
    • Customers
    • Settings
  • wc-store-credits/v1
    • Entries
      • Query a list of store credit entries
      • Create a store credit entry
      • Fetch a single store credit entry
      • Update store credit entry
      • Delete store credit entry
    • Customers
      • Get dashboard statistics data
      • Query list of customers with store credits balance
      • Get single customer statistics and sources
Powered by GitBook
On this page
  • GET: /wp-json/coupons/v1/settings/sections
  • GET: /wp-json/coupons/v1/settings/sections/{section_id}
  • GET: /wp-json/coupons/v1/settings/{setting_id}
  • PUT: /wp-json/coupons/v1/settings/{setting_id}
  • DELETE: /wp-json/coupons/v1/settings/{setting_id}

Was this helpful?

  1. coupons/v1

Settings

The admin settings API allows you to do the following:

  • fetch setting sections

  • fetch a section's list of fields

  • read, update and delete setting options for ACFW.

GET: /wp-json/coupons/v1/settings/sections

Fetch all sections of ACFW settings.

Requirements:

  • Logged-in user

  • user role with manage_woocommerce user capability

Method

Endpoint

GET

/wp-json/coupons/v1/settings/sections

Request Headers

Required

Type

Description

​section

​false

​string

Slug of the current section.

When filled, it will preload the section's fields.

Get all sections

GET: http://example.com/wp-json/coupons/v1/settings/sections

Preload fields for a specified section

GET: http://example.com/wp-json/coupons/v1/settings/sections

Custom Headers JSON
{
    "section": "bogo_deals_section"
}

Status: 200 OK

Get all setting sections.

[
  {
    "id": "general_section",
    "title": "General",
    "fields": [],
    "show": true,
    "module": false
  },
  {
    "id": "bogo_deals_section",
    "title": "BOGO Deals",
    "fields": [],
    "show": true,
    "module": "acfw_bogo_deals_module"
  },
  {
    "id": "scheduler_section",
    "title": "Scheduler",
    "fields": [],
    "show": true,
    "module": "acfw_scheduler_module"
  },
  {
    "id": "role_restrictions_section",
    "title": "Role Restrictions",
    "fields": [],
    "show": true,
    "module": "acfw_role_restrict_module"
  },
  {
    "id": "url_coupons_section",
    "title": "URL Coupons",
    "fields": [],
    "show": true,
    "module": "acfw_url_coupons_module"
  },
  {
    "id": "modules_section",
    "title": "Modules",
    "fields": [],
    "show": true,
    "module": false
  }
]

Get all setting sections and load fields for current section

[
  {
    "id": "general_section",
    "title": "General",
    "fields": [],
    "show": true,
    "module": false
  },
  {
    "id": "bogo_deals_section",
    "title": "BOGO Deals",
    "fields": [
      {
        "title": "BOGO Deals",
        "type": "title",
        "desc": "",
        "id": "acfw_bogo_deals_main_title",
        "value": false
      },
      ...fields
    ],
    "show": true,
    "module": "acfw_bogo_deals_module"
  },
  {
    "id": "scheduler_section",
    "title": "Scheduler",
    "fields": [],
    "show": true,
    "module": "acfw_scheduler_module"
  },
  {
    "id": "role_restrictions_section",
    "title": "Role Restrictions",
    "fields": [],
    "show": true,
    "module": "acfw_role_restrict_module"
  },
  {
    "id": "url_coupons_section",
    "title": "URL Coupons",
    "fields": [],
    "show": true,
    "module": "acfw_url_coupons_module"
  },
  {
    "id": "modules_section",
    "title": "Modules",
    "fields": [],
    "show": true,
    "module": false
  }
]

Status: 403 Forbidden

{
    "code": "rest_forbidden_context",
    "message": "Sorry, you are not allowed access to this endpoint.",
    "data": {
        "status": 401
    }
}

GET: /wp-json/coupons/v1/settings/sections/{section_id}

Get fields for a given setting section

Requirements:

  • Logged-in user

  • user role with manage_woocommerce user capability

Method

Endpoint

GET

/wp-json/coupons/v1/settings/sections/{section_id}

Get fields for general section

GET: http://example.com/wp-json/coupons/v1/settings/sections/general

Status: 200 OK

Get fields for general section

{
  "id": "general_section",
  "fields": [
    {
      "title": "General",
      "type": "title",
      "desc": "",
      "id": "acfw_general_main_title",
      "value": false
    },
    {
      "title": "Default coupon category",
      "type": "select",
      "desc_tip": "If a coupon is saved without specifying a category, give it this default category. This is useful when third-party tools create coupons or for coupons created via API.",
      "id": "acfw_default_coupon_category",
      "class": "wc-enhanced-select",
      "placeholder": "Select a category",
      "taxonomy": "shop_coupon_cat",
      "options": [
        {
          "key": 55,
          "label": "BOGO coupons"
        },
        {
          "key": 35,
          "label": "Redeemed"
        },
        {
          "key": 19,
          "label": "Uncategorized"
        },
        {
          "key": 54,
          "label": "User Owned"
        }
      ],
      "value": "19"
    }
  ]
}

Status: 403 Forbidden

{
    "code": "rest_forbidden_context",
    "message": "Sorry, you are not allowed access to this endpoint.",
    "data": {
        "status": 401
    }
}

GET: /wp-json/coupons/v1/settings/{setting_id}

Get the value of an ACFW setting option.

Method

Endpoint

GET

/wp-json/coupons/v1/settings/{setting_id}

Get the value of a BOGO Deals global notice message setting value.

GET: http://example.com/wp-json/coupons/v1settings/acfw_bogo_deals_notice_message

Status: 200 OK

Get the value of a BOGO Deals global notice message setting value.

{
  "id": "acfw_bogo_deals_notice_message",
  "value": "Your current cart is eligible to redeem deals"
}

Status: 403 Forbidden

{
    "code": "rest_forbidden_context",
    "message": "Sorry, you are not allowed access to this endpoint.",
    "data": {
        "status": 401
    }
}

PUT: /wp-json/coupons/v1/settings/{setting_id}

Update value of an ACFW setting option.

Requirements:

  • Logged-in user

  • user role with manage_woocommerce user capability

Method

Endpoint

PUT

/wp-json/coupons/v1/settings/{setting_id}

Query Parameters

Required

Type

Description

value

true

mixed

Value to update

​type

​false

​string

​Format type of value.

Default as string

Update value of BOGO Deals: Global notice button text setting option.

PUT: http://example.com/wp-json/coupons/v1/settings/acfw_bogo_deals_notice_button_text

JSON Body:
{
    value: "View Deals", 
    type: "text"
}

Disable Sort Coupons in Cart module

PUT: http://example.com/wp-json/coupons/v1/settings/acfw_sort_coupons_module

JSON Body:
{
    value: "", 
    type: "module"
}

Status: 200 OK

Update value of BOGO Deals: Global notice button text setting option.

{
    "id":"acfw_bogo_deals_notice_button_text",
    "value":"View Deals"
}

Disable Sort Coupons in Cart module

{
    "id":"acfw_sort_coupons_module",
    "value":""
}

Update Spending over a threshold (breakpoints) setting

Status: 403 Forbidden

{
    "code": "rest_forbidden_context",
    "message": "Sorry, you are not allowed access to this endpoint.",
    "data": {
        "status": 401
    }
}

DELETE: /wp-json/coupons/v1/settings/{setting_id}

Update value of an ACFW setting option.

Requirements:

  • Logged-in user

  • user role with manage_woocommerce user capability

Method

Endpoint

DELETE

/wp-json/coupons/v1/settings/{setting_id}

Get value for BOGO Deals: Global notice button text setting option.

DELETE: http://example.com/wp-json/loyalty-program/v1/settings/acfw_bogo_deals_notice_button_text

Status: 200 OK

Delete Price to points earned ratio setting option.

{
    "updated": true,
    "previous": {
        "id": "acfw_bogo_deals_notice_button_text",
        "value": "View Deals"
    }
}

Status: 403 Forbidden

{
    "code": "rest_forbidden_context",
    "message": "Sorry, you are not allowed access to this endpoint.",
    "data": {
        "status": 401
    }
}

PreviousSearch Customers (Premium)Nextloyalty-program/v1

Last updated 3 years ago

Was this helpful?