Using API to establish links between project and account

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

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.

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?

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

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

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

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

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published yesterday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

66 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you