get SLA information via jira rest API

ABC May 26, 2014

i want to develop a java application and i want to retrieve the SLA informations via Jira REST API or jira rest java client or jql or any way,can i do this?

i try to search the entire http://jiraServer/jira/rest/api/2/search informations of an issue and i get this information:

com.atlassian.servicedesk.internal.sla.model.SLAValue@******

but i don't understand it.

can it help me? and what it is mean?

can you me?

4 answers

0 votes
jinhe January 2, 2020

you can get sla information by java

SlaInformationService slaInformationService = ComponentAccessor.getOSGIComponentInstanceOfType(SlaInformationService.class);


SlaInformationQuery query = slaInformationService.newInfoQueryBuilder() .issue(issue.getId()) .pagedRequest(SimplePagedRequest.paged(0, 50)) .build();

ApplicationUser user = ComponentAccessor.getJiraAuthenticationContext.getLoggedInUser();

PagedResponse<SlaInformation> pagedResponse = slaInformationService.getInfo(user, query).getOrNull();

SlaInformationService.DurationFormatter formatter = slaInformationService.getDurationFormatter();
List<SlaInformation> list = pagedResponse.getResults();
0 votes
IshanL
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 26, 2016

Try this way,

 

CustomField cf = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_xxxx”);
String v = cf.getCustomFieldType().getStringFromSingularObject(cf.getValue(issue))
0 votes
IshanL
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 16, 2016
0 votes
Timothy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 27, 2014

Have you checked whether the Service Desk add on exposes its REST API?

ABC May 27, 2014

how can i do this?

Timothy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 27, 2014

Suggest an answer

Log in or Sign up to answer