Browse Source

카테노이드 Kollus API 수정

gagamel 5 years ago
parent
commit
ead52641c1
1 changed files with 22 additions and 5 deletions
  1. 22 5
      src/main/java/com/style24/core/biz/thirdparty/KollusApi.java

+ 22 - 5
src/main/java/com/style24/core/biz/thirdparty/KollusApi.java

@@ -31,11 +31,28 @@ import lombok.extern.slf4j.Slf4j;
 public class KollusApi {
 
 	// URL
-	private String apiUrl = "http://api.kr.kollus.com/0/media_auth/upload/create_url?access_token=7ge80tfvz51x2606";
+	private String apiUrl = "http://upload.kr.kollus.com/api/v1/create_url?access_token=50oytl7t11315o5l";
 
 	@Autowired
 	private RestTemplate restTemplate;
 
+	// 카테고리
+	public enum Category {
+		Goods("vdv5kp67vw2y6u0k"),	// 상품
+		Review("hhria1fyl0oayoi4"),	// 리뷰
+		Display("fgauvtaa18pdphzu");// 전시
+
+		private String value;
+
+		private Category(String value) {
+			this.value = value;
+		}
+
+		public String value() {
+			return value;
+		}
+	}
+
 	@PostConstruct
 	public void init() {
 		log.debug("\n\n---- CATENOID Kollus initialization started ----");
@@ -45,17 +62,17 @@ public class KollusApi {
 
 	/**
 	 * 일회성 동영상 업로드 URL 조회
-	 * @param goodsCd - 상품코드
+	 * @param cateKey - 카테고리키
 	 * @return 동영상 업로드 URL 정보
 	 * @throws Exception
 	 * @author gagamel
 	 * @since 2021. 4. 15
 	 */
-	public KollusResult getVideoUploadUrl(String goodsCd) throws Exception {
+	public KollusResult getVideoUploadUrl(String cateKey) throws Exception {
 		// Parameter
 		MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
 //		params.add("expire_time", "600");			// 만료시간. 값의 범위는 0 < expire_time <= 21600. 빈값을 보내거나 항목 자체를 제거하면 기본 600초로 설정
-//		params.add("category_key", "");				// 업로드할 파일이 속할 카테고리키
+		params.add("category_key", cateKey);		// 업로드할 파일이 속할 카테고리키
 //		params.add("title", "");					// 입력한 제목을 컨텐츠의 제목으로 강제 지정. 이 값을 보내지 않거나 빈 값으로 보내면 기본적으로 파일명이 제목으로 사용됨. is_passthrough를 1로 설정 시 원본파일명으로 지정됨.
 		params.add("is_encryption_upload", "0");	// 0은 일반업로드, 1은 암호화업로드. 암호화 업로드 시 파일이 암호화 되어 Kollus의 전용 플레이어로만 재생됨.
 		params.add("is_audio_upload", "0");			// 0은 비디오 업로드, 1은 음원파일 업로드
@@ -69,7 +86,7 @@ public class KollusApi {
 		HttpHeaders headers = new HttpHeaders();
 //		headers.add("Accept", "application/xml; charset=utf-8");
 //		headers.add("Content-Type", "application/xml; charset=utf-8");
-		headers.setContentType(MediaType.APPLICATION_XML);
+		headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
 
 		HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<MultiValueMap<String, String>>(params, headers);
 		URI url = URI.create(apiUrl);