Review API

CREMA 서버에 등록된 리뷰 정보를 확인하고, 등록/수정하는 방법을 제공합니다.

List reviews

리뷰 목록을 가져옵니다.

반환되는 결과 중 product_options(구매 시 선택한 옵션)은 쇼핑몰의 설정에 따라 없을 수도 있습니다.

반환되는 결과 중 third_party_name(외부 연동 업체 이름)은 외부 연동 업체 유무에 따라 없을 수도 있습니다.

반환되는 결과 중 sub_brand_id(하위 브랜드 id)는 하위 브랜드 유무에 따라 없을 수도 있습니다.

plus_likes_count는 "도움 돼요" 개수만, likes_count는 "도움 돼요"와 "도움 안 돼요" 모두 합한 개수입니다.

video_urls 는 유효 기간이 7일인 5초 이내의 짧은 영상 링크를 담고 있습니다. 추후 response 에서 제거될 예정으로, videos 를 사용하시면 됩니다.

videos 는 유효 기간이 7일인 전체 길이의 화질별 영상 링크를 담고 있습니다.

page 의 최대값은 30입니다. 이를 넘어가는 레코드를 조회하려면 조회 기간을 조정해주세요.

start_date, end_date 또는 start_datetime, end_datetime 파라미터를 사용해 조회 기간을 설정하지 않으면, 기본으로 최근 30일에 대해서 조회합니다. 조회 기간 최대값은 45일입니다.

start_datetime, end_datetime 값 입력시 start_date, end_date 입력은 무시되니 조회 기간은 한 종류만 사용해주세요.

GET /v1/reviews HTTP/1.1

Parameters

이름 타입 필수 설명
limit integer 한 페이지에 가져올 리뷰의 개수입니다. 최대 100개까지 가능합니다. 기본: 30
page integer 페이지 번호입니다. 최대 페이지 수는 Link http header의 rel="last"에 기재되어 있습니다. 기본: 1, 최대값: 30
product_id integer 특정 상품의 리뷰만 가져올 때 사용합니다.
product_code string 특정 상품의 리뷰만 가져올 때 사용합니다. 상품의 쇼핑몰 서비스측 고유 식별자.
user_code string 특정 회원의 리뷰만 가져올 때 사용합니다. 리뷰 작성자의 쇼핑몰 아이디.
category_id integer 특정 상품카테고리에 속한 상품의 리뷰만 가져올 때 사용합니다.
category_code string 특정 상품카테고리에 속한 상품의 리뷰만 가져올 때 사용합니다. 쇼핑몰의 상품카테고리 아이디.
score integer 특정 별점의 리뷰만 가져올 때 사용합니다. 1~5 값으로 특정 별점 리뷰, 0 값으로 별점없는 리뷰를 요청할 수 있습니다.
photo integer 포토리뷰만 가져오고 싶은 경우 1을 넘깁니다.
date_updated_at integer 리뷰의 생성 일자 대신 수정 일자를 기준으로 가져오고 싶은 경우 1을 넘깁니다.
date_order_desc integer 날짜의 역순으로 가져오고 싶은 경우 1을 넘깁니다.
start_date date 입력하면 해당 날짜부터 작성된 리뷰만 가져오게 됩니다. 형식: "yyyy-mm-dd", 기본: 30일 전
end_date date 입력하면 해당 날짜까지 작성된 리뷰만 가져오게 됩니다. 형식: "yyyy-mm-dd", 기본: 요청일
start_datetime datetime 입력하면 해당 시각부터 작성된 리뷰만 가져오게 됩니다. 형식: "yyyy-mm-dd hh:mm:ss", 기본: 30일 전 00:00:00
end_datetime datetime 입력하면 해당 시각까지 작성된 리뷰만 가져오게 됩니다. 형식: "yyyy-mm-dd hh:mm:ss", 기본: 요청일 23:59:59
tag_name string 특정 태그를 가진 리뷰만 가져올 때 사용합니다.
third_party_name string 특정 외부 연동 업체에서 연동한 리뷰만 가져올 때 사용합니다.
sub_brand_id integer 특정 서브 브랜드의 리뷰만 가져올 때 사용합니다.
sub_brand_code string 특정 서브 브랜드의 리뷰만 가져올 때 사용합니다. 서브 브랜드의 코드

Response

HTTP/1.1 200 OK
Link: <https://api.cre.ma/v1/reviews?page=2&limit=3>; rel="last", <https://api.cre.ma/v1/reviews&page=2&limit=3>; rel="next"
[
  {
    "id": 212,
    "code": null,
    "display": true,
    "user_id": 3290841,
    "user_code": "thecrema",
    "user_name": "크리마",
    "message": "잘 입고 있어요!\n구매 사이즈 : Free\r\n평소 사이즈 : 55반\r\n키 : 164cm\r\n체중 : -\r\n입은 느낌 : 쫀쫀한 재질의 티셔츠라 애용하고있어요.\r\n               지금은 날씨가 추워져서 집에서 있을 때\r\n               색깔별로 번갈아 입구있어요, 완전 강추!",
    "score": 5,
    "created_at": "2013-11-09T22:22:29.000+09:00",
    "updated_at": "2015-02-13T11:04:27.000+09:00",
    "product_id": 13587,
    "product_code": "118410",
    "review_type": "text",
    "images_count": 0,
    "images": [],
    "videos_count": 0,
    "video_urls": [],
    "videos": [],
    "likes_count": 2,
    "plus_likes_count": 2,
    "comments_count": 1,
    "source": "brand_pc",
    "options": [
      {
        "id": 1,
        "review_id": 212,
        "review_option_type_id": 1,
        "value": "160",
        "created_at": "2014-12-01T16:12:00.000+09:00",
        "updated_at": "2014-12-01T16:12:00.000+09:00"
      },
      {
        "id": 2,
        "review_id": 212,
        "review_option_type_id": 2,
        "value": "58",
        "created_at": "2014-12-01T16:12:00.000+09:00",
        "updated_at": "2014-12-01T16:12:00.000+09:00"
      }
    ],
    "product_options": {
      "색상": "블랙",
      "사이즈": "L"
    },
    "order_code": "order_code1",
    "sub_order_code": "sub_order_code1",
    "store_order": true,
    "store_name": "서울역점",
    "third_party_name": "연동업체이름",
    "sub_brand_id": 1
  },
  {
    "id": 213,
    "code": "board1_124",
    "display": true,
    "user_id": 3290841,
    "user_code": "thecrema",
    "user_name": "크리마",
    "message": "너무이뻐용\n구매 사이즈 : free\r\n평소 사이즈 : \r\n키 : 165\r\n체중 : 50\r\n입은 느낌 : 니트같은천의 티셔츤데요 뒤에.지퍼는 오픈될줄알앗는데 장식용이더라구요 ㅎㅎ 스팽글클러치들고 입엇엇는데 올풀릴뻔햇어요 날카로운가방하곤 매치하시면 조심하셔야될듯해요. 생각보다 얇아서 지금같은날씨엔외투 걸쳐주셔야해요 스커트에도 어울릴듯하고 바지에도이쁘고 만족스러운 후기입니당 ^^",
    "score": 5,
    "created_at": "2013-11-09T23:06:19.000+09:00",
    "updated_at": "2014-12-11T09:28:07.000+09:00",
    "product_id": 18794,
    "product_code": "119111",
    "review_type": "photo",
    "images_count": 1,
    "images": [
      {
        "url": "http://assets.cre.ma/p/crema-me/reviews/00/00/00/02/13/image1/a21387c475095732.jpg",
        "width": 480,
        "height": 640,
        "gallery_url": "http://assets.cre.ma/p/crema-me/reviews/00/00/00/02/13/image1/gallery_a21387c475095732.jpg",
        "gallery_width": 256,
        "gallery_height": 341,
        "portrait_url": "http://assets.cre.ma/p/crema-me/reviews/00/00/00/02/13/image1/portrait_a21387c475095732.jpg",
        "portrait_width": 215,
        "portrait_height": 237,
        "thumbnail_url": "http://assets.cre.ma/p/crema-me/reviews/00/00/00/02/13/image1/thumbnail_a21387c475095732.jpg",
        "thumbnail_width": 128,
        "thumbnail_height": 128
      }
    ],
    "videos_count": 0,
    "video_urls": [],
    "videos": [],
    "likes_count": 4,
    "plus_likes_count": 4,
    "comments_count": 1,
    "source": "sms",
    "options": [
      {
        "id": 1,
        "review_id": 213,
        "review_option_type_id": 1,
        "value": "159",
        "created_at": "2014-12-01T16:12:00.000+09:00",
        "updated_at": "2014-12-01T16:12:00.000+09:00"
      }
    ],
    "product_options": {
      "색상": "블랙",
      "사이즈": "L"
    },
    "order_code": "order_code2",
    "sub_order_code": "sub_order_code2",
    "store_order": false,
    "store_name": null,
    "third_party_name": "연동업체이름",
    "sub_brand_id": 1
  },
  {
    "id": 214,
    "code": "board1_125",
    "display": true,
    "user_id": 3290841,
    "user_code": "thecrema",
    "user_name": "크리마",
    "message": "브라운?\n구매 사이즈 : 프리\r\n평소 사이즈 : 55\r\n키 : 166\r\n체중 : 55\r\n입은 느낌 : 그냥 저냥 루즈핏입니다. 사진처럼 안이 비치는 제질이예요 그냥이쁘게 비칩니다. 잘입을게요~",
    "score": 5,
    "created_at": "2013-11-09T23:42:37.000+09:00",
    "updated_at": "2014-12-11T09:22:01.000+09:00",
    "product_id": 13991,
    "product_code": "118244",
    "review_type": "video",
    "images_count": 0,
    "images": [],
    "videos_count": 1,
    "video_urls": ["https://crema.mp4"],
    "videos": [
      {
        "hd_url": "https://crema_hd.mp4",
        "sd_url": "https://crema_sd.mp4"
      }
    ],
    "likes_count": 0,
    "plus_likes_count": 0,
    "comments_count": 1,
    "source": "brand_pc",
    "options": [],
    "order_code": null,
    "sub_order_code": null,
    "store_order": false,
    "store_name": null,
    "third_party_name": "연동업체이름",
    "sub_brand_id": 1
  }
]

참고) 추가 수집정보 v2를 사용하는 경우, response 중 options 값은 아래와 같습니다.

"options": [
  {
    "id": 1,
    "review_id": 213,
    "review_option_type_id": 1,
    "created_at": "2014-12-01T16:12:00.000+09:00",
    "updated_at": "2014-12-01T16:12:00.000+09:00",
    "option_type_name": "사이즈",
    "value": "10.0",
    "value_text": "좋아요"
  }
]

Get a single review

리뷰 한 개의 상세 정보를 가져옵니다. 반환되는 결과 중 product_options(구매 시 선택한 옵션)은 쇼핑몰의 설정에 따라 없을 수도 있습니다.

반환되는 결과 중 third_party_name(외부 연동 업체 이름)은 외부 연동 업체 유무에 따라 없을 수도 있습니다.

반환되는 결과 중 sub_brand_id(하위 브랜드 id)는 하위 브랜드 유무에 따라 없을 수도 있습니다.

with id

GET /v1/reviews/:id HTTP/1.1
이름 타입 필수 설명
id integer 리뷰의 id

with code

GET /v1/reviews HTTP/1.1
이름 타입 필수 설명
code string 리뷰의 code

Response

HTTP/1.1 200 OK
{
  "id": 4257143,
  "code": "23",
  "display": true,
  "product_id": 13663,
  "product_code": 119307,
  "user_code": "thecrema",
  "user_name": "크리마",
  "message": "",
  "review_type": "text",
  "images_count": 0,
  "images": [],
  "videos_count": 0,
  "video_urls": [],
  "videos": [],
  "score": 4,
  "comments": [],
  "likes_count": 0,
  "created_at": "2014-12-01T16:12:00.000+09:00",
  "updated_at": "2015-03-05T10:52:51.171+09:00",
  "options": [
    {
      "id": 1,
      "review_id": 4257143,
      "review_option_type_id": 1,
      "value": "160",
      "created_at": "2014-12-01T16:12:00.000+09:00",
      "updated_at": "2014-12-01T16:12:00.000+09:00"
    },
    {
      "id": 2,
      "review_id": 4257143,
      "review_option_type_id": 2,
      "value": "58",
      "created_at": "2014-12-01T16:12:00.000+09:00",
      "updated_at": "2014-12-01T16:12:00.000+09:00"
    }
  ],
  "product_options": {
    "색상": "블랙",
    "사이즈": "L"
  },
  "order_code": "order_code3",
  "sub_order_code": "sub_order_code3",
  "store_order": false,
  "store_name": null,
  "third_party_name": "연동업체이름",
  "sub_brand_id": 1
}

참고) 추가 수집정보 v2를 사용하는 경우, response 중 options 값은 아래와 같습니다.

"options": [
  {
    "id": 1,
    "review_id": 213,
    "review_option_type_id": 1,
    "created_at": "2014-12-01T16:12:00.000+09:00",
    "updated_at": "2014-12-01T16:12:00.000+09:00",
    "option_type_name": "사이즈",
    "value": "10.0",
    "value_text": "좋아요"
  }
]

Create or Update a review

새로운 리뷰를 생성하거나 기존 데이터를 수정합니다.

image_urls 로 전달하는 리뷰 이미지는 비동기적으로 저장돼, 실제 등록되기까지는 약간의 시간이 소요됩니다.

POST /v1/reviews HTTP/1.1

Parameters

이름 타입 필수 설명
code string 리뷰의 code. 리뷰의 고유 식별자입니다. 다른 리뷰와 중복되면 안됩니다.
product_id integer 리뷰가 속한 상품의 크리마 서비스측 id(쇼핑몰 서비스측 ID 아님). product_code를 입력한 경우 product_id는 입력하지 않아도 됩니다.
product_code string 리뷰가 속한 상품의 쇼핑몰 서비스측 고유 식별자.product_id를 입력한 경우 product_code는 입력하지 않아도 됩니다.
product_options array 주문상품 구매 옵션. 여러 개의 product_options[]<key>:<value> 포맷으로 추가합니다.
예시(Content-Type)
application/json:
"product_options": ["size:160", "color:white"]
application/x-www-form-urlencode:
product_options[]=size:160&product_options[]=color:white
created_at datetime(ISO 8601) 리뷰의 작성일. 초단위까지만 유효
message string 리뷰의 내용. HTML 태그를 제외한 내용만 입력해주세요.
score integer 별점을 입력하지 않으면 별점이 없는 상태의 리뷰가 등록되며, 별점 입력시 1~5 사이 값을 입력할 수 있습니다.
user_code string 리뷰 작성자 쇼핑몰 아이디. 회원이 작성한 리뷰는 필수로 입력해야하고, 비회원이 작성한 리뷰의 경우 입력하지 않아도 됩니다.
user_name string 리뷰 작성자 이름
image_urls array 리뷰의 첨부파일 주소. array 형태로 입력합니다. 최대 4개까지 등록 가능합니다. 이미지가 없다면 보내지 않아도 됩니다. 이미지는 비동기로 저장돼 응답값에 즉각 반영되지 않습니다.
display boolean 리뷰 진열 여부. 리뷰 진열이면 1, 미진열이면 0을 넘겨주세요. 아무것도 입력하지 않으면 진열로 처리됩니다.
options array 리뷰 추가입력 항목을 array of hashes 형태로 받습니다. 각 hash는 다음과 같은 값을 필수로 포함 하여야 합니다:
  • review_option_type_id: integer. 리뷰 추가입력 항목 타입의 id
  • created_at: datetime(ISO 8601). 리뷰 추가입력 항목의 생성일
  • value: string. 리뷰 추가입력 항목의 값.
다음 값은 필수가 아니어도 됩니다:
  • code: string. 리뷰 추가입력 항목의 고유 식별자
추가 수집정보 v2를 사용하는 쇼핑몰에서는 사용할 수 없는 파라미터입니다. (추후 개발 예정)
review_source_url string 리뷰의 소셜 원본 주소. Instagram, Youtube, Vimeo, Naver Blog, Naver Cafe 를 지원합니다.
tag_name string 리뷰의 태그 이름

Response

HTTP/1.1 201 Created
Location: https://api.cre.ma/v1/reviews
{
  "id": 213,
  "code": "board1_123",
  "display": true,
  "product_id": 18794,
  "product_code": 119111,
  "user_code": "thecrema",
  "user_name": "크리마",
  "message": "너무이뻐용\n스커트에도 어울릴듯하고 바지에도이쁘고 만족스러운 후기입니당^^",
  "review_type": "video&photo",
  "images_count": 1,
  "images": [
    {
      "url": "http://assets.cre.ma/p/crema-me/reviews/00/00/00/02/13/image1/a21387c475095732.jpg",
      "width": 480,
      "height": 640,
      "gallery_url": "http://assets.cre.ma/p/crema-me/reviews/00/00/00/02/13/image1/gallery_a21387c475095732.jpg",
      "gallery_width": 256,
      "gallery_height": 341,
      "portrait_url": "http://assets.cre.ma/p/crema-me/reviews/00/00/00/02/13/image1/portrait_a21387c475095732.jpg",
      "portrait_width": 215,
      "portrait_height": 237,
      "thumbnail_url": "http://assets.cre.ma/p/crema-me/reviews/00/00/00/02/13/image1/thumbnail_a21387c475095732.jpg",
      "thumbnail_width": 128,
      "thumbnail_height": 128
    }
  ],
  "videos_count": 1,
  "video_urls": ["https://crema.mp4"],
  "videos": [
    {
      "sd_url": "https://crema_sd.mp4"
    }
  ],
  "score": 5,
  "comments": [],
  "likes_count": 4,
  "created_at": "2020-11-09T23:06:19.000+09:00",
  "updated_at": "2020-12-11T09:28:07.000+09:00",
  "options": [
    {
      "id": 1,
      "review_id": 213,
      "review_option_type_id": 1,
      "value": "159",
      "created_at": "2014-12-01T16:12:00.000+09:00",
      "updated_at": "2014-12-01T16:12:00.000+09:00"
    }
  ],
  "product_options": {
    "색상": "블랙",
    "사이즈": "L"
  },
  "tag_name": "베스트 리뷰"
}

Update a review

리뷰의 내용을 수정합니다.

with id

PATCH /v1/reviews/:id HTTP/1.1
이름 타입 필수 설명
id integer 리뷰의 id. 크리마 서비스측 고유 식별자입니다. 다른 리뷰와 중복되면 안됩니다.
product_id integer 리뷰가 속한 상품의 크리마 서비스측 id(쇼핑몰 서비스측 ID 아님). product_code를 입력한 경우 product_id는 입력하지 않아도 됩니다.
product_code string 리뷰가 속한 상품의 쇼핑몰 서비스측 고유 식별자. product_id를 입력한 경우 product_code는 입력하지 않아도 됩니다.
product_options array 주문상품 구매 옵션. 여러 개의 product_options[]<key>:<value> 포맷으로 추가합니다.
예시(Content-Type)
application/json:
"product_options": ["size:160", "color:white"]
application/x-www-form-urlencode:
product_options[]=size:160&product_options[]=color:white
created_at datetime(ISO 8601) 리뷰의 생성일. 초단위까지만 유효
message string 리뷰의 내용. HTML 태그를 제외한 내용만 입력해주세요.
score integer 빈값을 입력하면 별점이 없는 상태로 리뷰가 갱신되며, 별점 입력시 1~5 사이 값을 입력할 수 있습니다.
user_code string 리뷰 작성자 쇼핑몰 아이디
user_name string 리뷰 작성자 이름
image_urls array 리뷰의 첨부파일 주소. array 형태로 입력합니다. 최대 4개까지 등록 가능합니다. 이미지가 없다면 보내지 않아도 됩니다.
display boolean 리뷰 진열 여부. 리뷰 진열이면 1, 미진열이면 0을 넘겨주세요. 아무것도 입력하지 않으면 진열로 처리됩니다.
options array 리뷰 추가입력 항목을 array of hashes 형태로 받습니다. 각 hash는 다음과 같은 값을 필수로 포함 하여야 합니다:
  • review_option_type_id: integer. 리뷰 추가입력 항목 타입의 id
  • 크리마 관리자 > 리뷰 > 리뷰 설정 중 '추가 정보'에서 review_option_type_id를 확인할 수 있습니다.
  • created_at: datetime(ISO 8601). 리뷰 추가입력 항목의 생성일
  • value: string. 리뷰 추가입력 항목의 값.
다음 값은 필수가 아니어도 됩니다:
  • code: string. 리뷰 추가입력 항목의 고유 식별자

with code

PATCH /v1/reviews HTTP/1.1
이름 타입 필수 설명
code string 리뷰의 code. 쇼핑몰 서비스측 고유 식별자입니다. 다른 리뷰와 중복되면 안됩니다.
product_id integer 리뷰가 속한 상품의 크리마 서비스측 id(쇼핑몰 서비스측 ID 아님). product_code를 입력한 경우 product_id는 입력하지 않아도 됩니다.
product_code string 리뷰가 속한 상품의 쇼핑몰 서비스측 고유 식별자. product_id를 입력한 경우 product_code는 입력하지 않아도 됩니다.
created_at datetime(ISO 8601) 리뷰의 생성일. 초단위까지만 유효
message string 리뷰의 내용. HTML 태그를 제외한 내용만 입력해주세요.
score integer 리뷰의 평점 1~5 값을 가집니다.
user_code string 리뷰 작성자 쇼핑몰 아이디
user_name string 리뷰 작성자 이름
image_urls array 리뷰의 첨부파일 주소. array 형태로 입력합니다. 최대 4개까지 등록 가능합니다. 이미지가 없다면 보내지 않아도 됩니다.
display boolean 리뷰 진열 여부. 리뷰 진열이면 1, 미진열이면 0을 넘겨주세요. 아무것도 입력하지 않으면 진열로 처리됩니다.
options array 리뷰 추가입력 항목을 array of hashes 형태로 받습니다. 각 hash는 다음과 같은 값을 필수로 포함 하여야 합니다:
  • review_option_type_id: integer. 리뷰 추가입력 항목 타입의 id
  • created_at: datetime(ISO 8601). 리뷰 추가입력 항목의 생성일
  • value: string. 리뷰 추가입력 항목의 값.
다음 값은 필수가 아니어도 됩니다:
  • code: string. 리뷰 추가입력 항목의 고유 식별자

Response

HTTP/1.1 204 No Content
Location: https://api.cre.ma/v1/reviews/:id

Delete a single review

리뷰 한 개를 삭제합니다. 삭제 후에는 복구가 불가능합니다.
제휴사의 경우, 해당 제휴사의 API user 계정이 Review API를 통해 생성한 데이터만 삭제가 가능합니다.

with id

DELETE /v1/reviews/:id HTTP/1.1
이름 타입 필수 설명
id integer 리뷰의 id

with code

DELETE /v1/reviews HTTP/1.1
이름 타입 필수 설명
code string 리뷰의 code

Response

HTTP/1.1 204 No Content

Example (Ruby)

require 'curl'
require 'json'

# access_token 값 얻기
c = Curl::Easy.new('https://api.cre.ma/oauth/token')
c.http_post(
  Curl::PostField.content('grant_type', 'client_credentials'),
  Curl::PostField.content('client_id', ENV['CREMA_APP_ID']),
  Curl::PostField.content('client_secret', ENV['CREMA_SECRET'])
)
access_token = JSON.parse(c.body_str)['access_token']

# 리뷰 추가
c = Curl::Easy.new('https://api.cre.ma/v1/reviews')
c.http_post(
  Curl::PostField.content('access_token', access_token),
  Curl::PostField.content('code', '13'),
  Curl::PostField.content('product_id', 1),
  Curl::PostField.content('created_at', Time.zone.new(2015, 3, 4, 16, 12, 0)),
  Curl::PostField.content('message', 'TEST REVIEW!!!'),
  Curl::PostField.content('score', 4),
  Curl::PostField.content('user_code', 'thecrema'),
  Curl::PostField.content('user_name', 'crema'),
  Curl::PostField.content('image_urls[]', 'http://img.sampleshop.com/files/goods/23881/1424768729_0.jpg'),
  Curl::PostField.content('image_urls[]', 'http://img.sampleshop.com/files/goods/22302/1414553823_0.jpg')
)
# 쇼핑몰 DB 리뷰 테이블에 컬럼을 하나 추가하시어 해당 리뷰에 이 값을 저장해주세요.
review_id = JSON.parse(c.body_str)['id']

# 리뷰 메시지 변경
Curl.put("https://api.cre.ma/v1/reviews/#{review_id}?access_token=#{access_token}&message=TEST")

# 리뷰 삭제
Curl.delete("https://api.cre.ma/v1/reviews/#{review_id}?access_token=#{access_token}")

Example (PHP)

<?
$curl = curl_init();
$data = http_build_query(array(
  "grant_type" => "client_credentials",
  "client_id" => CREMA_APP_ID,
  "client_secret" => CREMA_SECRET
));
curl_setopt ($curl, CURLOPT_URL, "https://api.cre.ma/oauth/token");
curl_setopt ($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt ($curl, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($curl);
$access_token = json_decode($response) -> {'access_token'};

$url = "https://api.cre.ma/v1/reviews";

$post_data["access_token"] = $access_token;
$post_data["code"] = "2983";
$post_data["product_code"] = "2364";
$post_data["created_at"] = "2018-03-27T22:27:47+0900";
$post_data["message"] = "아주 좋아요";
$post_data["score"] = "5";
$post_data["user_name"] = "크리마";
$post_data["user_code"] = "thecrema";
$options = array();
$options[] = array("code" => "2000", "review_option_type_id" => "1", "created_at" => "2018-03-27T22:27:47+0900", "value" => "20대");
$options[] = array("code" => "2001", "review_option_type_id" => "2", "created_at" => "2018-03-27T22:27:47+0900", "value" => "민감피부");
$post_data["options[]"] = $options;

$data = http_build_query($post_data);
$data = preg_replace("/%5B(\d+)%5D/", "", $data);
$data = preg_replace("/%5Bvalues%5D/", "%5Bvalues%5D%5B%5D", $data);

$curl = curl_init();
curl_setopt ($curl, CURLOPT_URL, $url);
curl_setopt ($curl, CURLOPT_POST, 1);
curl_setopt ($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt ($curl, CURLOPT_POSTFIELDSIZE, 0);
curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);

$result = curl_exec($curl);
var_dump($result);

print_r(curl_getinfo($curl));
?>

직접 사용해 보세요!

API Explorer를 사용하여 API 요청 및 응답을 확인해 보세요.

결과