Using REST API in Java I am trying to update QC ALM. I am getting value in html format when I am trying to extract comment section for any Defect. So, if I want to add any comment, do I need to pass as HTML content with the previous comment or is there any other way?
I have tried by Just passing the comment but it removes all the previous comment and it does not show the person name who is updating the comment as it happens through GUI.
This would help someone who is new to HP REST API.
1. To find available API end-points,
GET /qcbin/rest/resouce-list
To get Users' full name
GET /qcbin/rest/domains/<domain_name>/projects/<project>/customization/users/<user_name>
To get defect comment, the below request fetches only Defect ID = 1 and outputs dev-comments field.
GET /qcbin/rest/domains/<domain_name>/projects/<project_name>/defects?query={id[1]}&fields=dev-comments
Sample JSON payload,
PUT /qcbin/rest/domains/<domain_name>/projects/<project>/defects/1
{
"Fields": [{
"Name": "dev-comments",
"values": [{
"value": "<html><body><span style=\"font-size:14px\">USER FULL NAME <USER_ID>, 2016-06-29:</span></font></b>\n<font color=\"#767676\" style=\"font-family:'hpsimplified-regular' , sans-serif\"><span style=\"font-size:14px\"> </span></font>Comment 1 \n</div> \n</body></html>"
},
{
"value": "<html><body><span style=\"font-size:14px\">USER FULL NAME <USER_ID>, 2016-06-29:</span></font></b>\n<font color=\"#767676\" style=\"font-family:'hpsimplified-regular' , sans-serif\"><span style=\"font-size:14px\"> </span></font>Comment 2 \n</div> \n</body></html>"
}]
}]
}
Related
I have a JSON which has an attribute with its List type. Can someone help me on how to read the value in Apache Velocity template? Following is an example of JSON. The challenge is to read the list of University from JSON and iterate through it.
{
"StudentName":"XYZ",
"List<Univesity>": [
{
"Name": "NYU",
"City": "NY",
"Country":"US",
} ]
}
The solution is dependent upon the JSON library you use, but for many of them, the following code should work:
#set( $universities = $document.get('List<University>') )
#foreach( $university in $universities )
... do something ...
#end
The main point to note here is that you can call any Java method on the object you get.
Also, if the security uberspector is not present, for debugging purposes you can display the Java class name of any object in the context, for instance: $document.class.name should display, in your case, something like com.fasterxml.jackson.databind.node.ObjectNode.
I am trying to get the description of group using getGroup API of AWS Cognito. I want to have the description of group in my JSON object, but it is not fetching the detail. Can someone help me with that?
Please look at documentation of AWS HERE.
As You can see response contains description of group.
{
"Group": {
"CreationDate": number,
"Description": "string",
"GroupName": "string",
"LastModifiedDate": number,
"Precedence": number,
"RoleArn": "string",
"UserPoolId": "string"
}
}
Please show us Your code, maybe we can find problem there.
I have ElasticSearch data offers with the following structure:
{
{
"id": "123",
"tariffId": "15477",
"tariffFamilyId": "555",
"characteristics": "xxx"
},
{
"id": "124",
"tariffId": "15478",
"tariffFamilyId": "777",
"characteristics": "yyy"
},
{
"id": "351",
"tariffId": "25271",
"tariffFamilyId": "555",
"characteristics": "zzz"
}
}
I need to find all offers with tariffFamilyId of a certain tariffId. As an initial argument, I know only tariffId and do not know tariffFamilyId (I need to detect it). Normally it means the two separate requests to Elastic Search should be made:
first request - find tariffFamilyId by tariffId.
second request - find offers with that tariffFamilyId.
For example for tariffId=15477, we get tariffFamilyId=555. So for this family, there will be two offers with id 123 and 351.
The question - is it possible to somehow make only one request to Elastic search, not two?
P.S. This is for Java implementation.
I need to append a new comment to an already existing comment in JIRA using its comment ID in Java. Is it possible to do this?
You can try to get the existing comment and update it?
1. GET /rest/api/2/issue/{issue}/comment/{id}
then update
2. POST /rest/api/2/issue/{issue}/comment/{id}
Check notes here in Jira documentation.
Some fields cannot be updated this way (for example, comments).
Instead you must use explicit-verb updates (see below). You can tell
if a field cannot be implicitly set by the fact it doesn't have a SET
verb.
EDIT: Edits an element in a field that is an array. The element is
indexed/identified by the value itself (usually by id/name/key).
edit the text of a particular comment:
{ "update": { "comments": [{"edit": {"id": 10002, "body": "newbody"} } ] } }
[This is my first post, please excuse me if I'm doing something wrong! (also sorry for my bad English)]
I'm try to develop a Mapper/Plugin for elasticsearch (in Java) that analyze some specified fields of JSON and add another field with the result of the analysis before storing and indexing the data.
EG:
I start with this popular JSON:
{
"tweet" {
"user" : "kimchy",
"message" : "This is a tweet!",
"postDate" : "2009-11-15T14:12:12",
"priority" : 4,
"rank" : 12.3
}
}
And, before the indexing, I Want it like:
{
"tweet" {
"user" : "kimchy",
"message" : "This is a tweet!",
"postDate" : "2009-11-15T14:12:12",
"priority" : 4,
"rank" : 12.3
"IsKimchy" : "Yes"
}
}
Here I suppose to read the field "user" and if the user is Kimchy I create another field that contain "Yes".
how can I analyze a field (using java) like this before the indexing?
As I know I can copy the content of a field in an other using Copy_to, so I can work only on a field, maybe it can help?
I had finally found a solution for my problem, I'll post it here, hope to help someone else!
the best solution for me (in Terms of Speed and integration) was a Custom mapper!
I had use this demo code https://github.com/dadoonet/elasticsearch-mapper-demo to implement my mapper class that analyze the Json Faster than scripting and add a custom field in record!
Cheers!