# 튜토리얼 - ASP.NET

.NET 개발환경에서 팝빌 SDK를 추가하고, 계좌 거래내역 수집요청 (RequestJob) API를 호출하는 기본 과정을 단계별로 따라 해볼 수 있도록 구성된 가이드 입니다.

## 1. POPBiLL SDK 추가

① 팝빌 연동자료실에서 ASP.NET SDK 예제코드 다운로드 후 압축을 해제합니다.

② 다운받은 SDK 예제코드의 Linkhub/, Popbill/ 폴더를 SDK를 적용할 프로젝트 경로에 복사하고, Linkhub.csproj, Popbill.csproj를 각각 기존 프로젝트로 추가합니다.

![](https://developers.popbill.com/images/guide/getting-started/image-tutorial-append-sdk-dotnet-asp-01.jpg)

③ Popbill 프로젝트를 적용할 프로젝트의 참조로 추가합니다.

![](https://developers.popbill.com/images/guide/getting-started/image-tutorial-append-sdk-dotnet-asp-02.jpg)

## 2. RequestJob 기능 구현

Web Form을 추가하여 requestJob.aspx를 생성하여 응답코드, 메시지 확인 페이지를 추가하고, requestJob.aspx.cs 파일의 Page\_Load 이벤트에 함수 호출 코드를 추가합니다.

requestJob.aspx

```csharp
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="requestJob.aspx.cs" Inherits="Tutotial_Example_asp.requestJob" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns=" http://www.w3.org/1999/xhtml ">
<head id="Head1" runat="server">
    <title>Popbill ASP.NET Example</title>
</head>
<body>
    <p>Response</p>
    <br>
    <div>
        <fieldset>
            <legend>수집 요청</legend>
            <ul>
                <% if (!String.IsNullOrEmpty(code)) { %>
                    <li>Response.code : <%= code %></li>
                    <li>Response.message : <%= message %></li>
                <% } else { %>
                    <li>jobID (작업아이디) : <%= jobID %></li>
                <% } %>
            </ul>
        </fieldset>
    </div>
</body>
</html>
```

requestJob.aspx.cs

```csharp
namespace Tutotial_Example_asp
{
    public partial class requestJob : System.Web.UI.Page
    {
        public String code;
        public String message;
        public String jobID;
        protected void Page_Load(object sender, EventArgs e)
        {
           /*
           * 계좌 거래내역 수집을 요청합니다.
           * - 검색기간은 현재일 기준 90일 이내로만 요청할 수 있습니다.
           * - 수집 요청후 반환받은 작업아이디(JobID)의 유효시간은 1시간 입니다.
           */


            // 팝빌회원 사업자번호
            String testCorpNum = "1234567890";


            // 기관코드
            String BankCode = "0048";


            // 은행 계좌번호
            String AccountNumber = "3011599770921";


            // 시작일자, 표시형식(yyyyMMdd)
            String SDate = "20250201";


            // 종료일자, 표시형식(yyyyMMdd)
            String EDate = "20250228";


            try
            {
                jobID = Global.easyFinBankService.RequestJob(testCorpNum, BankCode, AccountNumber, SDate, EDate);
            }
            catch (PopbillException ex)
            {
                code = ex.code.ToString();
                message = ex.Message;
            }


        }
    }
}
```

## 3. API 응답결과 확인

API 호출 응답결과는 다음과 같습니다.

| 구분 | 응답                                                                                            |
| -- | --------------------------------------------------------------------------------------------- |
| 성공 | JobID(작업아이디) : 18자리 문자열                                                                       |
| 실패 | code : 오류코드 (8자리 음의 정수) [\[오류코드\]](https://developers.popbill.com/error-code) message : 오류메시지 |
