일반 액션/웹 액션 실행
    • PDF

    일반 액션/웹 액션 실행

    • PDF

    Article Summary

    Classic/VPC 환경에서 이용 가능합니다 .

    다양한 런타임 환경에서 일반적인 액션(트리거)과 웹 액션의 실행 예제를 소개합니다. 각각의 실행 예제에 대한 비교를 통해 일반 액션(트리거)과 웹 액션을 좀 더 효과적으로 이해할 수 있습니다.

    Node.js

    Node.js를 이용한 실행 예제는 다음과 같습니다.

    • 일반 액션, 트리거
      // npm install axios
      
      const axios = require('axios');
       var config = {
        headers: {
          'Content-Type': 'application/json',
        }
      };
      
      axios.post(
          '{ActionURL}?blocking=true&result=true'
          , {}
          , config)
        .then(response => {
          console.log(response.data);
        })
        .catch(error => {
          console.log(error);
        });
      
    • 웹 액션
      // npm install axios
      
      const axios = require('axios');
       var config = {
        headers: {
          'Content-Type': 'application/json',
        }
      };
      
      axios.get('{ActionURL}?blocking=true&result=true', config)
        .then(response => {
          console.log(response.data);
        })
        .catch(error => {
          console.log(error);
        });
      

    Spring Code

    Spring Code를 이용하여 실행한 예제는 다음과 같습니다.

    • 일반 액션, 트리거
      Map<String, String> params = new HashMap<>();
      
      HttpHeaders header = new HttpHeaders();
      header.add(HttpHeaders.CONTENT_TYPE, "application/json");
      HttpEntity<Map> requestEntity = new HttpEntity<>(params, header);
      ResponseEntity<Map> response = restTemplate
          .exchange("{ActionURL}?blocking=true&result=true"
          , HttpMethod.POST, requestEntity, Map.class);
      
    • 웹 액션
      HttpHeaders header = new HttpHeaders();
      header.add(HttpHeaders.CONTENT_TYPE, "application/json");
      HttpEntity<Map> requestEntity = new HttpEntity<>(header);
      ResponseEntity<Map> response = restTemplate.exchange("{ActionURL}?blocking=true&result=true", HttpMethod.GET, requestEntity, Map.class);
      

    Go Code

    Go Code를 이용하여 실행한 예제는 다음과 같습니다.

    • 일반 액션, 트리거
      package main
      import (
          "fmt"
          "io/ioutil"
          "net/http"
          "bytes"
      )
      
      func main() {
          var params = []byte(`{}`)
          req, err := http.NewRequest("POST", "{ActionURL}?blocking=true&result=true", bytes.NewBuffer(params))
          if err != nil {
              panic(err)
          }
      
        req.Header.Add("Content-Type", "application/json")
      
          client := &http.Client{}
          resp, err := client.Do(req)
          if err != nil {
              panic(err)
          }
          defer resp.Body.Close()
      
          bytes, _ := ioutil.ReadAll(resp.Body)
          str := string(bytes)
          fmt.Println(str)
      }
      
    • 웹 액션
      package main
      import (
          "fmt"
          "io/ioutil"
          "net/http"
      )
      
      func main() {
          req, err := http.NewRequest("GET", "{ActionURL}?blocking=true&result=true", nil)
          if err != nil {
              panic(err)
          }
      
          req.Header.Add("Content-Type", "application/json")
      
          client := &http.Client{}
          resp, err := client.Do(req)
          if err != nil {
              panic(err)
          }
          defer resp.Body.Close()
      
          bytes, _ := ioutil.ReadAll(resp.Body)
          str := string(bytes)
          fmt.Println(str)
      }
      

    이 문서가 도움이 되었습니까?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.