I am currently trying to run a report thanks to Jasper Rest API and get the output (PDF), the interessant part of the doc is here
So I tried this : http://localhost:8080/jasperserver/rest/report/reports/samples/report_mongodb_new_basic
Knowing that my report is in reports/samples and its Resource ID is : report_mongodb_new_basic
So I still tried to run it with nodejs here is my code :
(request is a nodejs module available here )
Login :
var request = require("request");
request.post({url: "http://localhost:8080/jasperserver/rest/login",
qs: {j_username: "jasperadmin", j_password: "jasperadmin"}},
function(err, res, body) {
if(err) {
return console.error(err);
}
After login, as the doc show I need to do a PUT request to run the report :
request.put("http://localhost:8080/jasperserver/rest
/report/reports/samples/report_mongodb_new_basic")
This isn't working of course, even when i directly go on this url with
Firefox, it say
"Report not found (uuid not found in session)"
The uuid should be created thanks to this PUT request
So what is the good syntax of the URL and the good syntax of a PUT request to get the uuid and after if possible the pdf with a get?
jonny provided a correct answer. But here is a simpler one, using the REST_v2 interface that allows you to run and get a report output in a single request:
request.get("http://localhost:8080/jasperserver/rest_v2/reports/samples/report_mongodb_new_basic.pdf")
This is described in section 3.2.1 of web services documentation.
Recently I have same problem.
After login and before running you PUT, you should run GET request on
http://localhost:8080/jasperserver/rest/report/reports/samples/report_mongodb_new_basic
answer body is resourceDescriptor
<resourceDescriptor>
...
</resourceDescriptor>
then you should run your PUT request with request body set to resourceDescriptor
you can add report parameters to report unit definition. In fact, I use XMLRemoteDatasource to fetch my data
so I add a parameter to report_unit
...
<parameter name="XML_URL" class="java.lang.String">
<![CDATA[http://$ENV{HTTP_HOST}/some_url]]>
</parameter>
</resourceDescriptor>
this helped me for Jasper Server 4.5 Community Edition
Example of a complete script for get a Report in Jasper, but in Ruby
http://www.redrails.com.br/2013/03/07/ruby-client-para-rest-api-do-jasper-report-server/
Related
I'm using nodejs and nightwatchjs to run my test scripts.
I need to devise a test script that will check that a certain piece of information is displayed in the header of a webpage.
Below I have highlighted the information that I need to extract.
Once I've extracted this info, I will then test that a certain value is contained within this 'Headers' information (gpi=UID for example).
Are there any specific nodejs modules that could extract this information?
I've read request package info, but couldn't find a way of extracting the info.
Any help would be greatly appreciated.
You can use the NightwatchJS API testing plugin so that you can then write a test to do expect against the headers
it('demo test async', async function({supertest}) {
await supertest
.request(`https://myUrl.com`)
.get('<insert the path you want to test here e.g. / >')
.expect(200)
.expect('Content-Type', /json/);
});
The plugin page has a lot more details on it and you can always ask in their discord
It looked like cookies is highlighted in your screenshot? If that is what you are after try this method off the browser object https://nightwatchjs.org/api/getCookie.html#apimethod-container
I am using Google Form API to create a sample project to create, update & get responses to a form.
I am using the following documentation for reference and understanding:
https://developers.google.com/forms/api/reference/rest/v1/forms.responses
It mentions that a single response body (using response ID) includes the respondent email, but each time I trigger the API, the respondent email is undefined and hence does not get returned in the response body.
What am I doing wrong?
Please note I am not using the Apps Script. I am using the API in a node.js project.
Thank you
I have 2 microservices based on SAP SDK 3.0 archetype binded by the same xsuaa service.From the first microservice A, I wanted to call the second microservice B by using rest template. It fails to call, as it is not able to authenticate. Can you find my approach is right?
Sharing the code below along with the error screenshot
Error:
<200,document.cookie="fragmentAfterLogin="+encodeURIComponent(location.hash)+";path=/";document.cookie="locationAfterLogin="+encodeURIComponent(location.href.split('#')[0].split(location.host)1)+";path=/";document.cookie="signature=pim93tQhbcWCYYAiFxYkwrHBY%2Fs%3D;path=/";location="https://xxxxx.hana.ondemand.com/oauth/authorize?response_type=code&client_id=sb-Ledify!t7251&redirect_uri=http%3A%2F%2Flocalhost%3A5000%2Flogin%2Fcallback",{x-request-id=[k8h8rf33], x-frame-options=[SAMEORIGIN], Cache-Control=[no-cache, no-store, must-revalidate], Content-Type=[text/html], Content-Security-Policy=[script-src 'self' 'unsafe-inline'], Date=[Wed, 01 Apr 2020 11:23:01 GMT], Connection=[keep-alive], Content-Length=[620]}>
Note : localhost:5000 is my local approuter port and it is configured to call the second microservice which I have tested it in browser
Updated:
I have updated with getToken() but I am getting the below error in my local approuter.
Error Response:
xsapp.json Route
{
"source": "/notif-mock/(.*)",
"authenticationType": "xsuaa",
"destination": "notif-mock",
"csrfProtection": true
}
FYI, I have used the local approuter setup as per this post Link here
In the following line, you are concatenating a String with DecodedJWT:
String encodedAuth = "Bearer " + getJWTTokenDetails();
But DecodedJWT does not implement a toString() method. You must use getToken() instead.
Hint: For easier support handling please copy/paste your code, because text in screenshot cannot efficiently be referenced.
Arun,
Thanks for providing all the additional details. I recommend updating to SDK Version 3.16.1 and testing if it solves your issue.
I do it because version 3.9.0 which you're using at the moment has an incomplete implementation of security scenarios invoked by XSUAA.
We fixed many issues related to the handling of XSUAA and JWT validation in release 3.15.1. Please, check release notes for details..
If even after update your issue persists, we'll have to see how we can reproduce it or get more logs data from you as a response only doesn't provide enough clue on where it fails.
Hope it helps!
We have many dozens of build pipelines and we want to pause and resume (re-enable) build pipelines from a simple webapp interface as we are making config changes frequently. Here is the MS doc explaining this API:
https://learn.microsoft.com/en-us/rest/api/azure/devops/build/builds/update%20build?view=azure-devops-rest-5.0#definitionqueuestatus
From this documentation, it appears I need to hit the REST API and change/toggle the DefinitionQueueStatus -- however, this documentation only shows a sample for a build specific operation, whereas I want to pause then re-enable the entire build pipeline. What is the proper way to make this call?
I'm using fetch - and I've tried many dozen formats in the call - the 'ourorg' and 'ourproject' are correct (we use this call structure for many other calls), but all fails for this call below. I grabbed the 'definitionID' from the URL I can visibly see when in the Azure devops portal on the specific build pipeline page, and I'm using it for the {buildID} as I don't know what else to put there. Any guidance to help here is appreciated - I don't need to use fetch btw - any working sample will help here:
fetch(https://dev.azure.com/our_org/our_projectname/_apis/build/builds/definitionId=1593?retry=true&api-version=5.0 {
method: 'PATCH ',
credentials: 'same-origin',
body: 'DefinitionQueueStatus: "Enabled"'
}).then(function(response) {
console.log(response);
})
It seems that the body is incorrect in your post. Here is sample about how to use POSTMAN to access Azure DevOps Services REST APIs.
Generate the PAT, and then record the token, it is important to use to authorization, please see this document.
Create a new request in POSTMAN, it is recommended to put the request in a collection for Azure DevOps Services REST API;
Select the authorization as Basic Auth, you can input the username as any value, and the password as the token which is generated in step1.
Basic Auth
Set the REST API which you want to use,and select the request method type(GET,POST,FETCH ....), here you use https://dev.azure.com/{organization}/{project}/_apis/build/builds/{buildId}?api-version=5.0.
In the Body tab, you can set the request body as raw in json format, and input the value as following:
{
"buildNumber":"#20190607.2",
"buildNumberRevision":1,
"definition":
{
"id":1,
"createdDate":null,
"queueStatus":"paused"
}
}
Everthing is ready now, you can send the request, if sccuess, you will get the response from the REST API.
In your post, the body content is incorrect, the Request Body should meet the format in the REST API document. The DefinitionQueueStatus is a type in definitions. In addition, if you send the request with parameter retry, you will get the message The request body must be empty when the retry parameter is specified..
I am trying to create an html object dynamically with the necessary header information depending on the query string in the link I provide to Facebook. I am hoping that Facebook open graph will call this html link as I provided. However it seems that query string info are not getting passed to my server. Do anyone know how to make this work or what is the more appropriate way to do this. BTW, I am writing my code in Node.js.
To get more info about Facebook open graph api, look here, https://developers.facebook.com/docs/beta/opengraph/actions/.
For example, the link I am trying to pass to Facebook is, "http://xxx-url.com/getFacebookObject?objectId=&description=first dynamic post", so I sent a request with the link as, "https://graph.facebook.com/me/app-name:action-name?object=http://xxx-url.com/getFacebookObject?objectId=&description=first dynamic post". However, when I check the log on the server, I don't see anything in the query string.
Instead of using the query string, you can embed the data in the URL:
http://some-domain.com/getFacebookObject/id/description
Then, depending on what node.js packages you're using, extract the data from the request:
// expess.js style
app.get("/getFacebookObject/:id/:description", function(req, res) {
var id = req.params.id,
desc = req.params.description;
// your code...
});
(See http://expressjs.com/guide.html.)
Sorry, Facebook will strip off all query string information from the URL when they launch your site in the iframe. If it was a page tab app, then you could add it to the app_data query string parameters which in turn gets passed to your iframe's page tab app via the app_data part of the signed_request parameter.