4.인증 및 고객정보 API인증 및 고객정보 API

Edit

4.1API 개요

4.1.1선결 조건

4.1.2상당사 API 리스트

  • 상담사 로그인의 경우 상담사가 관리자 인지, 상담사 인지에 따라 API 접근 권한이 달라진다.

4.1.2.1상담사 정보 조회

4.1.2.2회사 정보 조회

4.1.2.3상담사 로그아웃

4.1.3청약 정보 조회 API 리스트

4.1.3.1청약정보 조회

4.2상담사 API

4.2.1인증 토큰 조회

4.2.1.1Request

Description

채팅상담 오픈 요청.

Method

POST

API URL

/{version}/oauth/token

Header Parameters

키네임

타입

필수

설명

Authorization

string

Y

Basic 클라이언트 정보

- 예시(id/pw): Basic {base64_encode({clientId}:{clientSecret})}

- 예시(key): Basic ClientSecret

Content-Type

string

Y

application/x-www-form-urlencoded 고정

FomData

키네임

타입

필수

설명

grant_type

string

Y/N

OAuth 2.0 인증방식

- Default: client_credentials

[SAMPLE] javascrpt
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic ${client_id} ${client_secret}");
                
var urlencoded = new URLSearchParams();
urlencoded.append("grant_type", "client_credentials");
                        
var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: urlencoded,
  redirect: 'follow'                
};
                
fetch("${base_url}/v1/oauth/token", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

4.2.1.2Response

HTTP HEADER 200: 성공, 나머지는 실패

-

타입

설명

code


text

결과 코드

message


text

결과 메시지

data


object

-


userId

text

상담사 ID


access_token

text

인증 key


expires_in

text

server token 유효기간(초)


token_type

text

토큰타입(basic, bearer)

아래의 코드표 참조

4.2.2상담사 정보조회

4.2.2.1Request

Description

채팅상담 오픈 요청.

Method

GET

API URL

/{version}/agent/info

header

Content-Type: application/json; charset=UTF-8

Authorization: Bearer {access_token}

키네임


타입

필수

설명

userid


string

Y

상담사 ID

* 기타 채팅상담 시 필요한 항목이 있을 경우 협의 후 추가.

[SAMPLE]
https://127.0.0.1/api/agent/info?userid=agent001

4.2.2.2Response

HTTP HEADER 200: 성공, 나머지는 실패

-

타입

설명

code


text

결과 코드

data





userid

text

상담사 정보


name

text

이름


email

text

이메일


phone

text

전화번호


tenant

text

회사 code

4.2.3회사 정보조회

4.2.3.1Request

Description

채팅상담 오픈 요청.

Method

GET

API URL

/{version}/company/info

header

Content-Type: application/json; charset=UTF-8

Authorization: Bearer {access_token}

Body

키네임


타입

필수

설명

tenant


string

Y

회사코드

* 기타 채팅상담 시 필요한 항목이 있을 경우 협의 후 추가.

[SAMPLE]
https://127.0.0.1/api/company/info?tenant=nexus

4.2.3.2Response

HTTP HEADER 200: 성공, 나머지는 실패

-

타입

설명

code


text

결과 코드

data





tenant

text

회사코드


name

text

회사명


email

text

이메일


phone

text

전화번호


...

text

항목 추가 예정

4.3청약 정보 조회 API

4.3.1서비스 포탈 로그인

4.3.1.1Request

Description

채팅상담 오픈 요청.

Method

POST

API URL

/{version}/subscription/oauth/token

Header Parameters

키네임

타입

필수

설명

Authorization

string

Y

Basic 클라이언트 정보

- 예시(id/pw): Basic ClientID ClientSecret

- 예시(key): Basic ClientSecret

Content-Type

string

Y

application/x-www-form-urlencoded 고정

FomData

키네임

타입

필수

설명

grant_type

string

Y/N

OAuth 2.0 인증방식

- Default: client_credentials

4.3.1.2Response

HTTP HEADER 200: 성공, 나머지는 실패

-

타입

설명

code


text

결과 코드

message


text

결과 메시지

data


object

-


userId

text

회사아이디


tenant

text

테넌트 id


access_token

text

인증 key


expires_in

text

server token 유효기간(초)


token_type

text

토큰타입(basic, bearer)

아래의 코드표 참조

4.3.2청약 정보 조회

4.3.2.1Request

Description

채팅상담 오픈 요청.

Method

POST

API URL

/{version}/subscription/info

header

Content-Type: application/json; charset=UTF-8

Authorization: Bearer {access_token}

Body

키네임

타입

필수

설명

tenant

string

Y

회사 코드

* 기타 채팅상담 시 필요한 항목이 있을 경우 협의 후 추가.

[SAMPLE]
{
    "tenant":"nexus"
}

4.3.2.2Response

HTTP HEADER 200: 성공, 나머지는 실패

-

타입

설명

code


text

결과 코드

data





tenant

text

회사코드


name

text

회사명


email

text

이메일


subscription

object

아래 subscription 정의 참조


plan

object

아래 plan 정의 참조


agents

array

상담사(관리자) 정보 배열

아래 agents 정의 참조


...

...

항목 추가 예정

subscription 정의

키네임


타입

필수

설명

subscription


object

Y

청약정보


type

string

Y

청약 타입(요금제 구분)


status

string

Y

청약상태


startDate

string

Y

시작날짜







...




plan 정의

키네임


타입

필수

설명

plan


object

Y

상품정보


aiInterview

boolean

Y

ai면접사용 여부


aiTraining

boolean

Y

ai교육사용 여부







...




agents 정의

키네임


타입

필수

설명

agents


array

Y

상담사 배열


userid

text

Y

상담사 id


name

text

Y

상담사 이름


email

text

N

상담사 email


phone

text

N

상담사 전화번호(내선)


...




4.4청약정보 수신 API

청약을 신청, 변경, 해지시 정보를 전달 한다.

4.4.1청약신청

4.4.1.1Request

Description

채팅상담 오픈 요청.

Method

POST

API URL

/{version}/subscription/create

header

Content-Type: application/json; charset=UTF-8

타입

설명

id

text

서비스포탈 Id

tenant

text

회사코드

name

text

회사명

email

text

이메일

subscription

object

subscription 정의 참조

plan

object

plan 정의 참조

agents

object

agents 정의 참조

...

...

항목 추가 예정

subscription 정의

키네임


타입

필수

설명

subscription


object

Y

메시지 배열


type

string

Y

청약 타입(요금제 구분)


status

string

Y

청약상태


startDate

string

Y

시작날짜







...




plan 정의

키네임


타입

필수

설명

plan


object

N

메시지 배열


aiInterview

boolean

Y

ai면접사용 여부


aiTraining

boolean

Y

ai교육사용 여부







...




4.4.1.2Response

HTTP HEADER 200: 성공, 나머지는 실패

-

타입

설명

code


text

결과 코드

message


text

결과 메시지

4.4.2청약수정

4.4.2.1Request

Description

채팅상담 오픈 요청.

Method

POST

API URL

/{version}/subscription/update

header

Content-Type: application/json; charset=UTF-8

타입

설명

id

text

서비스포탈 Id

tenant

text

회사코드

name

text

회사명

email

text

이메일

subscription

object

subscription 정의 참조

plan

object

plan 정의 참조

agents

array

agents 정의 참조

...

...

항목 추가 예정

subscription 정의

4.4.2.2Response

HTTP HEADER 200: 성공, 나머지는 실패

-

타입

설명

code


text

결과 코드

message


text

결과 메시지

4.4.3청약해지

4.4.3.1Request

Description

채팅상담 오픈 요청.

Method

POST

API URL

/{version}/subscription/delete

header

Content-Type: application/json; charset=UTF-8

타입

설명

id

text

서비스포탈 Id

tenant

text

회사코드

4.4.3.2Response

HTTP HEADER 200: 성공, 나머지는 실패

타입

설명

code

text

결과 코드

message

text

결과 메시지

아래의 코드표 참조

4.5코드 정의

4.5.1오류 코드

code

message

설명

0


정상코드

-400

ForbiddenException

권한 없음

-500

UnauthorizedException

인증 실패

-502

InvalidSessionException

세션이 만료되었거나 존재하지 않음

-509

InvalidJsonException

잘못된 파라메터 요청

-600

FailedToSendMessageException

메시지 전송 실패

-601

InternalSystemErrorException

내부 시스템 에러