SSRS Rest API report patch doesn't update parameters - rest

I have rdl files locally, and I want to use SSRS Rest API to update the reports in the report server (if there are any changes.)
I am using PATCH to send the request to the report server. Like this
BaseUrl: http://<report_server_ip>/reports/api/v2.0/reports(d0d2791e-b332-4d45-a233-579e86c1fc70)
Method: PATCH
Content Type: application/json
Body:
{
"Name":"My Report",
"Description": "",
"Path": "/Test/My Report",
"Type": "Report",
"Hidden": false,
"Content":"PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxSZXBvcnQgTXVzdFVuZGVyc3RhbmQ9ImRmIiB..."
}
For Content, I open the rdl file and read all bytes and convert it to Base64 string. Like this:
content=File.ReadAllBytes(path) //path is the local rdl file path
Convert.ToBase64String(ASCII.GetBytes(content))
If I open the rdl file in a text editor (Notepad++), I see that the report parameter XML node has changes but when I send the PATCH request, the report parameters in the report server are not updated.
Here is the link to the SSRS Rest API: https://app.swaggerhub.com/apis/microsoft-rs/SSRS/2.0#/Reports/UpdateReport

In order to update parameters using SSRS Rest API, you must pass HasParameters: true in the body.
If HasParameters is not set then the API will not update the parameters.

Related

How to know the structure (body) of rest api azure POST request?

i am new at rest api azure and i dont know how to get correct body template of policy.
For example i used :
GET https://dev.azure.com/organization/project/_apis/policy/types?api-version=7.0
and the response are types of policies which i can use but how do i know the construction of the request body? Like this one:
{
"isEnabled": true,
"isBlocking": false,
"type": {
"id": "fa4e907d-c16b-4a4c-9dfa-4906e5d171dd"
},
"settings": {
"minimumApproverCount": 4,
"creatorVoteCounts": false,
"scope": [
{
"repositoryId": "a957e751-90e5-4857-949d-518cf5763394",
"refName": "refs/heads/master",
"matchKind": "exact"
}
]
}
}
Where should I find those request body templates? :(
Resources: https://learn.microsoft.com/en-us/rest/api/azure/devops/policy/configurations/create?view=azure-devops-rest-5.1&tabs=HTTP
Usually, when you could list or get the repo policy correctly, you could use the parameter configuration part of the returning result as the request body in creating the policy with post method.
rest api to list the branch policy.
GET https://dev.azure.com/{organization}/{project}/_apis/policy/configurations?api-version=5.1
with optional parameter
GET https://dev.azure.com/{organization}/{project}/_apis/policy/configurations?scope={scope}&policyType={policyType}&api-version=5.1
You could check the templates below for different configurations in Policy template examples.
Examples
Approval count policy
Build policy
Example policy
Git case enforcement policy
Git maximum blob size policy
Merge strategy policy
Work item policy
If you still don't know how to compose the request body, you could also share your scenario.
i finally made it, it was very hard and i dont understand why Microsoft has so bad documentation.... i had to made it by sending randoms request and look at the elements how the names are... so bad so much time spend...

How to send dataset in Web Activity? ADF

I want to publish data into a Service Bus, from my Storage Account.
I already tried send a simple body and it works fine. But i dont know how should set a data set.
Web Activity Setting
When i run this activity into a pipeline, this send
{
"myMessage": "Sample",
"datasets": [{
"name": "MyDataset",
"properties": {
...
}
}],
"linkedServices": [{
"name": "MyStorageLinkedService1",
"properties": {
...
}
}]
}
and i want send data from the file in dataset. Anyone know how i should set web activity?
You can achieve that by using "Copy Activity".
Here is a quick demo that I made :
I used JsonPlaceHolder API , I want to modify the array and add a custom value by doing a PUT request.
check it out here : https://jsonplaceholder.typicode.com/guide/
please read carefully "Updating a resource"
Here is a Json that I want to modify , I added it as a Dataset in ADF.
The main idea is to set the Dataset as a source and the sink is a REST API method so we are sending the Dataset as an input to the POST request in Copy activity.
Copy activity:
Source:
Sink:
You can read more about it here:
https://learn.microsoft.com/en-us/azure/data-factory/connector-rest?tabs=data-factory#dataset-properties
Here is the output of the Copy Activity:

Is there a way to retrieve the generated HTML email body of a dynamic template via SendGrid API call?

We have a site where our agents enter in some data, and then that data is sent to a client, via a SendGrid dynamic template.
The email content includes a lot of calculations based on the data entered, so we want our agents to have the ability to preview the email and verify the content first before sending it to the client.
Is there a way to use the SendGrid API to send a request with our json object, but instead of sending the email to the client, receive the generated email body so that we can display it to the agent and let them review it first?
Answered my own question. API v3 has GET methods for Dynamic Transactional Templates and Template Versions.
API Call:
/templates/{template_id}/versions/{version_id}
using sendgrid-ruby:
sg = SendGrid::API.new(api_key: sendgrid_api_key)
sg.client.templates._(template_id).versions._(template_version_id).get
(Note: the template_version_id is the ID and not the Name of the template version)
The response body then includes a field called html_content which is the full rendered HTML of a dynamic template version with any handlebar templating.
You can make API call via postman as:
https://api.sendgrid.com/v3/templates/d-d44fdfsdfdsfd342342343
with Bearer token along with Sendgrid API key like:
Bearer SG.Fvsdfsdjfksdfsdfjsdkjfsdfksjdfsdfksjdfkjsdkfjsdf
The response is:
{
"id": "d-d55d081558a641b48a8a1145b4549fbe",
"name": "Bt_Payment_Reminder (Active)",
"generation": "dynamic",
"updated_at": "2021-12-21 07:35:12",
"versions": [
{
"id": "a95c3652-e49f-4608-a9dd-5aa4831c2dc3",
"user_id": 11702857,
"template_id": "d-d55d081558a641b48a8a1145b4549fbe",
"active": 1,
"name": "Bt_Payment_Reminder_Updated",
"html_content": "Hello {{firstName}}",
"plain_content": "Hello {{firstName}}",
"generate_plain_content": true,
"subject": "{{subject}}",
"updated_at": "2021-12-21 07:37:48",
"editor": "code",
"test_data": "{\n \"firstName\":\"Virendra\"}",
"thumbnail_url": "sdasdasdasdasdasdsd"
}
]
}

JMETER - 2.13 - Parametrize Post Body Data using CSV Data File

I am trying to do a performance test with a REST Webservice. I added a HTTP Request, Header Manager, HTTP Request defaults, View Results Tree, CSV data config file.
This is how i parametrized my Post Message
{ "groupList": [ {"group":"newgroup"} ], "user": "${user}",
"password": "test", "email": "test#go2group.com", "role": "USER", "ui": false}
This is my CSV Data Set Config
The Problem i face is "<EOF>" is getting added instead of the values.
POST http://cawin.go2group.com/ConnectAll/rest/useradmin/user
POST data:
{ "groupList": [ {"group":"newgroup"} ], "user": "<EOF>",
"password": "test", "email": "test#go2group.com", "role": "USER", "ui": false}
kindly excuse me for my ignorance.
The most common problems are:
Using incorrect relative path to CSV file
Using incorrect value of "Recycle on EOF" dropdown
Incorrect placement of CSV Data Set Config element (sampler out of its scope)
In the majority of cases the answer is in either jmeter.log file or in Debug Sampler / View Results Tree listener combination
See Using CSV DATA SET CONFIG for detailed end-to-end instructions. If you still experience problems please update your question with first few lines of CSV file and Test Plan screenshot showing CSV Data Set Config location and configuration.

REST Web Service API: upload/update report template

I want to store and deploy report template with my code.
With this one in mind running a report is a two step process:
upload or update existing report template jrxml (it does not have links to other resources like images)
run it with my data (this one is done)
The official documentation doesn't contain a minimal example for updating report template
What is raw request which uploads/updates report template xml via JasperReports Server REST API?
I tried this way
here is my raw request
here is response
here what I see in /var/lib/tomcat6/webapps/jasperserver/WEB-INF/logs/jasperserver.log
What am I doing wrong? What does 400 error: could not find the binary content for resource: /Reports/product_structures_workshops mean?
This works for Jasper 5.5+ (but does not for 5.1-, returns just 404 Not Found "Specified page not found" instead).
Uploading
POST http://your-host:port/jasperserver/rest_v2/resources/path/to/resource/
Content-Type: application.repository.reportUnit+json
{
"label": "Sample",
"jrxml": {
"jrxmlFile": {
"label": "MyJRXML",
"type":"jrxml",
// encode your file in Base64 and put here
"content": "PD94bWwg..."
}
}
}
Updating
PUT http://your-host:port/jasperserver/rest_v2/resources/path/to/resource/myReport/
Content-Type: application.repository.reportUnit+json
{
"label": "Sample",
"jrxml": {
"jrxmlFile": {
"label": "MyJRXML",
"type":"jrxml",
// encode your file in Base64 and put here
"content": "PD94bWwg..."
}
}
}
References:
https://community.jaspersoft.com/questions/822949/example-creating-report-resource-rest-v2
http://community.jaspersoft.com/sites/default/files/docs/jasperreports-server-web-services-guide.pdf
We ended up with writing proprietary local JAVA application with jasper libraries, which does same thing
It looks like this is doable in older jasper versions (> 5.2):
they simplified significally REST API (look for API v2)
https://community.jaspersoft.com/wiki/getting-started-rest-web-service-api
With the completion of the v2 REST API, Jaspersoft announces the
deprecation of the original REST API and the end-of-life of the SOAP
services