sayren Docs
컬렉션

컬렉션 수정

준 항목만 바뀐다. 유형은 바꿀 수 없다(400 `COLLECTION_TYPE_IMMUTABLE`). 조건 자동은 `rules`로 조건을 통째로 바꾼다. 본문에 읽은 `revision`을 주면 그 사이 다른 수정이 있었을 때 409 `COLLECTION_CHANGED`다. 성공하면 `revision`이 1 오른다

PATCH
/v1/collections/{collectionId}

준 항목만 바뀐다. 유형은 바꿀 수 없다(400 COLLECTION_TYPE_IMMUTABLE). 조건 자동은 rules로 조건을 통째로 바꾼다. 본문에 읽은 revision을 주면 그 사이 다른 수정이 있었을 때 409 COLLECTION_CHANGED다. 성공하면 revision이 1 오른다

Authorization

accessToken
headerAuthorizationBearer <token>

Sayren 계정 토큰(로그인 토큰 또는 개인 액세스 토큰, RFC 9068 JWT)

Path Parameters

collectionId*string

Header Parameters

X-Store-Id*string

대상 상점 id. 토큰의 상점 범위 밖이면 403 STORE_NOT_GRANTED, 없으면 400 STORE_ID_REQUIRED다

Request Body

application/json
  1. body
title?string
Length1 <= length <= 60
slug?string

주소. 영문 소문자·숫자·하이픈 64자까지, 상점 안에서 유일하다(겹치면 409 COLLECTION_SLUG_TAKEN)

Match^[a-z0-9][a-z0-9-]{0,63}$
type?string

바꿀 수 없다. 주면 400 COLLECTION_TYPE_IMMUTABLE

rules?array<||||>

조건 자동 컬렉션의 조건을 통째로 바꾼다. 직접 선택 컬렉션에 주면 400 COLLECTION_RULES_NOT_ALLOWED

Items1 <= items <= 10
description?string

설명(텍스트)

Lengthlength <= 500
imageUrl?|

대표 이미지 주소. https만 받는다

Formaturi
Lengthlength <= 2048
productSort?string

스토어프론트 상품 기본 정렬. MANUAL(직접 정한 순서)·LATEST(최신순)·BEST_SELLING(판매량순)·PRICE_ASC·PRICE_DESC·REVIEW_COUNT·RATING_DESC·RECOMMEND(추천순). 판매량순의 기간은 판매량 상위 조건의 기간이고, 조건이 없으면 최근 30일이다

Value in"MANUAL""LATEST""BEST_SELLING""PRICE_ASC""PRICE_DESC""REVIEW_COUNT""RATING_DESC""RECOMMEND"
visible?boolean

노출 여부

startsAt?|

노출 시작 시각(ISO 8601, 시간대 포함). null이면 바로 노출한다

Match^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
Formatdate-time
endsAt?|

노출 종료 시각(ISO 8601, 시간대 포함). null이면 끝나지 않는다

Match^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
Formatdate-time
sortOrder?integer

목록 순서(작을수록 앞)

Range0 <= value <= 1000000
metaTitle?|

검색 결과 제목

Lengthlength <= 60
metaDescription?|

검색 결과 설명

Lengthlength <= 160
revision?integer

읽은 수정 번호

Range0 <= value

Response Body

성공

application/json
  1. response
meta*
data*
error*|null
curl -X PATCH 'https://api.sayren.io/v1/collections/string' \  -H 'X-Store-Id: string' \  -H 'Content-Type: application/json' \  -d '{}'
{  "meta": {    "status": 200,    "code": "OK",    "message": "OK",    "isSuccess": true  },  "data": {    "collectionId": "string",    "type": "string",    "title": "string",    "slug": "string",    "description": "string",    "imageUrl": "string",    "productSort": "string",    "rules": [      {        "field": "createdWithinDays",        "value": 1      }    ],    "visible": true,    "startsAt": "string",    "endsAt": "string",    "sortOrder": 0,    "metaTitle": "string",    "metaDescription": "string",    "state": "ACTIVE",    "salesComputedAt": null,    "productCount": 0,    "revision": 0,    "createdAt": "string",    "updatedAt": "string"  },  "error": null}