Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Using API to establish links between project and account

mattsalmon December 17, 2016

We're using JIRA Server (on premises) with Tempo Accounts and Tempo Timesheets. I'm using the Tempo REST API to extract data about work logs, projects and accounts, to feed into some custom reports. 

I cannot figure out how to discover which account a project is linked to, through the REST API'S

I've reviewed as much of the API documentation as I can find, and the closest I can find is an undocumented 'link' endpoint which some Answers mention. But when I tried this on our installation it couldn't be found. Please can someone confirm the exact URL for this endpoint? Is this the only way in the API to establish this relationship? I'd be happy if I can derive the account either at the project level or the issue level, but at the moment it's not clear to me how to do either?

2 answers

1 vote
Alex Suslin
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.
December 18, 2016

Hi, in my organization I use REST API (JIRA and Tempo) to assign projects to accounts

http://tempo.io/doc/accounts/api/rest/latest/

And this method: http://tempo.io/doc/accounts/api/rest/latest/#1614615400 works fine for me.

To discover which account the project is linked to I'm afraid you forced to get all links http://tempo.io/doc/accounts/api/rest/latest/#687977320 and on your side filter to ones you need.

 

Also, check this method: http://tempo.io/doc/accounts/api/rest/latest/#-672528754

It returns linked account by project id

 

Tempo API is not full and in beta stage.

0 votes
mattsalmon December 19, 2016

Hi @Alex Suslin - thanks so much for your response. The good news is that I've tried out the "/rest/tempo-accounts/1/link/picker/" endpoint that's mentioned in the last URL you sent me, and I'm getting a JSON response, however I'm struggling to understand and interpret that response.

I get a series of 19 objects back in the JSON, looking very much like this example below:

"id":0,
    "scopeType":"PROJECT",
    "scope":nnnnn,
    "accountId":0,
    "name":"An example project name",
    "linkType":"MANUAL",
    "defaultAccount":false

The only thing which varies between these objects is the 'scope' number and the 'name' string. It looks like these objects are a list of projects, but all of the accountId's are set to '0'. 

We have 7 Accounts defined in our system, of which 3 accounts have projects linked to them. There are 19 projects in our installation, so that would seem to confirm that the 19 JSON objects each represent a project, but I'm wondering if there's something more I need to do to ensure the Account Id's are populated in this API result?

Alex Suslin
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.
December 19, 2016

I agree, that's weird. However you have scopeType: Project and that mean that scope field (nnnnn in your example) contains id of a linked project.

And once you know project id you can call: 

http://tempo.io/doc/accounts/api/rest/latest/#-672528754

link/project/projectId/ just change projectId to your actual number project id and tempo will return you JSON with key and filled accountid

Alex Suslin
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.
December 19, 2016

probably there is a bug in tempo api, that's why accountId is always 0

mattsalmon December 19, 2016

I'm going to raise the AccountId = 0 thing as a bug with Tempo to see if it's a known issue. 

For the record, I'm using

  • JIRA version 7.1.9 Build 71013
  • Tempo Accounts 3.0.2
  • Tempo Timesheets 8.1.2
Alex Suslin
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.
December 19, 2016

yep, share please a link here I will vote for sure.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events