ดู URL ต่อไปนี้และผลลัพธ์ที่ระบุด้านล่างแต่ละ URL;
โทรหน้าแรก
https://www.yourdomain.com/?cmjspkjson_opt=10
ผลผลิต
{
"item": {
"id": "1",
"asset_id": "61",
"title": "Getting Started",
"alias": "getting-started",
"introtext": "It's easy",
"fulltext": "",
"state": "1",
"catid": "2",
"created": "2019-08-29 14:35:43",
"created_by": "581",
...
...
...
"pageclass_sfx"",
"pageclass_sfx": ""
}
Other Examples;
https://www.yourdomain.com/index.php?option=com_virtuemart&cmjspkjson_opt=10
https://www.yourdomain.com/index.php?option=com_virtuemart&view=category&id=3&cmjspkjson_opt=10
Get a specific category info;
https://www.yourdomain.com/index.php?option=com_virtuemart&view=category&id=3&cmjspkjson_opt=10
Filtering - Just get the required object from above url;
ตัวอย่างอื่น ๆ
https://www.yourdomain.com/index.php?option=com_virtuemart&view=category&id=3&cmjspkjson_opt=10&reqobj[]=category
index.php?ตัวเลือก =com_virtuemart
https://www.yourdomain.com/index.php?option=com_virtuemart&view=category&id=3&cmjspkjson_opt=10&reqobj[]=category.children
c) getting first element of array category.children
https://www.yourdomain.com/index.php?option=com_virtuemart&view=category&id=3&cmjspkjson_opt=10&reqobj[]=category.children.0
d) getting images of first element of array category.children
https://www.yourdomain.com/index.php?option=com_virtuemart&view=category&id=3&cmjspkjson_opt=10&reqobj[]=category.children.0.images
You get the idea? Right.
There are just two rules to remember;
1) Write any Virtuemart URL and append the following to the end
&cmjspkjson_opt=10
Hurray! you get the JSON data.
2) If you don't want to get that much data, you can just get the required objects by filtering. For filtering, you need to add the filter by adding the reqobj parameter to the url.
&reqobj[]=category.children
3) Further great thing is that you can add any number of filters to the url. The benefit is that you can get more than one required objects from one url with just one HTTP request. Efficient!
For example,
&reqobj[]=category.children&reqobj[]=category.children.0.images