I want to create JIRA Change Request Ticket using a template.
I use JIRA API endpoint '/rest/api/2/issue'.
Below is the format of the data sent to JIRA.
Could anyone please help?
payload =
{ fields:
{ project: { key: "CRQ"},
customfield_15630: "SampleTemplateName",
summary: "Testing",
customfield_17679: "N.A" ,
customfield_14530:"2018-06-17T00:00:00.0+0000 ",
customfield_14531: "2018-06-17T00:00:00.0+0000 " } }
Here is the XML format of template I want to use in the issue ticket.
<item>
<title>[TMPL-167] NTW-8 [Network_Interface_configuration]</title>
<link>https://jiraqa.com/browse/TMPL-167</link>
<project id="15980" key="TMPL">Templates</project>
<description>Test</description>
<environment />
<key id="492895">TMPL-167</key>
<summary>NTW-8 [Network_Interface_configuration]</summary>
</item>
You are definitely lacking an issue type there. Here is an example of a proper issue creation using the REST API: https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/#api/2/issue-createIssue
Certain fields may be required or not depending on the project settings, but the project ID, the summary and the issue type are an absolute minimum.
Another thing is that you want to use a template in addition to this. Jira may simply not be able to automatically fetch the data from there, but if anything went wrong, you'd receive an error message anyway.
Could you describe in more detail what exactly do you need to do? It would be easier to come up with a solution ;)
Related
I am using Orbeon Forms as my form builder. I have modified "submit" button of the Form Builder to have custom behaviors, please look at my snippet below:
<property as="xs:string" name="oxf.fr.detail.process.send.*.*">
save()
then send(
uri = "{xxf:property('ORBEON_API')}/api/submitForm",
replace = "none",
method = "POST",
content = "xml",
content-type = "application/xml",
nonrelevant = "keep",
serialization = "application/xml"
)
then set-workflow-stage(name = "submitted")
then success-message("save-success")
Now, I am trying to get response of the send() action but can't really find a document describing how to do this in Orbeon CE. I plan to receive an URI from this "{xxf:property('ORBEON_API')}/api/submitForm" so that I can use it to navigate to another page.
I found it is possible to store an Action's response into dataset using Action Settings in PE edition. Sadly, I am using the CE one.
My question is that: Is there a way/workaround for storing and manipulating Action's response in Orbeon CE? Any suggestions are much appreciated 👍.
Thanks in advance.
Currently, actions in processes can't return data, and this is really what you would want here (see #1688). However, send() stores the XML returned by your service in an instance called fr-send-submission-response. So you can access that instance and extract information returned by your service. From XPath, you'd use the following to access that instance:
xxf:instance('fr-send-submission-response')
For instance, the following will make a GET request on a URL that returns breakfast menu, and show the first item on the menu as the success message. (Yes, I know, this isn't a very realistic example! But at least it is one that anyone should be be able to run locally.)
<property as="xs:string" name="oxf.fr.detail.process.submit.*.*">
send(
method = "GET",
uri = "https://www.w3schools.com/XML/simple.xml",
replace = "instance"
)
then success-message(
message = "First item on the menu: {xxf:instance('fr-send-submission-response')/food[1]/name}"
)
</property>
The success message will show like:
Has anyone successfully constructed the correct url to retrieve the file content from this endpoint?
All my attempts have resulted in a status 404.
The documentation is confusing in this link
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-edit-file
Below is the example it provides
GET /changes/{change-id}/edit/path%2fto%2ffile
this is data from gerrit.
{
"branch": "BR16516",
"change_id": "Ieb84eb99147fc39d3e117fe61eef8389d2f64611",
"change_number": "52490",
"change_revision": "2",
"file_name": "sql/BR16516-update-order-15102.sql",
"lines_inserted": 77,
"size_delta": 2041,
"status": "A"
}
I can't seem to provide a value for {change-id} and {'path%2fto%2ffile'} that gerrit recognises
The value I provided (see shown above) is the same value retrieved from /changes endpoint documented here
- https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-changes
This is the code example provided:
Retrieves content of a file from a change edit.
Request
GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/edit/foo HTTP/1.0
In this example, the filename is 'foo' however the {change-id} introduces myProject~master~ and I tried substituting this for the relevant values for my project but with no luck.
If there are other endpoints that will give me plain text from the file in the branch, that will be good too.
I managed to get the file content from this end point
GET /changes/{change-id}/revisions/{revision-id}/files/{file-id}/content
change_id is the id from the change record
revision-id is the revision id from the change record
the change record is from the query changes end point
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-changes
After trying a number of different sections, I figured I'd ask - would anyone know the name of the WORKFLOW section depicted on the screenshot below? The snippet below should give an idea of what I am trying to do.
<web-item key="my-project-item" name="My Title" section="stash.repository.settings.panel/repository-settings-section" weight="300" application="stash"> .... </web-item>
I think this is the information you are looking for:
Web Item: bitbucket.repository.settings.panel/repository-workflow-section
Web Panel: example-web-item.badge
Context Items: request, principal, repository, project
You can get this by appending ?web.items&web.panels&web.sections to the URL in Bitbucket Server.
After having gotten a site's login form from getSiteLoginForm, I'm attempting to add a site, but I'm receiving
{ :errorOccurred=>"true", :exceptionType=>"Exception Occurred", :referenceCode=>"_fa9ede97-1792-45ca-b147-005ec4002d33" }
The URL I'm POSTing to (in Rails) is:
https://consolidatedsdk.yodlee.com/yodsoap/srest/private-fairshare/v1.0/jsonsdk/SiteAccountManagement/addSiteAccount1
and this is the POST data:
cobSessionToken=REDACTED
userSessionToken=REDACTED
siteId=11671
credentialFields.enclosedType=com.yodlee.common.FieldInfoSingle
credentialFields[0][displayName]=User Name
credentialFields[0][fieldType.typeName]=TEXT
credentialFields[0][isEditable]=true
credentialFields[0][name]=LOGIN
credentialFields[0][value]=testuser
credentialFields[0][valueIdentifier]=LOGIN
credentialFields[0][valueMask]=LOGIN_FIELD
credentialFields[1][displayName]=Password
credentialFields[1][fieldType.typeName]=IF_PASSWORD
credentialFields[1][isEditable]=true
credentialFields[1][name]=PASSWORD
credentialFields[1][value]=testpass
credentialFields[1][valueIdentifier]=PASSWORD
credentialFields[1][valueMask]=LOGIN_FIELD
I've triple checked the parameters, and they seem to match up with the documentation.
Is there something I'm missing?
Looking at the documentation it looks like there's a mismatch in the format of your parameters.
For example, you have the field credentialFields[0][displayName], but in the documentation it's referred to as credentialFields[0].displayName. Is is possible that the API expects fields in this format?
If the API does expect fields in the credentialFields[0][displayName] then it would make sense for the credentialFields.enclosedType field to follow the same format. In that case it should be credentialFields[enclosedType].
I am trying to do a simple Salesforce-Asana integration. I have many functions working, but I am having trouble with adding a tag to a workspace. Since I can't find documentation on the addTag method, I'm sort of guessing at what is required.
If I post the following JSON to https://app.asana.com/api/1.0/workspaces/WORKSPACEID/tasks:
{"data":{"name":"MyTagName","notes":"Test Notes"}}
The tag gets created in Asana, but with blank notes and name fields. If I try to get a bit more fancy and post:
{"data":{"name":"MyTagName","notes":"Test Notes","followers":[{"id":"MY_USER_ID"}]}}
I receive:
{"errors":[{"message":"Invalid field: {\"data\":{\"name\":\"MyTagName\",\"notes\":\"Test Notes\",\"followers\":[{\"id\":\"MY_USER_ID\"}]}}"}]}
I'm thinking the backslashes may mean that my request is being modified by the post, though debug output shows a properly formatted json string before the post.
Sample Code:
JSONGenerator jsongen = JSON.createGenerator(false);
jsongen.writeStartObject();
jsongen.writeFieldName('data');
jsongen.writeStartObject();
jsongen.writeStringField('name', 'MyTagName');
jsongen.writeStringField('notes', 'Test Notes');
jsongen.writeFieldName('followers');
jsongen.writeStartArray();
jsongen.writeStartObject();
jsongen.writeStringField('id', 'MY_USER_ID');
jsongen.writeEndObject();
jsongen.writeEndArray();
jsongen.writeEndObject();
jsongen.writeEndObject();
String requestbody = jsongen.getAsString();
HttpRequest req = new HttpRequest();
req.setEndpoint('https://app.asana.com/api/1.0/workspaces/WORKSPACEID/tags');
req.setMethod('POST');
//===Auth header created here - working fine===
req.setBody(requestbody);
Http http = new Http();
HTTPResponse res = http.send(req);
return res.getBody();
Any help appreciated. I am inexperienced using JSON as well as the Asana API.
The problem was that I was posting to the wrong endpoint. Instead of workspaces/workspaceid/tags, I should have been using /tags and including workspaceid in the body of the request.
Aha, so you can add tags and even set followers despite the API not mentioning that you can or claiming that followers are read-only.
So to sum up for anyone else interested: POSTing to the endpoint https://app.asana.com/api/1.0/tags you can create a tag like this:
{ "data" : { "workspace": 1234567, "name" : "newtagname", "followers": [45678, 6789] } }
where 1234567 is your workspace ID and 45678 and 6789 are your new followers.
Since you posted this question, Asana's API and developer has introduced Tags. You documentation lays out the answer to your question pretty clearly:
https://asana.com/developers/api-reference/tags
I'm a bit confused by your question. Your ask "how to add a tag" but the first half of your question talks about adding a task. The problem with what you describe there is that you are trying to set a task's followers but the followers field is currently read-only according to Asana's API documentation. That is why you are getting an error. You can not set followers with the API right now.
The second part of your question - with the sample code - does look like you are trying to add a tag. However, right now the Asana API does not support this (at least according to the API documentation). You can update an existing tag but you can't add one.
So, to sum up: at this time the API does not allow you to add followers to a task or to create new tags.