It was a problem with my json data... Its working fine now.
mhousey
@mhousey
Posts made by mhousey
-
RE: api/report 400 not found
-
api/report 400 not found
Sorry for another nubie question, but I cant seem to be able to call my jsreport from my web application. I must be missing something obvious. I go to the api tab under settings in the report studio and get the following:
http://localhost:5488/api/report
HEADERS:Content-Type: application/json
BODY:{"template":{"shortid":"By9NKNxzE"},"data":{"aProperty":"value"}}I call my post as follows
'''$.ajax({
url: 'http://localhost:5488/api/report', type: 'post', contentType: 'application/json', data: { "template": { "shortid": "By9NKNxzE" }, "data": { "orderID": orderID } }, success: function (data) { } });
'''
I am getting only a 400 Not found error In fiddler...What am I missing.
Thanks
-
API not being called by request in beforeRender
Hell - im a newbe so please forgive my ignorance, but following all the examples i am trying to get API data as follows:
var request = require('request'); function beforeRender(done){ console.log('hello'); request({ url:"http://127.0.0.1:8000/api/receipts/1", method: "POST", json:true, headers: {'User-Agent':'Super Agent/0.0.1','content-type': 'application/json','Content-Length': 92}, },function(err, response, body){ console.log(body); request.data = {posts:body}; console.log(request.data); done(); }) }
using the debug, i find that the script is being executed:
+0 Starting rendering request 26 (user: null) +7 Rendering template { name: index, recipe: chrome-pdf, engine: handlebars, preview: true } +13 Data item not defined for this template. +19 Resources not defined for this template. +31 Executing script indexScript +1241 hello +1264 Base url not specified, skipping its injection. +1268 Rendering engine handlebars +1853 Compiled template not found in the cache, compiling +1873 Executing recipe chrome-pdf +2271 Converting with chrome HeadlessChrome/72.0.3617.0 using dedicated-process strategy +2802 Running chrome with params {"printBackground":true,"margin":{}} +3344 Skipping storing report.
But my fiddler tells me the http request to http://127.0.0.1:8000/api/receipts/1 is never made for some reason...
I'm banging my head on this one