Get all the reports which have used a specific resource id of a domain topic in jasper - rest

I have created a topic using a Domain in my JasperReport Server. Now I need to get all the reports which have used that Domain or Topic by using REST API.
I have tried this REST call:
https://<host>/jasperserver-pro/rest_v2/resource/organizations/test/organizations/data/Reports?j_username=jasperadmin&j_password=jAspErAdmIn
It gives 200 OK. But no data, it only gives the login page source.
<title>TIBCO Jaspersoft: Login</title>
Can anyone tell me how how to get this from REST call?

First, your call to the API seems errorneous.
According to the docs the call to the repository service looks like this:
http://<host>:<port>/jasperserver[-pro]/rest_v2/resources?<parameters>
In your case this would be:
http://<host>/jasperserver-pro/rest_v2/resources?<parameters>
Sencond, since your call is different, you won't get any result. It is possible to search for a specific string:
http://<host>/jasperserver-pro/rest_v2/resources?q=Domain_Name
and / or a type:
http://<host>/jasperserver-pro/rest_v2/resources?q=Domain_Name&type=dataType
As far as I understand it, it is not possible to search which report use which resources, though.

Related

What is best practice to send single parameter name multiple times in HTTP GET Request (status=Saved&status=Published)?

This is total new module to be added in our application.
In Get Request, End user requires data on basis of status Saved as well as Published.
The designer suggest to send status like below:
posts?status=Saved&status=Published&_sort=date&_order=asc
The above URL does not appears extendable as if user require data on 5 statuses in future it will keep n adding status& . (I need to write Spring Boot request mapping accordingly)
Could anyone who worked extensively on Rest API more better way to fix this approach as i think Post Request is of no use here as user is getting the data?
Edit: Also i am not sure if using _ (underscore) is fine?
Send the statuses like below. I prefer to send one character status (S=saved, P=published) to controller as it is short and neat.
posts?status=S,P&_sort=date&_order=asc
and map statuses to a List in controller like below
#RequestParam List<String> status

Routing incoming request

I am trying to create a simple API using Go that performs certain operations depending on the data provided.
I was planning to provide JSON data to this API and get details from it for further use.
Since I was trying to provide JSON data I created the routing using gorilla/mux as below:
router.HandleFunc("/msa/dom/perform-factory-reset?json={jsonData}", CallGet)
log.Fatal(http.ListenAndServe(":8080", router))
But while trying to hit the endpoint http://localhost:8080/msa/dom/perform-factory-reset?json={"vrf":"ds","ip":"45","mac":"452","method":"gfd"} I am getting 404 page not found error.
Hence I tried to change the implementation such that new routing is done as:
router.HandleFunc("/msa/dom/perform-factory-reset/json={jsonData}", CallGet)
This works absolutely fine and I am able to perform desired tasks. Could someone tell me why this is happening?
Is the router gorilla/mux? If so, you cannot add query parameters to path like that. You have to:
router.Path("/msa/dom/perform-factory-reset").
Queries("json","{jsonData}").HandlerFunc(CallGet)
If it is some other router, then you still probably have to register path without the query parameters, and then get the query parameter values in the handler from the request.

How to filter REST API JSON result by passing params

I'm trying to consume JIRA 2 API and trying to get custom fields. I want to further filter by passing appropriate criteria in URI itself. Current query I'm using is something similar to this:
http://localhost:8522/jira522/rest/api/2/issue/createmeta?expand=projects.issuetypes.fields
The result I'm getting from above request is about 2000 lines.. How can I further filter to get only Custom_fields and also under custom fields I need to only the ones which are required?
I'm pretty new to REST API. Please guide me If anything is wrong... TIA. I spent a lot of time browsing but don't know what exactly I need to search for or where exactly I need to get started.
You can use another queryParam just like expand and add further filtering or pagination.
http://localhost:8522/jira522/rest/api/2/issue/createmeta?expand=projects.issuetypes.fields&limit=1000

Rest API - Getting one-off information for an object

Here is my example. I have a basic rest api for a Member. Simple CRUD. Project manager says "we need an endpoint that will return the remaining pension amount for that member.
I get this stuff a lot where they want a very specific piece of information about an object.I don't want to include this in the Read request as the calculation can be time consuming. So, how do I do this in a RESTful way??
You could create a new endpoint called Pension, which could have a RemainingAmount property (and probably a RemainingCurrencyIso one, too), and expose that through a link from the Member resource like so:
GET /api/member/{id}/pension
If this is a field of the user object, you could have a separate url param
?fields=RemainingAmount
In the absence of the fields param, you just return the full object.

Modify Rest POST request behavior with query String

I have a resource which basically represents a number. I have two possible updates for this number: Set the number to a specific value or add a value to it. Now I'm confused if I can use the query string part of the URL to specify the desired behavior.
Something like this:
/resource/{id}/?mode=add
/resource/{id}/?mode=set
Or is there an alternative way two represent to update strategies for a rest resource?
An Alternative would be to extend the request body with this information but this since strange, since the request data should contain the data and not "meta information" for the request itself - as far as I understand REST apis.
The project is an ordinary angularjs (client) and java (server) project.