Generation does not work
-
template input in request contains values that does not match the defined schema. Schema validation errors: template.scripts should be array". Nothing has changed
I don't see such template in your account. Do you send a request that contains scripts prop?
I see another error in your account
TypeError: The header content contains invalid characters at validateHeader (_http_outgoing.js:494:11) at
This one is caused by the templates' names. You have some characters there that cannot be part of the http response header and we send the template name there. We will fix this, but if you experience this error just change the template name.
The problem with credits is under investigation.
If you want to chat with me and solve problems faster, feel free to reach me on skype @pofider
-
I sent a request containing scripts = ''. Сorrected it, not for long it worked -
came a positive response. Now the error "credits used: NaN".
-
I am releasing fix for the NaN.
-
Would you be able to share or email me the scripts you are sending please?
-
{
"url": "https://prebook.jsreportonline.net/api/report",
"method": "POST",
"auth": {
"username": delete,
"password": delete,
},
"data": {
"template": {
"content": "\n\t\t\t{{xlsxRemove "xl/worksheets/sheet1.xml" "worksheet.sheetData" 0}}\n\t\t\t{{#xlsxAdd "xl/worksheets/sheet1.xml" "worksheet.sheetData"}}<sheetData />{{/xlsxAdd}}\n\t\t\t\n\t\t\t{{#xlsxMerge "xl/workbook.xml" "workbook.sheets[0].sheet[0]"}}\n <sheet name="{{{reportName}}}"/>\n\t\t\t{{/xlsxMerge}}\n\t\t\t{{#if dayDiff}}\n\t\t\t\t{{#xlsxAdd "xl/worksheets/sheet1.xml" "worksheet.sheetData[0].row"}}\n\t\t\t\t\t<row r="{{#getNumPlus 1}}{{/getNumPlus}}"><c s="1" t="inlineStr"><is><t>{{{reportName}}} "{{cinema}}" с {{startDate}} по {{finishDate}}</t></is></c></row>\n\t\t\t\t{{/xlsxAdd}}\n\t\t\t{{else}}\n\t\t\t\t{{#xlsxAdd "xl/worksheets/sheet1.xml" "worksheet.sheetData[0].row"}}\n\t\t\t\t\t<row r="{{#getNumPlus 1}}{{/getNumPlus}}"><c s="1" t="inlineStr"><is><t>{{{reportName}}} "{{cinema}}" на {{startDate}}</t></is></c></row>\n\t\t\t\t{{/xlsxAdd}}\n\t\t\t{{/if}}\n\t\t\t{{#incNum 1}}{{/incNum}}\n\t\t\t\n\t\t\t{{xlsxRemove "xl/workbook.xml" "workbook.definedNames" 0}}\n\t\t\t\n\t\t\t{{xlsxRemove "xl/worksheets/sheet1.xml" "worksheet.cols" 0}}\n\t\t\t{{#xlsxAdd "xl/worksheets/sheet1.xml" "worksheet.cols"}}\n\t\t\t<cols>\n\t\t\t\t<col min="1" max="1" width="12" customWidth="1"/>\n\t\t\t\t<col min="2" max="2" width="8" customWidth="1"/>\n\t\t\t\t<col min="3" max="3" width="10" customWidth="1"/>\n\t\t\t\t<col min="4" max="4" width="40" customWidth="1"/>\n\t\t\t\t<col min="5" max="5" width="9" customWidth="1"/>\n\t\t\t\t<col min="6" max="6" width="18" customWidth="1"/>\n\t\t\t</cols>\n\t\t\t{{/xlsxAdd}}\n\t\t\t\n\t\t\t{{#unless dayDiff}}\n\t\t\t\t{{#xlsxAdd "xl/worksheets/sheet1.xml" "worksheet.sheetData[0].row"}}\n\t\t\t\t<row r="{{#getNumPlus 1}}{{/getNumPlus}}">\n\t\t\t\t\t<c s="3" t="inlineStr"><is><t>С</t></is></c>\n\t\t\t\t\t<c s="3" t="inlineStr"><is><t>До</t></is></c>\n\t\t\t\t\t<c s="3" t="inlineStr"><is><t>Пер.</t></is></c>\n\t\t\t\t\t<c s="4" t="inlineStr"><is><t>Фильм</t></is></c>\n\t\t\t\t\t<c s="4" t="inlineStr"><is><t>Формат</t></is></c>\n\t\t\t\t\t<c s="4" t="inlineStr"><is><t>Цена</t></is></c>\n\t\t\t\t</row>\n\t\t\t\t{{/xlsxAdd}}\n\t\t\t\t{{#incNum 1}}{{/incNum}}\n\t\t\t{{/unless}}\n\t\t\t\n\t\t\t{{#each halls as |hall|}}\n\t\t\t\t\n\t\t\t\t{{#if ../dayDiff}}\n\t\t\t\t\t{{#incNum 1}}{{/incNum}}\n\t\t\t\t\t{{#xlsxAdd "xl/worksheets/sheet1.xml" "worksheet.sheetData[0].row"}}\n\t\t\t\t\t<row r="{{#getNumPlus 1}}{{/getNumPlus}}">\n\t\t\t\t\t\t<c s="3" t="inlineStr"><is><t>С</t></is></c>\n\t\t\t\t\t\t<c s="3" t="inlineStr"><is><t>До</t></is></c>\n\t\t\t\t\t\t<c s="3" t="inlineStr"><is><t>Пер.</t></is></c>\n\t\t\t\t\t\t<c s="4" t="inlineStr"><is><t>Фильм</t></is></c>\n\t\t\t\t\t\t<c s="4" t="inlineStr"><is><t>Формат</t></is></c>\n\t\t\t\t\t\t<c s="4" t="inlineStr"><is><t>Цена</t></is></c>\n\t\t\t\t\t</row>\n\t\t\t\t\t{{/xlsxAdd}}\n\t\t\t\t\t{{#incNum 1}}{{/incNum}}\n\t\t\t\t{{/if}}\n\t\t\t\t\n\t\t\t\t{{#unless ../dayDiff}}\n\t\t\t\t\t{{#xlsxAdd "xl/worksheets/sheet1.xml" "worksheet.sheetData[0].row"}}\n\t\t\t\t\t\t<row r="{{#getNumPlus 1}}{{/getNumPlus}}">\n\t\t\t\t\t\t\t<c s="5"/>\n\t\t\t\t\t\t\t<c s="5"/>\n\t\t\t\t\t\t\t<c s="5"/>\n\t\t\t\t\t\t\t<c customHeight="1" ht="23" s="6" t="inlineStr"><is><t>{{hall.hallName}}</t></is></c>\n\t\t\t\t\t\t\t<c s="5"/>\n\t\t\t\t\t\t\t<c s="5"/>\n\t\t\t\t\t\t</row>\n\t\t\t\t\t{{/xlsxAdd}}\n\t\t\t\t\t{{#incNum 1}}{{/incNum}}\n\t\t\t\t{{/unless}}\n\t\t\t\t\n\t\t\t\t{{#each hallRows}}\n\t\t\t\t\t{{#if ../../dayDiff}}\n\t\t\t\t\t\t{{#xlsxAdd "xl/worksheets/sheet1.xml" "worksheet.sheetData[0].row"}}\n\t\t\t\t\t\t\t<row customHeight="1" ht="18" r="{{#getNumPlus 1}}{{/getNumPlus}}">\n\t\t\t\t\t\t\t\t<c s="5"/>\n\t\t\t\t\t\t\t\t<c s="5"/>\n\t\t\t\t\t\t\t\t<c s="5"/>\n\t\t\t\t\t\t\t\t<c t="inlineStr" s="6"><is><t>{{day}} - {{hall.hallName}}</t></is></c>\n\t\t\t\t\t\t\t\t<c s="5"/>\n\t\t\t\t\t\t\t\t<c s="5"/>\n\t\t\t\t\t\t\t</row>\n\t\t\t\t\t\t{{/xlsxAdd}}\n\t\t\t\t\t\t{{#incNum 1}}{{/incNum}}\n\t\t\t\t\t{{/if}}\n\t\t\t\t\t{{#each dayRows}}\n\t\t\t\t\t\t{{#xlsxAdd "xl/worksheets/sheet1.xml" "worksheet.sheetData[0].row"}}\n\t\t\t\t\t\t\t<row customHeight="1" ht="{{#height priceSchema 18}}{{/height}}" r="{{#getNumPlus 1}}{{/getNumPlus}}">\n\t\t\t\t\t\t\t\t<c s="7" t="inlineStr"><is><t>{{showStart}}</t></is></c>\n\t\t\t\t\t\t\t\t<c s="7" t="inlineStr"><is><t>{{showEnd}}</t></is></c>\n\t\t\t\t\t\t\t\t<c s="7" t="inlineStr"><is><t>{{publish}}{{breakTime}}</t></is></c>\n\t\t\t\t\t\t\t\t<c s="9" t="inlineStr"><is><t>{{eventName}}</t></is></c>\n\t\t\t\t\t\t\t\t<c s="9" t="inlineStr"><is><t>{{eventFormat}}</t></is></c>\n\t\t\t\t\t\t\t\t<c s="2" t="inlineStr"><is><t>{{#concatStr priceSchema pricePrices}}{{/concatStr}}</t></is></c>\n\t\t\t\t\t\t\t</row>\n\t\t\t\t\t\t{{/xlsxAdd}}\n\t\t\t\t\t\t{{#incNum 1}}{{/incNum}}\n\t\t\t\t\t{{/each}}\n\t\t\t\t{{/each}}\n\t\t\t\t\n\t\t\t{{/each}}\n\n\t\t\t{{#xlsxMerge "xl/workbook.xml" "workbook.calcPr[0]"}}\n\t\t\t <calcPr fullCalcOnLoad="1"/>\n\t\t\t{{/xlsxMerge}}\n\n\t\t\t{{{xlsxPrint}}}\n\t\t\t",
"engine": "handlebars",
"recipe": "xlsx",
"xlsxTemplate": {
"shortid": "BkJi1bMh-"
},
"helpers": "\n\t\t\t\tfunction concatStr(str1, str2) {\n\t\t\t\t return str1 ? str1 + '\n' + str2 : str2;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tfunction height(str, val) {\n\t\t\t\t return str ? val * 2 : val;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tnum = 0;\n\t\t\t\t\n\t\t\t\tfunction incNum(val) {\n\t\t\t\t num += val;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tfunction getNumPlus(val) {\n\t\t\t\t return num + val;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tfunction getNum() {\n\t\t\t\t return num;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tfunction nullNum() {\n\t\t\t\t num = 0;\n\t\t\t\t}\n\t\t\t",
"scripts": "",
"omitDataFromOutput": false
},
"data": {
"cinema": "Кинотеатр Родина",
"startDate": "06.09.18",
"finishDate": "06.09.18",
"dayDiff": false,
"created_at": "6 сентября 2018 г. в 12:48",
"halls": [],
"city": "Энгельс",
"reportName": "Репертуарный план"
}
},
"options": {
"debug": {
"logsToResponse": true,
"logsToResponseHeader": true
}
}
}
-
The key "scripts" were always empty string, now it is deleted.
-
I hope I understood you correctly.
-
Yes thank you. The problem with credits should be fixed now.
-
Can you validate on server that key "scripts" is not null or empty string (''), before throw error "template.scripts should be array"? We have a lot of troubles with update our clients.
-
The early input validation makes sense to avoid crashes later. Otherwise we would need to have such conditions everywhere.
I apologize for the issues.