---
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


---

# 첨부 파일 및 첨부 파일 메타데이터 검색

# 첨부 파일 및 첨부 파일 메타데이터 검색 {#ariaid-title1}

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

NowAttachmentService API를 사용하면 첨부 파일에 대해 CRUD 작업을 수행하고 인스턴스에서 첨부 파일 메타데이터를 검색할 ServiceNow 수 있습니다.
주:  
NowAttachment API는 기본 ServiceNow 시스템의 게스트 사용자에게 작동합니다.  
이 API를 사용하여 다음을 수행할 수 있습니다.

* 첨부 파일을 인스턴스에 ServiceNow 업로드하고 특정 기록에 연결합니다.
* 하나 이상의 첨부 파일을 다운로드합니다.
* 첨부 파일을 삭제합니다.
* 첨부 파일의 계산된 해시를 예상 해시와 비교하여 첨부 파일의 유효성을 확인합니다.
* 첨부 파일 메타데이터를 다운로드합니다. 이 메타데이터는 첨부 파일이 업로드될 때 인스턴스에서 ServiceNow 생성됩니다.
{#mobsdk-and-retrieve_attach_metadata__ul_l5y_qjw_3qb}

첨부 파일 작업에 대한 자세한 내용은 [첨부 파일 API](https://servicenow-prod.fluidtopics.net/Y_7a5P0pWieu7lgS74_Rzw#c_AttachmentAPI "첨부 파일 API는 첨부 파일을 업로드하고 쿼리할 수 있는 엔드포인트를 제공합니다.")를 참조하십시오.  
다음은 NowAttachmentService를 인스턴스화하는 방법을 보여줍니다.

    /**
     * Helper class used to handle different Now service instances. 
     * It has an application scope or is a Singleton.
     */
    @Singleton
    class SdkManager @Inject constructor() {


        private var nowAttachmentService: NowAttachmentService? = null

        /**
         * Create the NowAttachmentService once in the lifetime of the application 
         * inside the Application class or another manager class
         * that will be injected into other classes via dagger/hilt.
         * NowAttachmentService should be created after initializing the NowSDK
         */
        suspend fun getNowAttachmentService(): NowAttachmentService? {
            if (nowAttachmentService != null) return nowAttachmentService

            return NowDataSDK.makeAttachmentService(URL("https://instance-name.service-now.com"))
                .getOrThrow()
                .also { this.nowAttachmentService = it }
        }
    }

다음은 특정 첨부 파일에 대한 메타데이터를 가져오는 [호출](https://servicenow-prod.fluidtopics.net/BN_RUz24goZYtkdnEIbMCQ#CallAndroidInterface "호출 인터페이스는 처리를 위해 준비된 요청을 나타냅니다.") 객체를 가져오는 방법을 보여줍니다. 지정된 요청을 수행하고 `Response<NowAttachmentMetadata>`를 반환할 수 있는 실행 파일 객체를 만듭니다.  

    suspend fun fetchMetadata(sysId: String) {
        val response = runCatching {
            sdkManager.getNowAttachmentService()?.attachmentMetadata(sysId)?.execute()
        }

        if (response.isSuccess) {
            val nowAttachmentMetadata = response.getOrNull()?.body
        } else {
            Log.e("NowSDK", "result not successful")
        }
    }

다음은 여러 첨부 파일에 대한 메타데이터를 가져오는 [호출](https://servicenow-prod.fluidtopics.net/BN_RUz24goZYtkdnEIbMCQ#CallAndroidInterface "호출 인터페이스는 처리를 위해 준비된 요청을 나타냅니다.") 객체를 가져오는 방법을 보여줍니다. 지정된 요청을 수행하고 `Response< List<NowAttachmentMetadata>>`를 반환할 수 있는 실행 파일 객체를 만듭니다.  

    suspend fun fetchMultipleMetadata() {
        val filterQuery = "content_type=text/plain"
        val limit = 5

        val response = runCatching {
            sdkManager.getNowAttachmentService()?.attachmentMetadata(Filter(filterQuery), limit)?.execute()
        }

        if (response.isSuccess) {
            val attachmentMetadataList = response.getOrNull()?.body
        } else {
            Log.e("NowSDK", "result not successful")
        }
    }

## 첨부 파일 메타데이터 페이지 매김 {#mobsdk-and-retrieve_attach_metadata__section_stt_34w_3qb}

NowAttachmentService 메서드를 사용하여 하나 이상의 첨부 파일에 대한 첨부 파일 메타데이터를 다운로드할 수 있습니다. 여러 첨부 파일에서 메타데이터를 다운로드할 때 반환될 수 있는 잠재적으로 많은 양의 데이터를 쉽게 반복할 수 있는 Paginator 개체를 반환하는 메서드를 사용할 [NowAttachmentService - attachmentMetadataPaginator(filter: 필터? = null, 제한: Int? = null)](https://servicenow-prod.fluidtopics.net/xX9_Mt8t5T7l8LqjWj~eGw#NAttServ-attachMetadataPaginat_S_I "지정된 기준을 충족하는 모든 첨부 파일에 대한 메타데이터를 검색하고 반환된 메타데이터의 페이지를 반복하기 위한 페이지 매김기를 생성합니다.") 수 있습니다.  
그런 다음 Paginator 메서드를 사용하여 반환된 메타데이터를 반복하고 observe() 콜백에서 응답을 받을 수 있습니다.

     suspend fun createAttachmentMetadataPaginator() {
      val filterQuery: String = "content_type=text/plain"
      val filter = filterQuery.let(::Filter)
      val limit = 10

      val paginator = sdkmanager.getNowAttachmentService()?.attachmentMetadataPaginator(filter, limit)
        ?.observe(object : PaginatorCallBack<NowAttachmentMetadata> {
          override fun onSuccess(response: Response<List<NowAttachmentMetadata>>) {
            // Handle response
          }

          override fun onFailure(e: NowDataError) {
            // Handle error
          }

        })
        ?: throw Exception("Response is null")

      // Use paginator operators to navigate. Example
      while (paginator.hasNext() && !paginator.isBusy()) {
        paginator.next()
      }
    }

반환된 Paginator 객체는 반환된 기록을 페이징할 수 있는 다음 메서드를 제공합니다. 먼저 observe() 함수를 호출하여 페이지 매김자의 콜백을 설정해야 합니다.

* 첫 번째()
* hasNext()
* has이전
* 바쁜 상태
* 마지막()
* 다음()
* 관찰()
* 이전()
* 재설정()

{#mobsdk-and-retrieve_attach_metadata__ul_pyb_2w3_3qb}  
주:  
일부 Paginator 메서드는 가져올 페이지가 더 이상 없는 경우와 같이 예외를 throw할 수 있습니다.

