Skip to main content

인증서 발급

인증서 발급 (POST)

인증서를 이메일 또는 문자 방식으로 일괄 발급합니다.

  • Method: POST

  • URL: /achievements/issue

  • Request Body (JSON):

    필드타입필수유효성검사설명
    achievementFormIdnumberYes사용될 인증서 폼의 고유 ID
    modestringYes값은 email 또는 phone만 허용됨발급 방식
    usersuser[]Yes발급 대상 사용자 목록 (아래 개별 사용자 오브젝트 참조)

user (object)

필드명타입필수유효성검사설명
namestringYes사용자의 이름
emailstringYes, (mode 가 "email" 일 경우)유효한 이메일 형식이어야 함 (예: user@example.com)사용자의 이메일 주소 (이메일 방식인 경우)
phoneNumberstringYes, (mode 가 "phone" 일 경우)정규표현식: ^010\d8$ (010으로 시작하는 11자리 숫자만 허용)사용자의 전화번호 (전화 방식인 경우)
admin_commentstringNo관리자가 해당 사용자에 대해 남긴 코멘트
levelnumberNo인증서 레벨
custom_attributesCustom Attribute[]No인증서 커스텀 속성 배열 (아래 개별 객체 참조)

Custom Attribute (object)

필드명타입필수유효성검사설명
attribute_tagstringYes속성 태그
attribute_valuestringYes속성 값
  • Body 예시:
{
"achievementFormId": 482,
"mode": "email",
"users": [
{
"name": "홍길동",
"email": "hong@example.com",
"admin_comment": "축하합니다!",
"level": 5,
"custom_attributes": [
{ "attribute_tag": "score", "attribute_value": "90" }
]
}
]
}

Response

{
"statusCode": 201,
"message": "인증서가 발급되었습니다."
}

오류 코드

상태 코드에러메시지상세 설명
400BadRequest잘못된 요청입니다.허가되지 않은 값, 올바르지 않은 형식의 요청
400ValidationErroremail 또는 phoneNumber 중 하나는 반드시 포함되어야 합니다.User Object에 이메일 또는 전화번호 중 하나는 필수
401UnauthorizedInvalid token인증 정보가 올바르지 않은 경우
404ClubNotFound도메인이 domain인 클럽을 찾을 수 없습니다.도메인 정보가 올바르지 않은 경우
404AchievementFormNotFound유효하지 않은 인증서 폼 ID입니다.인증서 폼이 존재하지 않은 경우
500InternalServerError인증서 발급 중 예기치 않은 오류가 발생했습니다.서버 에러

Request Sample

String url = "https://${baseURL}/open-api/achievements/issue";

String jsonBody = "{"
+ "\"achievementFormId\": 482,"
+ "\"mode\": \"email\","
+ "\"users\": ["
+ " {"
+ " \"name\": \"홍길동\","
+ " \"email\": \"hong@example.com\","
+ " \"admin_comment\": \"축하합니다!\","
+ " \"level\": 5,"
+ " \"custom_attributes\": ["
+ " { \"attribute_tag\": \"score\", \"attribute_value\": \"90\" }"
+ " ]"
+ " },"
+ "]"
+ "}";

HttpResponse<String> response = Unirest.post(url)
.header("Content-Type", "application/json")
.header("Accept", "application/json")
.header("Authorization", "Bearer " + apiKey)
.body(jsonBody)
.asString();

System.out.println("Status: " + response.getStatus());
System.out.println("Response: " + response.getBody());