Getting Session info via REST API

I'm building a web-app that relies on the JIRA/Agile REST API to get/put information into our JIRA instance (onDemand).

I'd like to add the web-app user as a watcher to my create issue use case, and found the session API:

https://eigeig.atlassian.net/rest/auth/1/session

to get the information I need. Though I'm not able to get it working in my app. Using the API in my browser, all works fine, though if I try this through javascript/jquery/json, I get no response:

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>jQuery.getJSON demo</title>
  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
</head>
<body>
 
<div id="jira"></div>

<script>
(function() {
  var jiraAPI = "https://eigeig.atlassian.net/rest/auth/1/session";
  $.getJSON( jiraAPI, {
    format: "json"
   }).done(function( data ) {
       $( "#jira" ).text( data );
    });

    alert( "done");

})();
</script>
 
</body>
</html>

I suspect I'm running into an authorization issue, but not sure where to turn.

Ideas/suggestions (code examples would work best!)

TIA.

-Peter

1 answer

This widget could not be displayed.
Jason Worley Atlassian Team Nov 17, 2013

Just throwing this out there in case you haven't come across our REST API documentation:

https://developer.atlassian.com/display/JIRADEV/JIRA+REST+APIs

https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API+Tutorials

Hope this helps!

Jason - thanks for the tip - though I'm up on the tutorials, my question is very specific to using the https://eigeig.atlassian.net/rest/auth/1/session API from Javascript.

I'm able to use other parts of the REST API (both JIRA and JIRA Agile) pretty comfortably (passing in credentials, etc. for server-side usage)...

I believe (though could use some confirmation) that this session API is getting information from the client-side.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

115 views 2 0
Join discussion

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