I would like from this in the Response Body of my Request to get the request Number
[
{
"$id": "1",
"$type": "Op.Request, Op",
"RequestNumber": "2022.06145",
"WorkTitle": "Title",
"Status": null,
"StatusCode": "NEW",
"Substatus": null,
"PriorityCode": "MED",
"Priority": null,
"WorkflowManager": null,
"WorkflowManagerId": null,
"RequestDescription": null,
"CorporateBodyCode": "PUBL",
"CorporateBody": null,
This is my setting
json response body Image
Debug image
Do I Forgot something?
Expecting to get the value of my variable and getting Empty value
You need to change "Field to check" to Body
You shouldn't post code as images, for example personally I'm not willing to analyze your regex by looking at low resolution screenshot with shitty yellow highlighting.
JSON is not a regular language so using regular expressions for parsing it is not the best idea, have you considered using JSON Extractor instead?
Related
I have a Camunda flow, there are 2-3 user tasks in this flow. I want to see their history after completing these tasks. There are a couple of methods, but I just want to get both the label and the entered value with rest-api.
I can't get them directly with rest-api.
The following method returns variables with the processInstanceId.
List<HistoricVariableInstance> instances = historyService.createHistoricVariableInstanceQuery()
.processInstanceId(processIntanceId)
.list();
but I need to call another rest-api to get the labels. GET /process-definition/{id}/xml with this api.
Other topics have been opened for this, but it does not meet exactly what I want.
similar question
I think you are right, you need 2 steps. I would combine the following requests:
First get all User Tasks:
GET /history/task -see API Reference
From its result Array you need the id and the name (which is the label):
[{"id":"anId",
...
"name":"aName",
...
}]
Now you can get the variables for each UserTask, like
GET /history/variable-instance?taskIdIn=YourTaskId see API Reference
https://docs.camunda.org/manual/7.16/reference/rest/history/variable-instance/post-variable-instance-query/
returns the name (label) and the value of the process variables
[
{
"id": "someId",
"name": "someVariable",
"type": "Integer",
"variableType": "integer",
"value": 5,
"valueInfo": {},
"processDefinitionKey": "aProcessDefinitionKey",
"processDefinitionId": "aProcessDefinitionId",
"processInstanceId": "aProcInstId",
"executionId": "aExecutionId",
"activityInstanceId": "aActivityInstId",
"caseDefinitionKey": null,
"caseDefinitionId": null,
"caseInstanceId": null,
"caseExecutionId": null,
"taskId": null,
"tenantId": null,
"errorMessage": null,
"state": "CREATED",
"createTime":"2017-02-10T14:33:19.000+0200",
"removalTime": "2018-02-10T14:33:19.000+0200",
"rootProcessInstanceId": "aRootProcessInstanceId"
}
]
I want to use response assertion to match the response from server, here when I am getting responses it shows like {
"per_page": 6,
"total": 12,
"data": [
{
"last_name": "Lawson",
"id": 7,
"avatar": "https://reqres.in/img/faces/7-image.jpg",
"first_name": "Michael",
"email": "michael.lawson#reqres.in"
},
But in response assertion it showing like
Assertion failure message:Test failed: text expected to contain /{
"per_page": 6,
"total": 12,
"data": [
{
"last_name": "Lawson",
"id": 7,
"avatar": "https://reqres.in/img/faces/7-image.jpg",
"first_name": "Michael",
"email": "michael.lawson#reqres.in"
},
{
and therefor it gets failing even though its matching but due to addition / (slash), its getting failed.
JMeter doesn't "add" slashes anywhere, it's just a matter of visualization, you're getting your pattern surrounded with slashes as there is a mismatch, basically JMeter fails to find what you put in the "Patterns to test" in the application response
Demo:
See lines 472 and 480 in the ResponseAssertion source
So make sure that your response contains the pattern and be aware that every line brake or empty space matters so if your server returns non-formatted string and you're expecting a "pretty" one - the assertion will fail.
We cannot suggest the best option without seeing you actual response, however full-text comparing 2 JSON entities doesn't seem a good approach to me in terms of robustness and reliability, you might want to consider JSON Assertion or JSON JMESPath Assertion instead
I want to copy embedded images from an outlook email to my blob storage. I have a step to run a For Each over the email attachments (the embedded images are recognized as attachments). But the when I look at the raw input for the email message, the attachment[0].contentBytes is Null. And the error I get when trying to create the blob using setting the blob content to "Attachments Content" is:
"InvalidTemplate. Unable to process template language expressions in action 'Create_blob' inputs at line '1' and column '3316': 'The template language function 'base64ToBinary' expects its parameter to be a string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#base64ToBinary for usage details.'."
Here is the Raw Input to the "When new email arrives" step:
"Attachments": [
{
"#odata.type": "#Microsoft.OutlookServices.FileAttachment",
"Id": "12345",
"LastModifiedDateTime": "2020-11-22T07:38:19+00:00",
"Name": "footer.jpg",
"ContentType": "image/jpeg",
"Size": 13969,
"IsInline": false,
"ContentBytes": null
}
]
Any help with these steps is much appreciated. Thanks!
Please click Add new parameter and choose Include Attachments. select Yes for Include Attachments:
I have one REST endpoint which returns a response like this
[
{
"id": "dbfff519-e8f6-4db3-9e26-a4e9014dc360",
"code": "123456789012345678901234567890123456789012345678901234567890",
"name": "client-code-with-character-length-sixty",
},
{
"id": "a673fb54-3503-4996-ba9b-a4e9014dc3ea",
"code": "18MTH",
"name": "18 Month",
},
{
"id": "60b781e3-4515-40f5-81ee-a4e9014dc400",
"code": "2periods",
"name": "I Have 2 Periods",
}...
etc.
I would like to be able to retrieve the ID where, for example, the code="2periods" UI can retrieve using either ResponseAsxml (with xpath) or Response with JSONPath. If I use the former I have managed to get the following to nearly retrieve my ID
//Response[1]/e[code='2periods']/id
BUT this looks like this
<id>0bc4aa5f-f8ab-4efe-b788-a4e9014dc45f</id>
And I don't know how to remove the start and end tags, the id has to be just the GUID.
I can't work out how to do something similar in the JSONPath - I've only managed to get something like
$[3].id
to work, but the order of the entities is not guaranteed in the test environment.
For ResponseAsXml using the XPath to get only the id value without <id> tag just add /text() to your actual expression:
//Response[1]/e[code='2periods']/id/text()
If you want to do the same using Response property with JSONPath try with:
$..[?(#.['code']=='2periods')].id[0]
Hope it helps,
I am using Spring Data REST using a CRUD repository, some values should be optionally NULL, however if I try to set them to null, the fields in question get ignored. If I send non-NULL data it works as expected
Is there are a way to allow this functionality?
Here is a sample PUT request body
{
"name": "Ash Test",
"distance": null,
"paid": null,
"startDate": null,
"tags": [ ],
"position": 3,
"creator": true,
"memberId": 55
}
This appears to be a known issue at the time of this writing:
https://jira.springsource.org/browse/DATAREST-130
It affects both SDR 1.0.0.RELEASE and SDR 1.1.0.M1. I just tried it with 2.0.0.BUILD-SNAPSHOT and the nulls don't currently go through there either.