TMAP 대중교통 API 이용절차

다양한 교통 수단을 활용하여 최적의 대중교통 경로탐색 서비스를 제공할 수 있습니다.

  • SK OPEN API
    회원가입/로그인

  • SK OPEN API 상품 구매
    (앱 키 발급)

  • OPEN API 호출

  • 응답 또는 에러 처리

  • STEP 01 회원가입/로그인
  • STEP 02 상품 구매
  • STEP 03 OPEN API 호출
    • 1

      API 규격서를 참고하여 호출 정보를 입력합니다.

      • 호출 URL
      • Headers
      • Body
    • 2

      API를 호출합니다.

    • API URL

      														https://apis.openapi.sk.com/transit/routes
      													
    • Headers Sample

      														
      - accept : application/json
      - appKey : 발급 Appkey
      - content-type : application/json
      				
      													
    • Body Sample

      														
      {
      	"startX": "127.02550910860451",
      	"startY": "37.63788539420793",
      	"endX": "127.030406594109",
      	"endY": "37.609094989686",
      	"count" : 1,
      	"lang": 0,
      	"format":"json"
      }
      				
      													
  • STEP 04 응답 또는 에러 처리
    • 1

      정상 응답 확인

    • 2

      에러 코드 및 메시지 확인

    • 200 – Result Sample

      														
      {
          "metaData": {
              "requestParameters": {
                  "busCount": 1,
                  "expressbusCount": 0,
                  "subwayCount": 0,
                  "airplaneCount": 0,
                  "locale": "ko",
                  "endY": "37.609094989686",
                  "endX": "127.030406594109",
                  "wideareaRouteCount": 0,
                  "subwayBusCount": 0,
                  "startY": "37.63788539420793",
                  "startX": "127.02550910860451",
                  "ferryCount": 0,
                  "trainCount": 0,
                  "reqDttm": "20221028152120"
              },
              "plan": {
                  "itineraries": [
                      {
                          "fare": {
                              "regular": {
                                  "totalFare": 1200,
                                  "currency": {
                                      "symbol": "₩",
                                      "currency": "원",
                                      "currencyCode": "KRW"
                                  }
                              }
                          },
                          "totalTime": 986,
                          "legs": [
                              {
                                  "mode": "WALK",
                                  "sectionTime": 110,
                                  "distance": 115,
                                  "start": {
                                      "name": "출발지",
                                      "lon": 127.02550910860451,
                                      "lat": 37.63788539420793
                                  },
                                  "end": {
                                      "name": "수유역.강북구청",
                                      "lon": 127.02612777777777,
                                      "lat": 37.638625
                                  },
                                  "steps": [
                                      {
                                          "streetName": "",
                                          "distance": 60,
                                          "description": "60m 이동",
                                          "linestring": "127.02551,37.637882 127.02552,37.637897 127.025955,37.63829"
                                      },
                                      {
                                          "streetName": "",
                                          "distance": 15,
                                          "description": "좌회전 후 15m 이동 ",
                                          "linestring": "127.025955,37.63829 127.025826,37.638374"
                                      },
                                      {
                                          "streetName": "",
                                          "distance": 25,
                                          "description": "수유역  7번출구 에서 우회전 후 25m 이동 ",
                                          "linestring": "127.025826,37.638374 127.02598,37.638523 127.02597,37.63855"
                                      },
                                      {
                                          "streetName": "도봉로",
                                          "distance": 15,
                                          "description": "수유역  8번출구 에서 우회전 후 도봉로 을 따라 15m 이동 ",
                                          "linestring": "127.02597,37.63855 127.02606,37.63864 127.02608,37.638657"
                                      }
                                  ]
                              },
                              {
                                  "mode": "BUS",
                                  "routeColor": "53B332",
                                  "sectionTime": 710,
                                  "route": "지선:1128",
                                  "distance": 4118,
                                  "start": {
                                      "name": "수유역.강북구청",
                                      "lon": 127.02612777777777,
                                      "lat": 37.638625
                                  },
                                  "passStopList": {
                                      "stationList": [
                                          {
                                              "index": 0,
                                              "stationName": "수유역.강북구청",
                                              "lon": "127.026128",
                                              "lat": "37.638625",
                                              "stationID": "777957"
                                          },
                                          {
                                              "index": 1,
                                              "stationName": "신일병원",
                                              "lon": "127.022400",
                                              "lat": "37.634719",
                                              "stationID": "777816"
                                          },
                                          {
                                              "index": 2,
                                              "stationName": "강북노인종합복지관",
                                              "lon": "127.018939",
                                              "lat": "37.634439",
                                              "stationID": "777807"
                                          },
                                          {
                                              "index": 3,
                                              "stationName": "화계사입구",
                                              "lon": "127.017442",
                                              "lat": "37.633333",
                                              "stationID": "777743"
                                          },
                                          {
                                              "index": 4,
                                              "stationName": "빨래골입구.수유1동주민센터",
                                              "lon": "127.017781",
                                              "lat": "37.629700",
                                              "stationID": "777597"
                                          },
                                          {
                                              "index": 5,
                                              "stationName": "롯데마트삼양점.래미안1차아파트",
                                              "lon": "127.018200",
                                              "lat": "37.625511",
                                              "stationID": "777412"
                                          },
                                          {
                                              "index": 6,
                                              "stationName": "삼양초등학교",
                                              "lon": "127.018967",
                                              "lat": "37.623219",
                                              "stationID": "777316"
                                          },
                                          {
                                              "index": 7,
                                              "stationName": "강북청소년문화정보도서관입구",
                                              "lon": "127.020208",
                                              "lat": "37.621769",
                                              "stationID": "777266"
                                          },
                                          {
                                              "index": 8,
                                              "stationName": "삼양동사거리",
                                              "lon": "127.021694",
                                              "lat": "37.619169",
                                              "stationID": "777176"
                                          },
                                          {
                                              "index": 9,
                                              "stationName": "성암국제무역고등학교",
                                              "lon": "127.025514",
                                              "lat": "37.617994",
                                              "stationID": "777125"
                                          },
                                          {
                                              "index": 10,
                                              "stationName": "삼양동사거리입구",
                                              "lon": "127.028500",
                                              "lat": "37.617081",
                                              "stationID": "777085"
                                          },
                                          {
                                              "index": 11,
                                              "stationName": "미아사거리역",
                                              "lon": "127.029778",
                                              "lat": "37.615453",
                                              "stationID": "776989"
                                          },
                                          {
                                              "index": 12,
                                              "stationName": "미아사거리",
                                              "lon": "127.030100",
                                              "lat": "37.610197",
                                              "stationID": "776703"
                                          }
                                      ]
                                  },
                                  "end": {
                                      "name": "미아사거리",
                                      "lon": 127.0301,
                                      "lat": 37.61019722222222
                                  },
                                  "type": 12,
                                  "passShape": {
                                      "linestring": "127.026156,37.638594 127.023856,37.636456 127.023564,37.636175 127.023394,37.635961 127.023297,37.635803 127.023189,37.635550 127.023156,37.635389 127.023142,37.635278 127.023181,37.634889 127.023194,37.634747 127.022425,37.634689 127.019519,37.634467 127.018919,37.634406 127.017581,37.634272 127.017417,37.634108 127.017489,37.633333 127.017694,37.631122 127.017714,37.630742 127.017825,37.629694 127.017825,37.629681 127.017975,37.627683 127.018242,37.625522 127.018311,37.624953 127.018331,37.624858 127.018428,37.624167 127.018519,37.623883 127.018594,37.623744 127.018847,37.623408 127.018997,37.623250 127.019994,37.622169 127.020239,37.621797 127.020242,37.621789 127.020361,37.621525 127.020956,37.619597 127.021075,37.619464 127.021208,37.619353 127.021692,37.619203 127.022906,37.618833 127.023528,37.618581 127.023875,37.618458 127.024317,37.618328 127.025514,37.618033 127.025547,37.618019 127.025772,37.617919 127.026206,37.617703 127.027153,37.617178 127.027200,37.617167 127.028514,37.617117 127.029708,37.617069 127.029764,37.616783 127.029781,37.616036 127.029825,37.615453 127.030019,37.612792 127.030094,37.612286 127.030233,37.611583 127.030267,37.611283 127.030258,37.610969 127.030189,37.610178"
                                  }
                              },
                              {
                                  "mode": "WALK",
                                  "sectionTime": 166,
                                  "distance": 152,
                                  "start": {
                                      "name": "미아사거리",
                                      "lon": 127.0301,
                                      "lat": 37.61019722222222
                                  },
                                  "end": {
                                      "name": "도착지",
                                      "lon": 127.030406594109,
                                      "lat": 37.609094989686
                                  },
                                  "steps": [
                                      {
                                          "streetName": "도봉로",
                                          "distance": 107,
                                          "description": "도봉로 을 따라 107m 이동",
                                          "linestring": "127.03003,37.610203 127.03001,37.610046 127.03001,37.610027 127.03001,37.609997 127.02998,37.60989 127.029945,37.609604 127.02994,37.609585 127.02993,37.60957 127.02989,37.609333 127.02988,37.609264 127.02987,37.60925"
                                      },
                                      {
                                          "streetName": "",
                                          "distance": 14,
                                          "description": "세사리빙 미아점 에서 좌측 횡단보도 후 14m 이동 ",
                                          "linestring": "127.02987,37.60925 127.03002,37.60922"
                                      },
                                      {
                                          "streetName": "",
                                          "distance": 15,
                                          "description": "우회전 후 15m 이동 ",
                                          "linestring": "127.03002,37.60922 127.03007,37.609154 127.03014,37.609177"
                                      },
                                      {
                                          "streetName": "보행자도로",
                                          "distance": 16,
                                          "description": "횡단보도 후 보행자도로 을 따라 16m 이동 ",
                                          "linestring": "127.03014,37.609177 127.03029,37.60925"
                                      }
                                  ]
                              }
                          ],
                          "totalWalkTime": 276,
                          "transferCount": 0,
                          "totalDistance": 4343,
                          "pathType": 2,
                          "totalWalkDistance": 267
                      }
                  ]
              }
          }
      }
      					
      													
    • 400 – Result Sample

      														
      {
      	"result": {
      		"message": "검색 결과가 없음",
      		"status": 14
      	}
      }
      					
      													
    • 500 – Result Sample

      														
      {
      	"result": {
      		"message": "일정 시간 응답이 없음",
      		"status": 31
      	}
      }
      				
      													

Loading