찬찬의 Notion API 정복기 14 - API 집중분석 - Retrieve a page property Item

소찬 (Chan)·2022년 10월 11일
0
post-thumbnail

Reference API URL : Retrieve a page property item

API 집중분석 - Retrieve a page에도 일부 언급되어 있지만, 여기서도 한번 더 짚고 넘어가보려고 합니다.

notion.pages.properties.retrieve(page_id='1f217cc1-225f-4580-8e22-cd7eb8db3c5e',
                                 property_id='%3EQQn')

page_id 는 알겠는데, 과연 property_id 는 무엇인가?
properties를 한번 살펴보겠습니다.

'properties': {'상태': {'id': '%3EQQn',
                      'select': {'color': 'orange',
                                 'id': 'ed26ef07-df97-4ced-9275-9aa0c71d5bb1',
                                 'name': '★★'},
                      'type': 'select'},
               '이름': {'id': 'title',
                       'title': [{'annotations': {'bold': False,
                                                  'code': False,
                                                  'color': 'default',
                                                  'italic': False,
                                                  'strikethrough': False,
                                                  'underline': False},
                                  'href': None,
                                  'plain_text': '옐로우피자',
                                  'text': {'content': '옐로우피자',
                                           'link': None},
                                           'type': 'text'}],
                       'type': 'title'}}

여기서 저희가 식별할 수 있는 id 가 두가지입니다. 하나는 '%3EQQn', 하나는 'title' 입니다.
property 식별 id를 property_id로 부릅니다.

호출 방법입니다.

notion.pages.properties.retrieve(page_id='1f217cc1-225f-4580-8e22-cd7eb8db3c5e',
                                 property_id='%3EQQn')

위와 같이 호출하니까 다음과 같이 나왔습니다.

{'id': '%3EQQn',
 'object': 'property_item',
 'select': {'color': 'red',
            'id': '38c1a71b-fd4d-4353-858b-646d8305332a',
            'name': '★★★★★★'},
 'type': 'select'}

해당 propertyid의 정보값만 보여줍니다.

  • page_size (int32)
    For paginated properties. The max number of property item objects on a page. The default size is 100
    한번에 몇 건을 조회에 올지 정하실 수 있습니다. 입력을 따로 안할시에는 최대 100건을 조회해 옵니다.

  • start_cursor (string)
    For paginated properties.
    has_more : True 로 넘어오는 경우는, next_cursor 값도 같이 응답해줍니다.

 'has_more': True,
 'next_cursor': 'XYVaKx',
 'object': 'list',
 'property_item': {'id': 'qgqA',
                   'next_url': ...

start_cursornext_cursor 값을 넣어서 retrieve를 다시 호출해주시면, 이어서 조회가 가능합니다.

profile
QA Specialist

0개의 댓글