Newbie question: how to call jira api from connect-express module

Reading the docs:

Making API requests

When communicating server-to-server with the Atlassian host product your app uses a JWT token to access protected resources including most of the REST APIs. When you use the frameworks, this is handled for you.

that’s cool, but where do I find the documentation or an example how to talk back to Jira Cloud.
I’m trying to create a workflow post function to update some fields in an issue.

Any help would be appreciated.

Solved it already.
I got confused by the request package and addon.httpclient.

using httpclient works the way I want it.
example:

var httpClient = addon.httpClient(req);

      httpClient.get({
            "headers": {
                "Content-Type": "application/json",
                "Accept": "application/json"
            },
            "url": "/rest/atlassian-connect/latest/addons/" + addon.key
        },
        function(err, response, body) {
            if (err) { 
              console.log(response.statusCode + ": " + err);
              res.send("Error: " + response.statusCode + ": " + err);
            }
            else {
                console.log(response.statusCode, body);
                res.send(body);
            }
        }
      );
1 Like