メインコンテンツまでスキップ

REST API クエリ検索

このページでは、GET /api/apps/{appsId}/recordsquery パラメータの仕様を確認できます。

クエリとは

query は、レコード一覧取得時の絞り込み条件・並び順・取得範囲を1つの文字列で指定するためのパラメータです。

GET /api/apps/10/records?query=status%20%3D%20%22完了%22

クエリの書き方

基本構文

フィールド識別名 演算子 値

論理演算子と括弧

  • and
  • or
  • ( )

例:

(status = "完了" or status = "進行中") and priority = "高"

比較演算子

共通

  • =
  • != (<> も使用可。内部で != に正規化)
  • is null
  • is not null
  • is emptyis null と同義)
  • is not emptyis not null と同義)

数値・日付系

  • >
  • >=
  • <
  • <=
  • between ... and ...
  • not between ... and ...

複数値

  • in (...)
  • not in (...)

IN / NOT IN は括弧が必須です。

例:

status in ("未着手", "進行中")
amount not in (0, 1)

文字列検索

  • like
  • not like
  • ilike
  • not ilike

ilike / not ilike は曖昧検索(全角半角、かな、大小文字の差を吸収)です。

例:

name ilike "%山田%"
title not like "下書き"

ALL()(like / ilike専用)

like / ilike の値として ALL(...) を使うと、複数語のAND検索ができます。

例:

description like ALL("予算", "承認")

関数

フィールド修飾関数

  • REPLACE(field, "from", "to")
  • LOWER(field)
  • UPPER(field)
  • DATE_TRUNC(field, "unit")
  • DATE_PART(field, "unit")

例:

REPLACE(phone, "-", "") like "%09012345678%"
LOWER(code) = "abc-001"
DATE_TRUNC(createdAt, "day") = "2026-01-20"
DATE_PART(updatedAt, "hour") = 9

DATE_TRUNC の unit:

  • second, minute, hour, day, week, month, quarter, year

DATE_PART の unit:

  • second, minute, hour, day, dow, doy, week, month, quarter, year

相対日付関数

  • TODAY()
  • YESTERDAY()
  • TOMORROW()
  • NOW()
  • WEEK_START()
  • WEEK_END()
  • MONTH_START()
  • MONTH_END()
  • YEAR_START()
  • YEAR_END()

例:

TODAY()-7days
WEEK_START()+1day
NOW()-3hours+30minutes
date_trunc(NOW()-1hours, "hour")

+ をURLに含める場合は %2B を使用してください。

相対ユーザー関数

  • ME()
  • MY_CODE()
  • MY_ORG_CODE()
  • MY_MAIN_ORG() / MY_MAIN_ORG(true)
  • MY_ORG() / MY_ORG(true)

例:

user = ME()
creatorCode = MY_CODE()
department in (MY_ORG())

ソート・件数・開始位置

クエリ末尾で指定できます。

例:

... order by updatedAt desc limit 50 offset 100

注意:

  • order by は1フィールドのみ対応です。
  • query 内で order by / limit / offset を指定した場合、同名の通常クエリパラメータ(order / limit / page)より優先されます。
  • offset は内部的に page = floor(offset / limit) + 1 として扱われます。

システムフィールド

query では次のエイリアスが使用できます。

  • recordId
  • uniqueId
  • status
  • createdAt
  • updatedAt
  • creator
  • updater
  • creatorCode
  • updaterCode

フィールドタイプごとの演算子対応

フィールドタイプ利用可能な演算子
テキスト=, !=, like, not like, ilike, not ilike, in, not in, is null, is not null
複数行テキスト=, !=, like, not like, ilike, not ilike, is null, is not null
添付ファイル=, !=, like, not like, ilike, not ilike, is null, is not null
メールアドレス=, !=, like, not like, ilike, not ilike, in, not in, is null, is not null
識別名=, !=, like, not like, ilike, not ilike, in, not in
登録者社員番号=, !=, like, not like, ilike, not ilike, in, not in
更新者社員番号=, !=, like, not like, ilike, not ilike, in, not in
登録者名=, !=, like, not like, ilike, not ilike, in, not in
更新者名=, !=, like, not like, ilike, not ilike, in, not in
数値=, !=, >, >=, <, <=, in, not in, between, not between, is null, is not null
計算=, !=, >, >=, <, <=, in, not in, between, not between
自動採番=, !=, >, >=, <, <=, in, not in, between, not between
明細=, !=, >, >=, <, <=, in, not in
レコードID=, !=, >, >=, <, <=, in, not in, between, not between
単一選択=, !=, in, not in, is null, is not null
ラジオボタン=, !=, in, not in
複数選択=, !=, in, not in, is null, is not null
チェックボックス=, !=, in, not in, is null, is not null
ステータス=, !=, in, not in
日付=, !=, >, >=, <, <=, between, not between, is null, is not null
日時=, !=, >, >=, <, <=, between, not between, is null, is not null
時間=, !=, >, >=, <, <=, between, not between, is null, is not null
日付期間=, !=, >, >=, <, <=, between, not between, is null, is not null
日時期間=, !=, >, >=, <, <=, between, not between, is null, is not null
時間期間=, !=, >, >=, <, <=, between, not between, is null, is not null
登録日時=, !=, >, >=, <, <=, between, not between
更新日時=, !=, >, >=, <, <=, between, not between
利用者選択=, !=, in, not in, is null, is not null
組織選択=, !=, in, not in, is null, is not null
有/無=, !=
連携項目=, !=, >, >=, <, <=, in, not in, like, not like, ilike, not ilike, between, not between, is null, is not null

不正な組み合わせは 400 Bad Request になります。

関数利用制限

相対ユーザー関数

  • ME(): 利用者選択のみ
  • MY_CODE(): テキスト、creatorCodeupdaterCodeのみ
  • MY_ORG_CODE(): テキストのみ
  • MY_MAIN_ORG() / MY_MAIN_ORG(true) / MY_ORG() / MY_ORG(true): 組織選択のみ

REPLACE / LOWER / UPPER

利用可能: テキスト、複数行テキスト、自動採番、メールアドレス、登録者名、更新者名

DATE_TRUNC / DATE_PART

利用可能: 日付、日時、時間、登録日時、更新日時

よく使う例

# 完了レコードのみ
status = "完了"

# 複合条件 + ソート + ページング
(status = "完了" or status = "進行中") and updatedAt >= TODAY()-30days order by updatedAt desc limit 100 offset 0

# 月単位で比較
DATE_TRUNC(createdAt, "month") = "2026-01-01"

# 担当者が自分
assignee = ME()

# 組織配下を含む検索
department in (MY_ORG(true))

エラー時の挙動

  • 構文エラー、未対応関数、型不一致、使用不可の演算子は 400 Bad Request になります。
  • 例: IN の括弧欠落、DATE_TRUNC のunit不正、許可されないフィールド型での関数利用など。