Hello Community,
I would like to connect to JIRA platform to extract all tickets for audit and control purposes: tickets open, tickets pending review, tickets closed, etc.
I try to connect to JIRA with Rest API
var
client: TRESTClient;
request: TRESTRequest;
signature: string;
Base64: TBase64Encoding;
Str1: String;
begin
client := TRESTClient.Create(nil);
try
client.BaseURL := 'https://****.atlassian.net:****';
request := TRESTRequest.Create(nil);
request.Client := client;
try
request.Method := rmGet;
request.Resource := '/rest/servicedeskapi/request/*****/comment';
signature := 'username:password';
Base64 := TBase64Encoding.Create(0);
signature := 'Basic ' + Base64.Encode(signature);
request.Params.AddItem('Authorization', signature, TRESTRequestParameterKind.pkHTTPHEADER, [poDoNotEncode]);
request.Execute;
Unfortunatly, i get an error in return :
Any idea how to solve this ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I also tried to use ApiToken to connect but the result is the same
signature := 'email:' + ApiToken;
request.Params.AddItem('user', signature, TRESTRequestParameterKind.pkHTTPHEADER, [poDoNotEncode]);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @David KLIMAS - Through which tool are you trying to connect Jira via API ? If you need to download all the tickets why don't you download them in excel through filter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
With Delphi. There is some processing to be done, Excel would require manuel actions and add additional steps which I prefer to avoid
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There has been change in Atlassian's authentication policy for cloud products - https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-basic-auth-and-cookie-based-auth/?_ga=2.139254321.363208783.1557187081-1066642471.1556199146
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have tried this :
signature := 'username:password';
signature := 'Basic ' + Base64.Encode(signature);
and this
signature := 'username:api_token';
I did not Base64 encode the second option. I have to try. I did understand that the "username:password" is not used any more ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No the basic authentication using username and password is not used anymore. Please refer the article shared.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
need to change to user:PAT.
this is working for me:
client := TRESTClient.Create(nil);
client.Accept := 'application/json';
client.BaseURL := JHost;
request := TRESTRequest.Create(nil);
request.Client := client;
request.Method := rmGet;
request.Resource := '/rest/api/2/search?jql=assignee%20in%20(currentUser())%20AND%20status%20not%20in%20(Done)&fields=key,description,summary,parent,issuetype';
signature := 'myuser:'+ PAT;
Base64 := TBase64Encoding.Create(0);
signature := 'Basic ' + Base64.Encode(signature);
request.Params.AddItem('Authorization', signature, TRESTRequestParameterKind.pkHTTPHEADER, [poDoNotEncode]);
try
request.Execute;
finally
end;
str1:= request.Response.Headers.Text;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi all,
I will use this topic also to discuss issue with html 404 error.
I want to export/update my Jira Task
Within the GUI i am using this URL:
request.Resource := '/jira/secure/RapidBoard.jspa?rapidView=5207&projectKey=TEST';
signature := 'sometestuser:PAT_test_token';
request.Params.AddItem('user', signature, TRESTRequestParameterKind.pkHTTPHEADER, [poDoNotEncode]);
Also I am wondering about no error with not existing username at first.
Can I use GUI URL for request.Resource parameter?
Is the signature syntax correct for PAT authenification?
thanks for help in advance
Andreas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi all,
for me it's working now with:
client.BaseURL := 'https://myjiraserver.com';
request.Resource := '/jira/rest/api/2/issue/ISSUENAME-7571';
signature := 'Bearer <PAT>';
request.Params.AddItem('Authorization', signature, TRESTRequestParameterKind.pkHTTPHEADER, [poDoNotEncode]);
Regards
Andreas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.