BranchJavascriptResourceVersionList_Load_Query
#
Description#
This function is used to pull the JavaScript Resources for a specific branch.
Request Body Parameters#
Parameter |
Type | Description |
---|---|---|
count |
Number | Count is used to tell Miva how many JS Resources you want returned. |
offset |
Offset | Used in conjunction with the Count parameter for paginating results of large datasets. Default is 0 . |
sort |
String | Field to sort results by. Available sorting fields listed below. Use - prefix for a descending sort. |
filter |
Object | Array of Object containing search filters. See usage here |
branch_name branch_id |
String Number |
Branch Name set as primary Branch ID set as primary |
changeset_id |
Number | Optional Changeset ID. If omitted, the response will include the JS Resources from the head of the Branch. |
Supported Sort Columns#
One of these values would be passed in the sort request parameter to have the results sorted by that column. Value may be preceded by -
for a descending sort.
Sort | Description |
---|---|
id |
JS Resource ID |
On Demand Columns#
Column |
Description |
---|---|
source |
Source Code for the template |
settings |
JSON Array of Object defining the settings for each template and component assigned to the page. |
linkedpages |
Will output array of all pages resource is output on, if not a global resource |
linkedresources |
If JS is a Combined Resource, this ondemandcolumn will output an object of all JS Resources linked to this Combined Resource. |
Response Parameters#
Parameter |
Type | Description |
---|---|---|
total_count |
Number | total_count is the total number of records that match your search criteria. |
start_offset |
Number | Number of the starting offset number of branches to return. |
id |
Number | Template Version ID |
res_id |
Number | Resource ID |
user_id |
Number | Admin User ID of the user who created the template version. |
code |
String | Resource Code |
type |
String | One of: L = local file, C = Combined Resource, E = External File, I = Inline |
is_global |
Boolean | Is Global Resource - Output on all pages |
active |
Boolean | Active Flag |
file |
String | Relative path to file |
templ_id |
Number | Set for Inline resources which have a linked page template. All other resources will have a 0 |
attributes |
Array | Array of Name/Value Pairs |
settings |
Array | JSON Array of Object defining the settings for each template and component assigned to the page. |
linkedpages |
Array | Array of linked pages if the resource is not output globally |
source |
String | JS Resource Source |
linkedresources |
Array | Array of any linked resources if JS resource is a Combined Resource |
source_user_id |
Number | User ID who created the source template |
Example Request#
{
"Store_Code": "{{Store_Code}}",
"Miva_Request_Timestamp": "{{$timestamp}}",
"Function": "BranchJavaScriptResourceVersionList_Load_Query",
"Branch_Name": "Dev Branch",
"Count": 0,
"Offset": 0,
"Sort": "",
"Filter": [
{
"name": "ondemandcolumns",
"value": [
"source",
"settings",
"linkedpages",
"linkedresources"
]
}
]
}
Example Response#
{
"success": 1,
"data": {
"total_count": 12,
"start_offset": 0,
"data": [
{
"id": 44,
"res_id": 6,
"user_id": 0,
"code": "contact",
"type": "L",
"is_global": false,
"active": true,
"file": "b05/themes/00000001/shadows/extensions/contact/contact.js",
"templ_id": 0,
"attributes": [],
"linkedpages": [
{
"id": 38,
"secure": false,
"code": "CTUS",
"name": "Contact Us",
"title": "",
"ui_id": 152
}
],
"source": "(function () {\n\t'use strict';\n\n\tconst contactForm = document.querySelector('[data-hook=\"contact-form\"]');\n\n\tif (contactForm) {\n\t\tlet contactFormAction = contactForm.getAttribute('data-action');...",
"source_user_id": 0
}
]
}
}