Skip to content

Commit 77be08c

Browse files
committed
Update Postman collection with product_list
Bump to 2.8.2
1 parent ae96f5f commit 77be08c

File tree

3 files changed

+75
-29
lines changed

3 files changed

+75
-29
lines changed

changelog.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
*** WooCommerce API Manager PHP Library for Plugins and Themes Changelog ***
22

3-
2021.10.22 - version 2.8.2
3+
2022.12.19 - version 2.8.2
44
* Fix: Mispelled word in error message.
5+
* Tweak: Updated API endpoint query example Postman collection to include new product_list API endpoint.
56

67
2021.07.09 - version 2.8.1
78
* Fix: Warning: Trying to access array offset on value of type bool. PHP warning fixed by checking if the API Key string is not empty before using the string to access the api_key element in an array.

postman_api_query_example_collection.json

Lines changed: 57 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"info": {
33
"_postman_id": "15a2f398-c8a1-4fb9-9eae-4fbd2dc7bab7",
44
"name": "WC >= 2.0",
5-
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
5+
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
6+
"_exporter_id": "3311052"
67
},
78
"item": [
89
{
@@ -11,7 +12,7 @@
1112
"method": "POST",
1213
"header": [],
1314
"url": {
14-
"raw": "http://wc/?wc-api=wc-am-api&wc_am_action=activate&instance=p1uOusaNM5ub3&object=http://dev.toddlahman.com/&product_id=137890&version=1.0&api_key=9f9273c809979608220752449d55fec9fbe85c3e",
15+
"raw": "http://wc/?wc-api=wc-am-api&wc_am_action=activate&instance=p1uOusaNM5ub3&object=http://dev.wc.com&product_id=32960&version=1.0&api_key=b9dc373c7983cda3897c1502574b1bf929e02a53",
1516
"protocol": "http",
1617
"host": [
1718
"wc"
@@ -34,19 +35,19 @@
3435
},
3536
{
3637
"key": "object",
37-
"value": "http://dev.toddlahman.com/"
38+
"value": "http://dev.wc.com"
3839
},
3940
{
4041
"key": "product_id",
41-
"value": "137890"
42+
"value": "32960"
4243
},
4344
{
4445
"key": "version",
4546
"value": "1.0"
4647
},
4748
{
4849
"key": "api_key",
49-
"value": "9f9273c809979608220752449d55fec9fbe85c3e"
50+
"value": "b9dc373c7983cda3897c1502574b1bf929e02a53"
5051
}
5152
]
5253
}
@@ -59,7 +60,7 @@
5960
"method": "POST",
6061
"header": [],
6162
"url": {
62-
"raw": "http://wc/?wc-api=wc-am-api&wc_am_action=deactivate&instance=p1uOusaNM5ub3&product_id=137890&api_key=9f9273c809979608220752449d55fec9fbe85c3e",
63+
"raw": "http://wc/?wc-api=wc-am-api&wc_am_action=deactivate&instance=p1uOusaNM5ub3&product_id=32960&api_key=b9dc373c7983cda3897c1502574b1bf929e02a53",
6364
"protocol": "http",
6465
"host": [
6566
"wc"
@@ -82,11 +83,11 @@
8283
},
8384
{
8485
"key": "product_id",
85-
"value": "137890"
86+
"value": "32960"
8687
},
8788
{
8889
"key": "api_key",
89-
"value": "9f9273c809979608220752449d55fec9fbe85c3e"
90+
"value": "b9dc373c7983cda3897c1502574b1bf929e02a53"
9091
}
9192
]
9293
}
@@ -99,7 +100,7 @@
99100
"method": "POST",
100101
"header": [],
101102
"url": {
102-
"raw": "http://wc/?wc-api=wc-am-api&wc_am_action=status&instance=p1uOusaNM5ub3&product_id=137890&api_key=9f9273c809979608220752449d55fec9fbe85c3e",
103+
"raw": "http://wc/?wc-api=wc-am-api&wc_am_action=status&instance=p1uOusaNM5ub3&product_id=32960&api_key=b9dc373c7983cda3897c1502574b1bf929e02a53",
103104
"protocol": "http",
104105
"host": [
105106
"wc"
@@ -122,11 +123,47 @@
122123
},
123124
{
124125
"key": "product_id",
125-
"value": "137890"
126+
"value": "32960"
126127
},
127128
{
128129
"key": "api_key",
129-
"value": "9f9273c809979608220752449d55fec9fbe85c3e"
130+
"value": "b9dc373c7983cda3897c1502574b1bf929e02a53"
131+
}
132+
]
133+
}
134+
},
135+
"response": []
136+
},
137+
{
138+
"name": "product_list 2.4.6",
139+
"request": {
140+
"method": "POST",
141+
"header": [],
142+
"url": {
143+
"raw": "http://wc/?wc-api=wc-am-api&wc_am_action=product_list&instance=p1uOusaNM5ub3&api_key=b9dc373c7983cda3897c1502574b1bf929e02a53",
144+
"protocol": "http",
145+
"host": [
146+
"wc"
147+
],
148+
"path": [
149+
""
150+
],
151+
"query": [
152+
{
153+
"key": "wc-api",
154+
"value": "wc-am-api"
155+
},
156+
{
157+
"key": "wc_am_action",
158+
"value": "product_list"
159+
},
160+
{
161+
"key": "instance",
162+
"value": "p1uOusaNM5ub3"
163+
},
164+
{
165+
"key": "api_key",
166+
"value": "b9dc373c7983cda3897c1502574b1bf929e02a53"
130167
}
131168
]
132169
}
@@ -139,7 +176,7 @@
139176
"method": "POST",
140177
"header": [],
141178
"url": {
142-
"raw": "http://wc/?wc-api=wc-am-api&wc_am_action=information&instance=p1uOusaNM5ub3&product_id=137890&version=1.0&api_key=9f9273c809979608220752449d55fec9fbe85c3e&plugin_name=simple-comments/simple-comments.php",
179+
"raw": "http://wc/?wc-api=wc-am-api&wc_am_action=information&instance=p1uOusaNM5ub3&product_id=32960&version=1.0&api_key=b9dc373c7983cda3897c1502574b1bf929e02a53&plugin_name=search-engine-ping/search-engine-ping.php",
143180
"protocol": "http",
144181
"host": [
145182
"wc"
@@ -162,19 +199,19 @@
162199
},
163200
{
164201
"key": "product_id",
165-
"value": "137890"
202+
"value": "32960"
166203
},
167204
{
168205
"key": "version",
169206
"value": "1.0"
170207
},
171208
{
172209
"key": "api_key",
173-
"value": "9f9273c809979608220752449d55fec9fbe85c3e"
210+
"value": "b9dc373c7983cda3897c1502574b1bf929e02a53"
174211
},
175212
{
176213
"key": "plugin_name",
177-
"value": "simple-comments/simple-comments.php"
214+
"value": "search-engine-ping/search-engine-ping.php"
178215
}
179216
]
180217
}
@@ -187,7 +224,7 @@
187224
"method": "POST",
188225
"header": [],
189226
"url": {
190-
"raw": "http://wc/?wc-api=wc-am-api&wc_am_action=update&instance=p1uOusaNM5ub3&product_id=137890&version=1.0&api_key=9f9273c809979608220752449d55fec9fbe85c3e&plugin_name=simple-comments",
227+
"raw": "http://wc/?wc-api=wc-am-api&wc_am_action=update&instance=p1uOusaNM5ub3&product_id=32960&version=1.0&api_key=b9dc373c7983cda3897c1502574b1bf929e02a53&plugin_name=search-engine-ping",
191228
"protocol": "http",
192229
"host": [
193230
"wc"
@@ -210,23 +247,23 @@
210247
},
211248
{
212249
"key": "product_id",
213-
"value": "137890"
250+
"value": "32960"
214251
},
215252
{
216253
"key": "version",
217254
"value": "1.0"
218255
},
219256
{
220257
"key": "api_key",
221-
"value": "9f9273c809979608220752449d55fec9fbe85c3e"
258+
"value": "b9dc373c7983cda3897c1502574b1bf929e02a53"
222259
},
223260
{
224261
"key": "plugin_name",
225-
"value": "simple-comments"
262+
"value": "search-engine-ping"
226263
},
227264
{
228265
"key": "slug",
229-
"value": "api-manager-php-library",
266+
"value": "search-engine-ping",
230267
"disabled": true
231268
}
232269
]
@@ -239,7 +276,6 @@
239276
{
240277
"listen": "prerequest",
241278
"script": {
242-
"id": "abf60ea2-7527-488c-a97a-3f4eeb8b9fd7",
243279
"type": "text/javascript",
244280
"exec": [
245281
""
@@ -249,7 +285,6 @@
249285
{
250286
"listen": "test",
251287
"script": {
252-
"id": "37707542-3069-4c8a-8d71-26882d5b1616",
253288
"type": "text/javascript",
254289
"exec": [
255290
""

wc-api-manager-php-library.php

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
22

33
/**
4-
* Plugin Name: WooCommerce API Manager PHP Library for Plugins and Themes
4+
* Plugin Name: WooCommerce API Manager PHP Library for Plugins and Themes Example plugin
55
* Plugin URI: https://toddlahman.com/shop/woocommerce-api-manager-php-library-for-plugins-and-themes/
66
* Description: Drop the wc-am-client.php library into a plugin or theme, and use the example code below after line 26.
7-
* Version: 2.8.1
7+
* Version: 2.8.2
88
* Author: Todd Lahman LLC
99
* Author URI: https://www.toddlahman.com/
1010
* License: Copyright Todd Lahman LLC
@@ -54,7 +54,7 @@
5454
* If $product_id is empty, the customer can manually enter the product_id into a form field on the activation screen.
5555
*
5656
* @param string $file Must be __FILE__ from the root plugin file, or theme functions, file locations.
57-
* @param int $product_id Must match the Product ID number (integer) in the product.
57+
* @param int $product_id (Optional, can be an empty string) Must match the Product ID number (integer) in the product if set.
5858
* @param string $software_version This product's current software version.
5959
* @param string $plugin_or_theme 'plugin' or 'theme'
6060
* @param string $api_url The URL to the site that is running the API Manager. Example: https://www.toddlahman.com/ Must be the root URL.
@@ -68,9 +68,19 @@
6868
// Theme example.
6969
//$wcam_lib = new WC_AM_Client_2_8_2( __FILE__, 234, '1.0', 'theme', 'http://wc/', 'WooCommerce API Manager PHP Library for Plugins and Themes' );
7070

71-
// Second argument must be the Product ID number if used. If left empty the client will need to enter it in the activation form.
72-
// Plugin example. The $wcam_lib is optional, and must have a unique name if used to check if the API Key has been activated before allowing use of the plugin/theme.
73-
//$wcam_lib = new WC_AM_Client_2_8_2( __FILE__, 138828, '2.7.3', 'plugin', 'http://wc/', 'WooCommerce API Manager PHP Library for Plugins and Themes' );
71+
/*
72+
* Plugin example.
73+
*
74+
* Second argument must be the Product ID number if used. If left empty the client will need to enter it in the activation form.
75+
* The $wcam_lib is optional, and must have a unique name if used to check if the API Key has been activated before allowing use of the plugin/theme.
76+
* Remember if the $wcam_lib variable is set it will be globally visible.
77+
*
78+
* In the two examples below, one has the Product ID set, and the other does not, so it will be an empter string. If the Product ID is not set
79+
* the customer will see a form field when activating the API Key that requires the Product ID along with a form field for the API Key.
80+
* Setting the Product ID below will eliminate the required form field for the customer to enter the Product ID, so the customer will only
81+
* be required to enter the API Key. If you will offer the product as a variable product where the customer can switch to another product
82+
* with a different Product ID, then do not set the Product ID here.
83+
*/
7484

7585
//$wcam_lib = new WC_AM_Client_2_8_2( __FILE__, 32960, '1.2', 'plugin', 'http://wc/', 'WooCommerce API Manager PHP Library for Plugins and Themes' );
7686
$wcam_lib = new WC_AM_Client_2_8_2( __FILE__, '', '1.2', 'plugin', 'http://wc/', 'WooCommerce API Manager PHP Library for Plugins and Themes' );

0 commit comments

Comments
 (0)