Question: How do we add resources to favourites using REST API?
Answer: Use the following method to add the resources to Favorites.
Method: POST, URL: http://<host>:<port>/jasperserver[-pro]/rest_v2/favorites
The content type for this request is usually a JSON object that contains the list of resource URIs to be added to Favorites.
The Return values for this request is as below:
a) For Success: 201 Created - The request was successful.
b) For Failure: i) 400 Bad Request - Invalid request syntax.
ii) 403 Forbidden - When the logged-in user does not have permission to access the resource.
iii) 404 Not Found - When the resource specified in the request does not exist.
The following is an example of a sample payload.
1) {
"favorites":[
{
"uri":"/public/audit/datasources/AuditDataSource_1"
},
{
"uri":"/public/audit/datasources/AuditVirtualDataSource_1"
}
]
}
2) {
"favorites":[
{
"uri":"/public/audit/datasources/AuditDataSource_1"
},
{
"uri":"/public/audit/datasources/AuditVirtualDataSource_1"
}
]
}
If a user adds a resource to the Favorites and later an admin removes the user's access to resources, the entry stays in the jifavoriteresource table, but the user will not be able to view or remove the resources from the Favorites.
Note: Local resources cannot be added to Favorites.
Recommended Comments
There are no comments to display.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now