Does the JIRA SOAP API allow me to link betwen two issues that are in different projects? I have looked online and not found a way to do this. The closest thing that I have seen is the createIssueWithParent method, which creates subissues (I want two issues to be linked, not subissues) and which requires the issues to be in the same project (also not what I want).
Does anyone know of a way to do this?
No easy way in SOAP but I've done this using the RESTful approach and JIRA 4.4, e.g.
#
# Add links to JIRA issues
#
# Matt Doar
# CustomWare
#
# usage: create_links.sh issue_id issue_key
# where the issue_id is the unique id for a JIRA issue, not it's issue key.
# You can see the issue id in the XML view of an issue.
# and issue_key is the other issue to be linked to.
USERNAME=admin
PASSWORD=secret
SERVER_URL="http://localhost:8080"
DASHBOARD_PAGE_URL=$SERVER_URL/secure/Dashboard.jspa
COOKIE_FILE_LOCATION=jiracoookie
# Get the authentication cookie
curl -u $USERNAME:$PASSWORD --cookie-jar $COOKIE_FILE_LOCATION -sS --output /dev/null $DASHBOARD_PAGE_URL
issueid=$1
issuekey=$2
#echo "Linking issue: $issueid and $issuekey"
curl --cookie $COOKIE_FILE_LOCATION --header "X-Atlassian-Token: no-check" -sS --output /dev/null -d "id=$issueid" -d "linkDesc=relates to" -d "linkKey=$issuekey" "$SERVER_URL/secure/LinkExistingIssue.jspa"
rm -f $COOKIE_FILE_LOCATION
I don't think that linking is possible via the SOAP API. I've done this using the XML-RPC API, with the createIssueLink function:
from com.atlassian.jira import ComponentManager
# get issue objects
authenticationContext = ComponentManager.getInstance().getJiraAuthenticationContext()
issueLinkManager = ComponentManager.getInstance().getIssueLinkManager()
# Link parent issue to subtask
issueLinkManager.createIssueLink(issue.getId(),otherIssue.getId(),10003,1,authenticationContext.getUser())
Related
Is there a possibility to download data from IBM Analytics Workspace report/query using REST API ?
I would like to download sych data directly to the program variable using PowerShell/C#.
I have been looking for the answer online for a while but I cannot find satisfying answer leaving alone some code examples.
I would be grateful to get some code examples or links to such.
Best regards.
Pipe Invoke-RestMethod to ConvertTo-Json and then pipe to Out-File. That's a typical workflow for interacting with APIs, if you want to download data to disk.
Presumably there's some authentication needed and presumably you have an API key. So your script would look something like
$Headers = #{
api_key = $MyApiKey
}
$Uri = 'https://cloud.ibm.com/some_service/some_resource_type'
$Result = Invoke-RestMethod $Uri -Headers $Headers
$Result | ConvertTo-Json | Out-File my_data.json
Without knowing what API you want to query, no-one can give you a more specific example.
A better way to submit a question would be "How can I download data with powershell from the Foo API - the docs for this endpoint are at ibm.com/api_docs/how_to_foo"
I wrote a curl example to use the rest api of "aws iot core" and confirmed that it was operating. However, in the authentication process in the c# http client, I do not know how to insert the following three authentication values.
I would appreciate it if I could get help.
Below is the curl phrase.
curl --tlsv1.2 --cacert AmazonRootCA1.txt \
--cert test_thing.cert.pem \
--key test_thing.private.key \
--request POST \
--data "test gogo" \
"https://[iot_url].iot.ap-northeast-2.amazonaws.com:8443/topics/topic_2?qos=1" \
I'm developing a internal app that creates the skeleton of a solution according to internal guidelines.
As a improvement, I would like to enable the user to automatically have the solution "formalized" on our DevOps, where he would clone and start coding right away, instead of the current download as ZIP.
In order to do that, i started looking at the azure devops docs, but could not figure out a way to create a repository via API...
How can I do that?
Here is a sample of code we use in a PowerShell script to create repos
$repoBody = #{
name = "YourRepoName"
} | ConvertTo-Json
Invoke-WebRequest -method Post -Headers #{Authorization = "Basic $encodedPat"} -body $repoBody -Uri $projUrl -ContentType "application/json" -UseBasicParsing
You have the Repositories - Create Rest API:
POST https://dev.azure.com/{organization}/{project}/_apis/git/repositories?api-version=5.0
Body:
{
"name": "NewRepository",
"project": {
"id": "6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c"
}
}
This is the API call you are looking for:
POST https://dev.azure.com/{organization}/{project}/_apis/git/repositories?api-version=5.0
Source: https://learn.microsoft.com/en-us/rest/api/azure/devops/git/repositories/create?view=azure-devops-rest-5.0
In addition, if you have the AZ modules loaded in powershell, you can simply execute
az repos create --name "MyNewRepoName" --org "https://dev.azure.com/OrganizationName/" --project "ProjectNameToCreateRepoIn"
To install AZ modules in powershell use command
Install-Module -Name Az -AllowClobber -Scope CurrentUser
With AZ modules installed execute this before creating repo
Set-AzContext -SubscriptionId "YourSubscriptionID
I want to use CURL to check if the server the REST API is hosted is UP or responding
I have a c#.NET REST API http://localhost:55223/api/Demo/PostData?
I want to check if the server that hosted REST api is reponding before i make a call to my REST service
I am using following way to check i wanted to know if it is the right way
There might be an issue with the url design here. Since, post data is always sent in the body and as a post request, whereas the URL and the request in the above example depicts a totally different scenario.
curl -XPOST -H "Content-type: application/json" -d 'Add body here or remove this text and -d flag' 'http://localhost:55223/api/Demo/Post'
This would totally suffice a correct request though you need to edit the -d flag within the command for your request.
script.sh
#!/bin/bash
CURL='/usr/bin/curl'
if CURL -XPOST -H "Content-type: application/json" -d 'Add body here or remove this text and -d flag' 'http://localhost:55223/api/Demo/PostData'
else
echo "Not Found"
fi
If you are trying to hit the API to test it, go through Postman to send out those requests.
I am trying to use the new Facebook Messenger Platform API to send image message using image file from application directory.
Facebook gives the example using cURL like below:
curl \
-F recipient='{"id":"USER_ID"}' \
-F message='{"attachment":{"type":"image", "payload":{}}}' \
-F filedata=#/tmp/testpng.png \
"https://graph.facebook.com/v2.6/me/messages?access_token=PAGE_ACCESS_TOKEN"
But I am trying to use the API with C#. For your information, I have successfully use the API if I use the file from an internet url.
I have tried to fill in the filedata property by using base64 string of the image file, but unsuccessful.
Kindly explain how does cURL works with the given file path especially image and create a POST request to the web server? And if possible, what options do I have to do it with C#?
The -F option is for form. This is equivalent to issuing a POST request with the Content-Type header of multipart/formdata and the request body containing all the key-value pairs listed with a proper boundary set. cURL will read the binary data and put the bytes in the correct boundary in the request. There are many examples online for C# to submit a multipart/formdata request. Look into HttpClient or WebClient file uploads and you'll find what you need.
I'll be away from a computer for a few days and submitting sample code from a mobile device isn't the easiest thing to do. If you need some sample code, let me know.