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": "인증서가 발급되었습니다."
}

오류 코드

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

Request Sample

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

Map<String, String> customAttribute = new HashMap<>();
customAttribute.put("attribute_tag", "score");
customAttribute.put("attribute_value", "90");

Map<String, Object> user = new HashMap<>();
user.put("name", "홍길동");
user.put("email", "hong@example.com");
user.put("admin_comment", "축하합니다!");
user.put("level", 5);
user.put("custom_attributes", List.of(customAttribute));

Map<String, Object> requestBody = new HashMap<>();
requestBody.put("achievementFormId", 482);
requestBody.put("mode", "email");
requestBody.put("users", List.of(user));

ObjectMapper mapper = new ObjectMapper();
String jsonBody = mapper.writeValueAsString(requestBody);

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

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