Jasper Report with RestAPI - rest

I have a report on JasperServer(5.6) which accepts few parameters. I edit few settings on the Output Options tab and enter emails which i would like to sent to on Notifications tab. The report gets generated successfully and an email is sent out perfectly.
I wish to use the Rest API of JasperServer to pass on my input options and to schedule and email the report. I went through there documentation http://community.jaspersoft.com/documentation/jasperreports-server-web-services-guide/v56/rest-v2-report-services but couldn't understand how to use the rest api.
Here is the properties of my report on the jasper server
Can someone help me out how to schedule my report.

Maybe it's can help you: jasperserver rest java client.
This is a REST client for Jasperserver.

I guess, i have figured out the way to schedule a job on jasper server. Details can be found here
http://community.jaspersoft.com/documentation/tibco-jasperreports-server-web-services-guide/v62/scheduling-report
But as an example here it is (call it with PUT method)
http://localhost:8080/jasperserver/rest_v2/jobs
and in the body define the job structure
{
"id": 3819,
"version": 2,
"username": "jasperadmin",
"label": "publisher_123_report",
"description": "",
"creationDate": "2015-12-30T02:02:40.382+03:00",
"trigger": {
"simpleTrigger": {
"id": "1770",
"misfireInstruction": "0",
"startDate": "2015-12-20T00:00:00+11:00",
"startType": "2",
"timezone": "Australia/Victoria",
"version": "0",
"occurrenceCount": "1"
}
},
"source": {
"reportUnitURI": "/Reports/Prod/test_automated_report_v14",
"parameters": {
"parameterValues": {
"PublisherId" : "20",
"MonthEnd" : "2015-02-01",
"MonthStart" : "2015-03-20",
"email" : "admin#admin.com",
"CountryCode" : "560"
}
}
},
"baseOutputFilename": "publisher_124_automated_report",
"outputLocale": "",
"mailNotification": {
"subject": "publisher monthly report" ,
"toAddresses": {
"address": ["address1To#add.com", "address2To#add.com"]
},
"ccAddresses": {
"address": ["address1cc#add.com", "address2cc#add.com"]
},
"bccAddresses": {
"address": ["address1bcc#add.com", "address2bcc#add.com"]
},
"includingStackTraceWhenJobFails" : false,
"resultSendType" : "SEND_EMBED",
"skipEmptyReports" : true,
"skipNotificationWhenJobFails" : false
},
"alert": {
"id": 0,
"version": -1,
"recipient": "OWNER_AND_ADMIN",
"toAddresses": {
"address": ["address1#add.com", "address2#add.com"]
},
"jobState": "FAIL_ONLY",
"messageText": "Success",
"messageTextWhenJobFails": "Failure",
"subject": "Notification Subject",
"includingStackTrace": true,
"includingReportJobInfo": true,
"jobState" : "ALL"
},
"outputTimeZone": "Australia/Melbourne",
"repositoryDestination": {
"id": 3817,
"version": 0,
"folderURI": "/Reports/Prod",
"sequentialFilenames": false,
"overwriteFiles": false,
"outputDescription": "",
"timestampPattern": null,
"saveToRepository": true,
"defaultReportOutputFolderURI": null,
"usingDefaultReportOutputFolderURI": false,
"outputLocalFolder": null,
"outputFTPInfo": {
"userName": null,
"password": null,
"folderPath": null,
"serverName": null
}
},
"outputFormats": {
"outputFormat": ["HTML"]
}
}
More options can be supplied while the creating job.

Related

Rules for real time database chat when using an external database

I am trying to secure my real time db. I have the following database structure:
{
"chats": {
"-NMhLlfSU-HYmjmXBzmH": {
"lastMessage": "",
"lastSender": "",
"seen": true,
"timestamp": 1674724449157
},
"members": {
"-NMhLlfSU-HYmjmXBzmH": {
"63cc6d925b51cb7a423393cc": true,
"63d240635b51cb7a423397d5": true
},
},
"users": {
"63cc6d925b51cb7a423393cc": {
"city": "Ituzaingó, Buenos Aires Province, Argentina",
"contacts": {
"63d240635b51cb7a423397d5": true
},
"name": "Joaquin varela",
"picture": "https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_1280.png"
},
"63d240635b51cb7a423397d5": {
"city": "Madrid",
"contacts": {
"63cc6d925b51cb7a423393cc": true
},
"name": "Test Test",
"picture": "https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_1280.png"
},
}
I am trying to implement the rules for it. The only problem is, my auth.uid is not the same as my user_id
Is there any way to secure my database? Maybe passing some user_id argument but I don't know how.
I hope you can help me. Thanks in advance!

Shopify REST API: Unable to add a new product variant with new option type getting error "Option values provided for 1 unknown option(s)"

when creating a product in Shopify via the REST API, adds a default option and variant like below
"options": [
{
"id": 9651869188247,
"product_id": 7644173172887,
"name": "Title",
"position": 1,
"values": [
"Default Title"
]
}
]
Variants:
{
"variants": [
{
"id": 42211487744151,
"product_id": 7644173172887,
"title": "Default Title",
"price": "1.00",
"sku": "",
"position": 1,
"inventory_policy": "deny",
"compare_at_price": null,
"fulfillment_service": "manual",
"inventory_management": "shopify",
"option1": "Default Title",
"option2": null,
"option3": null,
"created_at": "2022-06-17T17:18:24+05:30",
"updated_at": "2022-06-17T17:18:24+05:30",
"taxable": true,
"barcode": null,
"grams": 0,
"image_id": null,
"weight": 0.0,
"weight_unit": "kg",
"inventory_item_id": 44310083534999,
"inventory_quantity": 0,
"old_inventory_quantity": 0,
"requires_shipping": true,
"admin_graphql_api_id": "gid://shopify/ProductVariant/42211487744151"
}
]
}
I want to update the existing Option and Variants of a product to show "Color" & "Size" as options and variants of them. For that I tried the Shopify Rest API but that still is raising the below error
request model:
{
"variant": {
"product_id": 7644173172887,
"option1": "red",
"option2": "small",
"price": "1.0",
"title": "S"
}
}
response :
{
"errors": {
"base": [
"Option values provided for 1 unknown option(s)"
]
}
}
You are not specifing what endpoint you're using but I can see that you're specifing the Product Id and that should not be the case. If you need to add a new variant this is the request you should do
POST https://yourstore.myshopify.com/admin/api/2022-04/products/7644173172887/variants.json
{"variant":{"option1":"Red", "option2" :"Small", "title": "Red", "price":"1.00"}}
You will also need to update the current "Default Title" variant (I suggest, if possible to create the product with a valid variant).
PUT https://yourstore.myshopify.com/admin/api/2022-04/variants/42211487744151.json
{"variant":{"id":42211487744151,"option1":"Red","option2" : "S", "price":"99.00", "title" : "Red"}}

Whats wrong in my camunda fetchAndLock API request. Getting InvalidRequestException

I have 2 topics to receive data from API, those I can Successfully executed through code. Now I'm trying to execute through rest api using postman tool. now i'm getting InvalidRequestException. Before attempting request I fetched the external tasks using camunda get external-task api and my topics showing there.Later I tried to use /external-task/fetchAndLock API to send input variables.
External tasks response is:
http://localhost:8080/engine-rest/external-task
[
{
"activityId": "Activity_0jokenq",
"activityInstanceId": "Activity_0jokenq:0623e6f2-4837-11ec-8c7e-02426d005d3a",
"errorMessage": null,
"executionId": "0623e6f1-4837-11ec-8c7e-02426d005d3a",
"id": "0623e6f3-4837-11ec-8c7e-02426d005d3a",
"lockExpirationTime": null,
"processDefinitionId": "Process_0qcjqnm:1:da2ae20a-4836-11ec-8c7e-02426d005d3a",
"processDefinitionKey": "Process_0qcjqnm",
"processDefinitionVersionTag": null,
"processInstanceId": "0623bfdb-4837-11ec-8c7e-02426d005d3a",
"retries": null,
"suspended": false,
"workerId": null,
"topicName": "yvalue",
"tenantId": null,
"priority": 0,
"businessKey": null
},
{
"activityId": "Activity_1xxpyet",
"activityInstanceId": "Activity_1xxpyet:0623e6f6-4837-11ec-8c7e-02426d005d3a",
"errorMessage": null,
"executionId": "0623e6f5-4837-11ec-8c7e-02426d005d3a",
"id": "0623e6f7-4837-11ec-8c7e-02426d005d3a",
"lockExpirationTime": null,
"processDefinitionId": "Process_0qcjqnm:1:da2ae20a-4836-11ec-8c7e-02426d005d3a",
"processDefinitionKey": "Process_0qcjqnm",
"processDefinitionVersionTag": null,
"processInstanceId": "0623bfdb-4837-11ec-8c7e-02426d005d3a",
"retries": null,
"suspended": false,
"workerId": null,
"topicName": "testingtopic",
"tenantId": null,
"priority": 0,
"businessKey": null
}
]
my request is:
POST http://localhost:8080/engine-rest/external-task/fetchAndLock
{
"workerId": 1,
"maxTasks": 100,
"topics": [
{
"topicName": "testingtopic",
"lockDuration": 100000,
"variables": {
"a": {
"value": 1,
"type": "long"
},
"b": {
"value": 2,
"type": "long"
},
"id": {
"value": 1,
"type": "long"
}
}
}
],
"asyncResponseTimeout": 5
}
my BPMN diagram is:
Sorry mistake was mine I mentioned wrongly in request body. I mentioned
"variables": {}
But it's a array of json "variables": []
I mentioned here just variable names "variables": ["a","b","id"]
Later I used POST /external-task/{id}/complete request to pass with values to complete the process

MS Graph API- End-point to read email messages with header information from outlook account

I am using the below endpoint to read mail messages from a given mail folders but I see the message does not contain header information.
end point- https://graph.microsoft.com/v1.0/me/mailFolders/{folderid}messages/?$orderby=sentDateTime
Response looks like-
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('55f7b855-44a8-46c2-908a-00ff4d54c46e')/mailFolders('AQMkAGYyOTI1Yzc5LTFlZjctNDlhYy1hMWQzLTA1MjY0ZmRkADBkZTAALgAAA--el_XftXZKt0YdPN_913sBAFL-3e9Uo9BKmUKAmISlmIAAAAIBCQAAAA%3D%3D')/messages",
"value": [
{
"#odata.etag": "W/\"CQAAABYAAABS/93vVKPQSplCgJiEpZiAAAAMRZRE\"",
"id": "AAMkAGYyOTI1Yzc5LTFlZjctNDlhYy1hMWQzLTA1MjY0ZmRkMGRlMABGAAAAAAD-3pfl37V2SrdGHTzfvdd7BwBS-93vVKPQSplCgJiEpZiAAAAAAAEJAABS-93vVKPQSplCgJiEpZiAAAAMTZWmAAA=",
"createdDateTime": "2021-08-02T12:47:39Z",
"lastModifiedDateTime": "2021-08-02T12:47:42Z",
"changeKey": "CQAAABYAAABS/93vVKPQSplCgJiEpZiAAAAMRZRE",
"categories": [],
"receivedDateTime": "2021-08-02T12:47:40Z",
"sentDateTime": "2021-08-02T12:47:39Z",
"hasAttachments": false,
"internetMessageId": "<MAZPR01MB5442E2218F9D377BD1D514E4E9EF9#MAZPR01MB5442.INDPRD01.PROD.OUTLOOK.COM>",
"subject": "rr",
"bodyPreview": "rr",
"importance": "normal",
"parentFolderId": "AQMkAGYyOTI1Yzc5LTFlZjctNDlhYy1hMWQzLTA1MjY0ZmRkADBkZTAALgAAA--el_XftXZKt0YdPN_913sBAFL-3e9Uo9BKmUKAmISlmIAAAAIBCQAAAA==",
"conversationId": "AAQkAGYyOTI1Yzc5LTFlZjctNDlhYy1hMWQzLTA1MjY0ZmRkMGRlMAAQAKmsc6svyzlHuJr_l4TQwX4=",
"conversationIndex": "AQHXh5yTqaxzqy/LOUe4mv6XhNDBfg==",
"isDeliveryReceiptRequested": false,
"isReadReceiptRequested": false,
"isRead": true,
"isDraft": false,
"webLink": "https://outlook.office365.com/owa/?ItemID=AAMkAGYyOTI1Yzc5LTFlZjctNDlhYy1hMWQzLTA1MjY0ZmRkMGRlMABGAAAAAAD%2F3pfl37V2SrdGHTzfvdd7BwBS%2F93vVKPQSplCgJiEpZiAAAAAAAEJAABS%2F93vVKPQSplCgJiEpZiAAAAMTZWmAAA%3D&exvsurl=1&viewmodel=ReadMessageItem",
"inferenceClassification": "focused",
"body": {
"contentType": "html",
"content": "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"><meta content=\"text/html; charset=iso-8859-1\"><style type=\"text/css\" style=\"display:none\"><!--p{margin-top:0;margin-bottom:0}--></style></head><body dir=\"ltr\"><div style=\"font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)\">rr<br></div></body></html>"
},
"sender": {
"emailAddress": {
"name": "some name",
"address": "some address"
}
},
"from": {
"emailAddress": {
"name": "some name",
"address": "some address"
}
},
"toRecipients": [
{
"emailAddress": {
"name": "some name",
"address": "some address"
}
}
],
"ccRecipients": [],
"bccRecipients": [],
"replyTo": [],
"flag": {
"flagStatus": "notFlagged"
}
}
]
}
Earlier we used java.mail API to do the same and used to get it like
javax.mail.Message message= ;
Enumeration headers = message.getAllHeaders();
Is there any way to achieve this using an MS graph API?
If you want the Internet Message headers then you need to include that in the Select Parameter as the Graph doesn't return it as a default property eg
https://graph.microsoft.com/v1.0/me/messages/?$select=internetMessageHeaders

Cannot use resultSelector while developing an Azure DevOps extension

I am working on a custom extension for Azure Devops which already contains a service endpoint:
"type": "ms.vss-endpoint.service-endpoint-type"
In addition, I would like to create a custom Release Artifact Source:
“type”: “ms.vss-releaseartifact.release-artifact-type”
Following this documentation, my current struggle is in filling the fields under the Artifact Source using an external API. I tried many patterns in the following ‘resultSelector’ and ‘resultTemplate’, but couldn’t hit one that worked for me.
In my example, I would like to take all the ‘uri’ values under ‘builds’ in the json response and present them in the ‘definition’ inputDescriptor of the Artifact Source. All my attempts resulted in an empty combo-box, even though I can see the request reaching the required API.
The json I would like to parse into the combo-box:
{
"builds": [
{
"uri": "/build1",
"lastStarted": "2018-11-07T13:12:42.547+0000"
},
{
"uri": "/build2",
"lastStarted": "2018-11-09T15:40:30.315+0000"
},
{
"uri": "/build3",
"lastStarted": "2018-11-12T17:46:24.805+0000"
}
],
"uri": "https://<server-address>/api/build"
}
Can you please help me create the Mustache pattern to retrieve the above "uri" values?
I tried:
$.builds[*].uri
which doesn't seem to work.
Here's some more information in case it helps.
Service endpoint's datasources:
"dataSources": [
{
"name": "TestConnection",
"endpointUrl": "{{endpoint.url}}/api/plugins",
"resourceUrl": "",
"resultSelector": "jsonpath:$.values[*]",
"headers": [],
"authenticationScheme": null
},
{
"name": "BuildNames",
"endpointUrl": "{{endpoint.url}}/api/build",
"resultSelector": "jsonpath:$.builds[*].uri"
},
{
"name": "BuildNumbers",
"endpointUrl": "{{endpoint.url}}/api/builds/{{definition}}",
"resultSelector": "jsonpath:$.buildsNumbers[*].uri"
}
]
Artifact source:
"inputDescriptors": [
{
"id": "connection",
"name": "Artifactory service",
"inputMode": "combo",
"isConfidential": false,
"hasDynamicValueInformation": true,
"validation": {
"isRequired": true,
"dataType": "string",
"maxLength": 300
}
},
{
"id": "definition",
"name": "definition",
"description": "Name of the build.",
"inputMode": "combo",
"isConfidential": false,
"dependencyInputIds": [
"connection"
],
"validation": {
"isRequired": true,
"dataType": "string",
"maxLength": 300
}
},
{
"id": "buildNumber",
"name": "Build Number",
"description": "Number of the build.",
"inputMode": "combo",
"isConfidential": false,
"dependencyInputIds": [
"connection"
],
"validation": {
"isRequired": true,
"dataType": "string",
"maxLength": 300
}
}
],
"dataSourceBindings": [
{
"target": "definition",
"dataSourceName": "BuildNames",
"resultTemplate": "{ Value : \"{{uri}}\", DisplayValue : \"{{uri}}\" }"
},
{
"target": "versions",
"dataSourceName": "BuildNumbers",
"resultTemplate": "{ Value : \"{{uri}}\", DisplayValue : \"{{uri}}\" }"
},
{
"target": "latestVersion",
"dataSourceName": "BuildNumbers",
"resultTemplate": "{ Value : \"{{uri}}\", DisplayValue : \"{{uri}}\" }"
},
{
"target": "artifactDetails",
"resultTemplate": "{ Name: \"{{version}}\", downloadUrl : \"{{endpoint.url}}\" }"
},
{
"target": "buildNumber",
"dataSourceName": "BuildNumbers",
"resultTemplate": "{ Value : \"{{uri}}\", DisplayValue : \"{{uri}}\" }"
}
]
}
Any help provided will be highly appreciated.
The working combination for this case is:
dataSources:
{
"name": "BuildNames",
"endpointUrl": "{{endpoint.url}}/api/build",
"resultSelector": "jsonpath:$.builds[*]"
}
dataSourceBindings:
{
"target": "definition",
"dataSourceName": "BuildNames",
"resultTemplate": "{ \"Value\" : \"{{{uri}}}\", \"DisplayValue\" : \"{{{uri}}}\" }"
}