I am currently attempting to draft a node script for automated report building by translating an older template format to a newer one. I am using Axios for API calls and have been successful in building my folders, templates and data, but I am having some encoding issues related to CSS asset creation. My goal is to take CSS in the form of a string and use the string to populate the asset files, which has been working in a similar way when I build the templates, folders and data from strings. For some reason, the empty content
string works when creating new assets, but attempting to populate the content
field with my string CSS during the POST call results in an encoding error that doesn't allow me to edit the asset within the JSReport UI (and shows up encoded incorrectly in my data
backend file when I check that). The code giving me problems is as follows:
const headerStyleConfig = {
method: "POST",
baseURL: 'http://localhost:5050/odata/assets',
timeout: 1000,
headers: {'Content-Type': 'application/json'},
data: {
"name":"headerFooter.css",
"content":"* {\nbox-sizing: border-box;\n}\n\n#background{\nposition:absolute;\nz-index:0;\nbackground:transparent;\ndisplay:block;\nmin-height:50%;\nmin-width:50%;\n}\n\n#bg-text\n{\nmargin-top: 450px;\nmargin-left: 130px;\ncolor:lightgrey;\nfont-size:120px;\ntransform:rotate(320deg);\n-webkit-transform:rotate(320deg);\n}\n\nhtml, body {\nmargin: 0px;\npadding: 0px;\nfont-family: \"Roboto\",Arial, serif;\nfont-size: 12px;\nbackground-color: #ffffff;\n}\n\n.main {\ndisplay: flex;\nflex-direction: column;\njustify-content: space-between;\nwidth: 100%;\nheight: 100%;\n}\n\n.header {\nwidth: 100%;\npadding-top: 0px;\n}\n\n.header-box {\nbackground: #2D3F4B;\ndisplay: flex;\njustify-content: space-between;\npadding: 25px 30px;\nheight: 90px;\nborder-bottom: 2px solid #000;\n}\n\n.header-logo {\npadding-top: 10px;\n}\n\n.header-title {\nmargin: 25px 0px 10px;\nfont-size: 22px;\nfont-weight: 300;\ntext-transform: uppercase;\ntext-align: right;\ncolor:#FFF;\n}\n\n.footer {\nwidth: 100%;\n}\n\n.footer-box {\nbackground: #2D3F4B;\ndisplay: flex;\njustify-content: space-between;\nheight: 60px;\nborder-top: 2px solid #000;\npadding: 10px 20px 0px 30px;\n}\n\n.footer-copy {\nfont-size: 14px;\nfont-weight: 400;\ncolor: #FFF;\n}\n",
"folder": {
"shortid":assetFolderID
}
}
}
Is there anything that I am missing from the configuration above, or some other detail that I am overlooking? I was unable to find any help elsewhere, and the Inspect --> Network "asset" headers provided me with options that I attempted unsuccessfully. Any help would be much appreciated, thanks!