---
sourceDocument: 호주 API 참조
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/ko-KR/api-reference

 Release :

    - australia

ft:locale :

    - ko-KR

ft:publication_title :

    - 호주 API 참조

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# GlideHTTPRequest - 전역

# GlideHTTPRequest - 전역 {#ariaid-title1}

* 릴리스 버전: Australia
* 
* 업데이트 날짜 2026년 03월 12일
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 소요 시간: 13분

GlideHTTPRequest API는 Glide HTTP 요청으로 공통 기능을 수행하는 유틸리티 메서드를 제공합니다.

전역 서버 측 스크립트에서 이 API를 사용할 수 있습니다. 이 클래스를 사용하려면 생성자를 사용하여 GlideHTTPRequest 객체를 인스턴스화합니다. 생성자에는 엔드포인트 URL이 입력 매개변수로 필요합니다.

## GlideHTTPRequest - addHeader(문자열 이름, 문자열 값) {#ariaid-title2}

HTTP 요청에 헤더를 추가합니다.
{#GlideHTTPRequest-addHeader__table_ib1_31z_cfb__entry__3}

| 이름 | 유형 | 설명 |
|-|-|-|
| 이름 | 문자열 | `수락` 또는 `컨텐츠-형식`과 같은 헤더 이름입니다. |
| 값 | 문자열 | `application/json`과 같은 헤더 값입니다. |
[표 1. 매개변수]

{#GlideHTTPRequest-addHeader__table_ib1_31z_cfb} {#GlideHTTPRequest-addHeader__table_jb1_31z_cfb__entry__2}

| 유형 | 설명 |
|-|-|
| 무효 |   |
[표 2. 반환]

{#GlideHTTPRequest-addHeader__table_jb1_31z_cfb}  
이 예에서는 요청 헤더 "Accept"를 추가하고 ServiceNow 인스턴스에서 JSON 또는 XML 응답을 구문 분석하여 인시던트 수를 반환합니다.

    var instance = 'dev12345';
    var username = 'admin';
    var password = 'yourpassword';

    // Instantiate request with ServiceNow API incidents table endpoint
    var request = new GlideHTTPRequest('https://'+instance+'.service-now.com/api/now/table/incident');

    // Add authentication data
    request.setBasicAuth(username, password);

    // Add the Accept header to get JSON response
    request.addHeader('Accept', 'application/json');

    // Execute the GET request
    var response = request.get();

    // Print the results: status code and number of records returned
    gs.print(response.getStatusCode());
    gs.print('(JSON) Incidents returned: ' + JSON.parse(response.getBody()).result.length);

    // Replace the Accept header to get XML response
    request.addHeader('Accept', 'application/xml');

    // Execute the GET request
    var response = request.get();

    // Print the results: status code and number of records returned
    gs.print(response.getStatusCode());
    gs.print('(XML) Incidents returned: ' + gs.xmlToJSON(response.getBody()).response.result.length);

출력

    200
    (JSON) Incidents returned: 66
    200
    (XML) Incidents returned: 66

## GlideHTTPRequest - addParameter(String name, String value) {#ariaid-title3}

HTTP 요청에 매개변수를 추가합니다.
{#GlideHTTPRequest-addParameter__table_zk5_4dz_cfb__entry__3}

| 이름 | 유형 | 설명 |
|-|-|-|
| 이름 | 문자열 | 추가할 매개변수입니다(예 sysparm_limit: ). |
| 값 | 문자열 | 매개변수의 값입니다. |
[표 3. 매개변수]

{#GlideHTTPRequest-addParameter__table_zk5_4dz_cfb} {#GlideHTTPRequest-addParameter__entry__11}

| 유형 | 설명 |
|-|-|
| 무효 |   |
[표 4. 반환]

이 예시에서는 REST 엔드포인트 호출에 매개변수를 sysparm_limit 추가하여 반환된 응답 수를 제한하는 방법을 보여줍니다.

    var instance = 'dev12345';
    var username = 'admin';
    var password = 'yourpassword';

    // Instantiate request with ServiceNow API incidents table endpoint
    var request = new GlideHTTPRequest('https://'+instance+'.service-now.com/api/now/table/incident');

    // Add authentication data
    request.setBasicAuth(username, password);

    // Add the 'sysparm_limit' parameter to limit the number of records returned
    request.addParameter('sysparm_limit', 1);

    // Execute the GET request
    var response = request.get();

    // Print the results: status code and number of records returned
    gs.print(response.getStatusCode());
    gs.print('Incidents returned: ' + JSON.parse(response.getBody()).result.length);

출력:

    200
    Incidents returned: 1

## GlideHTTPRequest - setBasicAuth(String userName, String password) {#ariaid-title4}

기본 인증을 위한 사용자 이름과 암호를 설정합니다.
{#GlideHTTPRequest-setBasicAuth__table_xtx_5qy_cfb__entry__3}

| 이름 | 유형 | 설명 |
|-|-|-|
| userName | 문자열 | 인증에 사용할 사용자 이름입니다. |
| 암호 | 문자열 | 인증에 사용할 사용자의 암호입니다. |
[표 5. 매개변수]

{#GlideHTTPRequest-setBasicAuth__table_xtx_5qy_cfb} {#GlideHTTPRequest-setBasicAuth__table_ytx_5qy_cfb__entry__2}

| 유형 | 설명 |
|-|-|
| 무효 |   |
[표 6. 반환]

{#GlideHTTPRequest-setBasicAuth__table_ytx_5qy_cfb}  
이 예시에서는 setBasicAuth() 메서드를 사용하여 연결된 REST 엔드포인트 호출에 대한 사용자 이름과 암호를 설정하는 방법을 보여줍니다.

    var instance = 'dev12345';
    var username = 'admin';
    var password = 'yourpassword';

    // Instantiate request with ServiceNow API incidents table endpoint
    var request = new GlideHTTPRequest('https://'+instance+'.service-now.com/api/now/table/incident');

    // Add authentication data
    request.setBasicAuth(username, password);

    // Add the Accept header to get JSON response
    request.addHeader('Accept', 'application/json');

    // Execute the GET request
    var response = request.get();

    // Print the results: status code and number of records returned
    gs.print(response.getStatusCode());
    gs.print('(JSON) Incidents returned: ' + JSON.parse(response.getBody()).result.length);

    // Replace the Accept header to get XML response
    request.addHeader('Accept', 'application/xml');

    // Execute the GET request
    var response = request.get();

    // Print the results: status code and number of records returned
    gs.print(response.getStatusCode());
    gs.print('(XML) Incidents returned: ' + gs.xmlToJSON(response.getBody()).response.result.length);

출력

    200
    (JSON) Incidents returned: 66
    200
    (XML) Incidents returned: 66

## GlideHTTPRequest - setContentType(문자열 유형) {#ariaid-title5}

HTTP 요청의 Content-Type 헤더를 지정된 값으로 설정합니다.
{#GlideHTTPRequest-setContentType__table_lhw_vdz_cfb__entry__3}

| 이름 | 유형 | 설명 |
|-|-|-|
| 유형 | 문자열 | 설정할 콘텐츠 유형(예: `application/json` 또는 `multipart/form-data)입니다.` Content-Type에 대한 자세한 내용은 다음 문서를 참조하십시오 <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type>. |
[표 7. 매개변수]

{#GlideHTTPRequest-setContentType__table_lhw_vdz_cfb} {#GlideHTTPRequest-setContentType__table_mhw_vdz_cfb__entry__2}

| 유형 | 설명 |
|-|-|
| 무효 |   |
[표 8. 반환]

{#GlideHTTPRequest-setContentType__table_mhw_vdz_cfb}  
이 예시에서는 setContentType() 메서드를 사용하여 REST 엔드포인트 호출에 대한 `Content-Type` 요청 헤더를 설정하는 방법을 보여줍니다.

    var instance = 'dev12345';
    var username = 'admin';
    var password = 'yourpassword';

    // Instantiate request with ServiceNow API incidents table endpoint
    var request = new GlideHTTPRequest('https://'+instance+'.service-now.com/api/now/table/incident');

    // Add authentication data
    request.setBasicAuth(username, password);

    // Set up incident record to post

    // Set the Content-Type of the POST
    request.setContentType('application/json');

    // Execute the POST request
    var response = request.post();

    // Print the results: status code and number of records returned
    gs.print(response.getStatusCode());

출력

    200

## GlideHTTPRequest - setFollowRedirect(부울 followRedirect) {#ariaid-title6}

REST 엔드포인트 호출에 대한 팔로우 리디렉션 옵션을 활성화하거나 비활성화합니다.
HTTP 리디렉션에 대한 자세한 내용은 다음 문서를 참조하십시오 <https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections>.
{#GlideHTTPRequest-setFollowRedirect__table_kzt_pwy_cfb__entry__3}

| 이름 | 유형 | 설명 |
|-|-|-|
| 팔로우리디렉션 | 부울 | 엔드포인트가 엔드포인트에서 반환한 URL 리디렉션을 따라야 하는지 여부를 나타내는 플래그입니다. 유효한 값은 다음과 같습니다. * true: 반환된 리디렉션을 따릅니다. * 아니오: 반환된 리디렉션을 무시합니다. 기본값: true |
[표 9. 매개변수]

{#GlideHTTPRequest-setFollowRedirect__table_kzt_pwy_cfb} {#GlideHTTPRequest-setFollowRedirect__table_lzt_pwy_cfb__entry__2}

| 유형 | 설명 |
|-|-|
| 무효 |   |
[표 10. 반환]

{#GlideHTTPRequest-setFollowRedirect__table_lzt_pwy_cfb}  
이 예제에서는 setFollowRedirect() 메서드를 사용하여 엔드포인트 호출에 대한 리디렉션을 끄는 방법을 보여줍니다.

    var instance = 'dev12345';
    var username = 'admin';
    var password = 'yourpassword';

    // Instantiate request with ServiceNow API incidents table endpoint
    var request = new GlideHTTPRequest('https://'+instance+'.service-now.com/api/now/table/incident');

    // Add authentication data
    request.setBasicAuth(username, password);

    // Add the Accept header to get JSON response
    request.addHeader('Accept', 'application/json');

    // Turn off follow redirect - default is on (true)
    request.setFollowRedirect(false);

    // Execute the GET request
    var response = request.get();

    // Print the results: status code and number of records returned
    gs.print(response.getStatusCode());

출력

    200

## GlideHTTPRequest - setHttpTimeout(int timeout) {#ariaid-title7}

HTTP 시간 제한 값을 밀리초 단위로 설정합니다.
{#GlideHTTPRequest-setHttpTimeout__table_rjp_1ly_cfb__entry__3}

| 이름 | 유형 | 설명 |
|-|-|-|
| 시간 제한 | 정수 | 설정할 시간 제한 값입니다. 단위: 밀리초 |
[표 11. 매개변수]

{#GlideHTTPRequest-setHttpTimeout__table_rjp_1ly_cfb} {#GlideHTTPRequest-setHttpTimeout__table_sjp_1ly_cfb__entry__2}

| 유형 | 설명 |
|-|-|
| 무효 |   |
[표 12. 반환]

{#GlideHTTPRequest-setHttpTimeout__table_sjp_1ly_cfb}  
이 예시에서는 setTimeout() 메서드를 사용하여 엔드포인트 호출에 대한 시간 제한 값을 설정하는 방법을 보여줍니다.

    var instance = 'dev12345';
    var username = 'admin';
    var password = 'yourpassword';

    // Instantiate request with ServiceNow API incidents table endpoint
    var request = new GlideHTTPRequest('https://'+instance+'.service-now.com/api/now/table/incident');

    // Add authentication data
    request.setBasicAuth(username, password);

    // Add the Accept header to get JSON response
    request.addHeader('Accept', 'application/json');

    // Set the time out value
    request.setHttpTimeOut(1000);

    // Execute the GET request
    var response = request.get();

    // Print the results: status code and number of records returned
    gs.print(response.getStatusCode());

출력

    200

## GlideHTTPRequest - setLogLevel(String logLevel) {#ariaid-title8}

HTTP 요청에 대한 로그 수준을 설정합니다.
{#GlideHTTPRequest-setLogLevel__table_ijx_myy_cfb__entry__3}

| 이름 | 유형 | 설명 |
|-|-|-|
| 로그레벨 | 문자열 | 사용 가능한 로깅 수준입니다. 주: 성능상의 이유로 프로덕션에서는 HTTP 요청 로깅을 에 두 basic는 것이 좋습니다. 유효한 값은 다음과 같습니다. * basic: 호스트, 경로, 응답 상태 등 HTTP 트랜잭션의 많은 속성을 다룹니다. * 상승: 모든 요청 헤더, 쿼리 문자열 및 모든 응답 헤더뿐만 아니라 모든 것을 포함합니다.basic * all: 모든 항목과 요청 본문 및 응답 본문을 포함합니다.elevated 기본값: 기본 |
[표 13. 매개변수]

{#GlideHTTPRequest-setLogLevel__table_ijx_myy_cfb} {#GlideHTTPRequest-setLogLevel__table_jjx_myy_cfb__entry__2}

| 유형 | 설명 |
|-|-|
| 무효 |   |
[표 14. 반환]

{#GlideHTTPRequest-setLogLevel__table_jjx_myy_cfb}  
이 예시에서는 setLogLevel() 메서드를 사용하여 엔드포인트 호출에 대한 로그 수준을 설정하는 방법을 보여줍니다.

    var instance = 'dev12345';
    var username = 'admin';
    var password = 'yourpassword';

    // Instantiate request with ServiceNow API incidents table endpoint
    var request = new GlideHTTPRequest('https://'+instance+'.service-now.com/api/now/table/incident');

    // Add authentication data
    request.setBasicAuth(username, password);

    // Add the Accept header to get JSON response
    request.addHeader('Accept', 'application/json');

    // Set the time out value
    request.setLogLevel(elevated);

    // Execute the GET request
    var response = request.get();

    // Print the results: status code and number of records returned
    gs.print(response.getStatusCode());

출력

    200

## GlideHTTPRequest - setupProxy(String host, String port) {#ariaid-title9}

연결된 REST 호출에 대한 프록시 호스트와 포트를 설정합니다.
{#GlideHTTPRequest-setupProxy__table_aww_sry_cfb__entry__3}

| 이름 | 유형 | 설명 |
|-|-|-|
| 호스트 | 문자열 | 프록시 호스트 |
| 포트 | 문자열 | 프록시 포트 |
[표 15. 매개변수]

{#GlideHTTPRequest-setupProxy__table_aww_sry_cfb} {#GlideHTTPRequest-setupProxy__table_bww_sry_cfb__entry__2}

| 유형 | 설명 |
|-|-|
| 무효 |   |
[표 16. 반환]

{#GlideHTTPRequest-setupProxy__table_bww_sry_cfb}

