2
1
0

Hi,


I need to map GitHub user ID to Jira email address (and vice versa). I want to keep the mapping in an external service that provides a couple endpoints I can call via an https link. How do I make such a call in the exalate sync configuration scripts?


    CommentAdd your comment...

    1 answer

    1.  
      2
      1
      0

      Hi,

      We are looking into include a groovy HttpBuilder into the script context but at the moment, you can rely on the native groovy way (found on https://stackoverflow.com/questions/25692515/groovy-built-in-rest-http-client)


      // GET
      def get = new URL("https://httpbin.org/get").openConnection();
      def getRC = get.getResponseCode();
      println(getRC);
      if(getRC.equals(200)) {
          println(get.getInputStream().getText());
      }
      
      // POST
      def post = new URL("https://httpbin.org/post").openConnection();
      def message = '{"message":"this is a message"}'
      post.setRequestMethod("POST")
      post.setDoOutput(true)
      post.setRequestProperty("Content-Type", "application/json")
      post.getOutputStream().write(message.getBytes("UTF-8"));
      def postRC = post.getResponseCode();
      println(postRC);
      if(postRC.equals(200)) {
          println(post.getInputStream().getText());
      }
        CommentAdd your comment...