What is an API product? An API product is referred to as a an API resource, or more simply resource. The API Manager allows access to an API resource through an authentication process, which means clients must be logged in to access their resources, and to purchase API products. All API products are virtual, and can be sold as a service, software, or whatever the product represents in the virtual space. The product can be a WooCommerce Subscription, which is fully supported.
Simple and Variable products are core WooCommerce product types that become API Manager Subscriptions by selecting the API checkbox on the Product edit screen. WooCommerce Subscriptions uses product types labeled Simple Subscription and Variable Subscription.
A product can be of type Simple, Simple Subscription, Variable, Variable Subscription, and Grouped. When setting up a Grouped product, the parent product in the group will not have the option to make it an API product, but the products in the group will if they are Simple or Variable products, including WooCommerce Subscription products. External/Affiliate products are placeholder products that link to an external product, and therefore cannot be API products.
To make any of the above products an API product select the API checkbox, and save the changes. Once the API checkbox is checked, it cannot be unchecked, and the product cannot be deleted from the store. There are also Virtual and Downloadable checkboxes, neither of which are required, and only serve to hide or display those options on the product screen to setup the product as needed.
Existing products that have been purchased before the API Manager was installed will have Product Order API Keys created when the API checkbox is selected and the product is updated.
If the product is Downloadable there are several options.
- The first is to upload a file on the local server. If this file is a WordPress plugin/theme then it needs to be a .zip file. At the moment, there should only be one download file on the product, with any future uploads replacing the previous, because the API Manager will find the most recent upload for downloads and software updates. These URLs are secure, will be generated on demand, and will expire depending on your setting, but will exist no longer than 60 minutes.
- The second option is to use an Amazon S3 URL, which requires further setup for the API Manager to create the Amazon S3 secure URLs. These URLs are secure, will be generated on demand, and will expire depending on your setting, but will exist no longer than 60 minutes.
- The last option is to provide a remote URL to file in another location.
Download limits and download expiration will no longer be honored. As of version 2.0 there are only subscription time limits used to limit API access.
Flexible Product Types
↑ Back to topThe WooCommerce API Manager allows product creation based on your sales model, and the structure provided by WooCommerce. An API Resource (Product) can be sold as a simple/simple subscription product, or a variable/variable subscription product with variations. Each simple and variable variation can have a single number of activations, or unlimited activations, for purchase, or for variable product variations, each variation can have a different number of activations, including one variation that has unlimited activations.
API Access Expires
↑ Back to topThe API Access Expires option sets a time limit for an API Resource Subscription, which is the product purchased. If the value is left empty, the time limit is indefinite. A number (positive integer) sets a number of days to limit access to the API Resource, so 365 would be a limit of one year. After API access expires the product must be manually purchased again. There is no auto renewal after access expires, and currently no automated emails are sent to notify the customer access will be expiring.
The API Access Expires form field only displays on the Simple product API tab form, and on the variation API form for a Variable product, but not on the Variable product parent API tab form.
The API Access Expires form field will not be displayed on the Simple Subscription and Variable Subscription products created by the WooCommerce Subscription plugin, because those products will already have a subscription time limit set.
Simple/Simple Subscription
↑ Back to topThe following form fields are found on the Product > Product edit screen > API tab.
(Deprecated – Do Not Use) Software Title:
This field was used prior to API Manager version 2.0. The value cannot be updated from API tab form. This value will still work if used by client software prior to version 2.0. Going forward only use the Product ID. This field should be empty if the product was created after version 2.0, or for first-time installations of version 2.0.
Product ID:
This unique ID cannot be changed, or the client will no longer have access to the product data. The product ID matches the actual product ID.
Activation Limit:
(Default is one activation if left blank) The APIs will only allow this number of activations to access this API resource. Activation is accomplished through the authentication of an API Key. Unlimited activations must have a value set, such as 1000. Do not leave this field blank. All resources are limited. Allowing a truly unlimited number of activations would consume an unknown amount of resources, and could cripple the server performance. Setting a reasonable limit will prevent downtime.
Note:
If the Activation Limit is increased after the product has been purchased, all API resources for this product will have the Activation Limit raised to the new value. The API resources for this product will not have the Activation Limit lowered if it is decreased.
The remaining fields are specifically used for WordPress plugins/themes, however this data can be used with any client application.
Version:
The currently available software version in the store.
Page URL:
For WordPress plugins this is the plugin homepage. For WordPress themes, this is the View Version x.x.x Details page. For other software this can be whatever you want it to be.
Author:
The software author.
WP Version Required:
The version of WordPress required for the plugin/theme to run without errors. Not required for non WordPress software.
WP Version Tested Up To:
Highest version of WordPress software was tested on. Not required for non WordPress software.
Last Updated:
When the software was last updated.
Upgrade Notice:
A notice displayed when an update is available.
Unlimited Activations:
Sets a default number of activations to 100,000. If Unlimited Activations is selected, then Activation Limit is hidden. This number can be increased using the filter hook wc_api_manager_unlimited_activation_limit
. All resources are limited. Increasing this to a larger number than your Operating System can handle can cause expected resource limitation issues, so either keep the default, or choose something reasonable. Once this option is enabled, customers who already purchased this product will have their API Key activation limit increased to match the limit value that is set, but the update is only triggered when the customer data for the product is pulled from the database, such as when the customer views the My Account dashboard > API Key tab. This minimizes the resources needed to implement this feature for a product that exists on a lot of orders.
Activation Limit:
Sets the API Key activation limit for the product. If the number is set above 100,000, the set the product for Unlimited Activations. If Unlimited Activations is selected, then Activation Limit is hidden.
The remaining fields are docs linked to plugin “view details” tabs. All docs are optional except for the Changelog. Once a page/doc is selected, an Edit link appears. The docs that are displayed can be enabled/disabled on the settings screen.
Variable/Variable Subscription
↑ Back to topThere are several differences with the API tab on a Variable type product. Referer to the Simple product setup for a description of all other form fields.
- The activation field is absent, as it is displayed on each variation product.
- The Product ID displayed on the API tab is for the parent product only, and is not used in the client software.
- All other data entered in the parent product API tab is copied into the corresponding fields for each variation to make data entry easier across multiple variations.
When multiple pricing options are needed for the same product, a variable product is currently the only viable option.
Variable Product Variations
Once the number of variation products has been created, and the Variable product has been updated with the API tab on the parent product filled out, each variation product will have the same form fields populated, except for the Activation Limit. Creating variations allows different numbers of API Key activations to be sold per product, such as 1, 5, and 25 API Key activations using 3 variations each with 1, 5, and 25 set for the Activation Limit value respectively.
It is possible to set unique values in the variation form fields by checking the “Set API options for this variable product only.” checkbox. If all the product details, other than the number of API Key activations should be the same, don’t check the “Set API options for this variable product only.” checkbox. Below is what the form looks like when setting unique values for a variation, which has already been populated by the parent API tab form field values initially.
Attributes
To create a pull-down menu on the frontend product page a custom product attribute is needed. Below is an example of how to set this up with a Variable product that has three variations of the same product with different API Key activation limits.
Under the Variations tab a Default Form Value will need to be set as shown below.
The frontend product page will then display the different activation limit and pricing for each variation of the variable product as shown below.
Free Products
↑ Back to topIt is possible to create free products, just set the price to zero. It is also possible to give an existing customer a product for free by creating an order assigned to the customer, and adding the product for zero cost. To access the free product, free API Resource, customers will still be required to create, or have, an account as a login is required to maintain API endpoint security.