API 參考

整合 API v1

每個端點的方法、範圍、參數、回傳和錯誤,從 openapi.json 產生。位址是 https://cms.drmn.app/api/integrations/v1,每個請求都帶 Authorization: Bearer dcmi_…。欄位說明取自 OpenAPI,是英文。

列出可以播放的媒體,新的在前

GET/media範圍 media:read

Needs the media:read scope. With media:files too, each media item carries fileUrl.

參數

名稱位置型別說明
cursor查詢stringThe nextCursor of the previous page.
limit查詢integer1–200, 預設 50
tag查詢string (uuid)[]A tag id from GET /tags. Repeat it to require every tag listed.
q查詢stringMatches the media's name or description, ignoring case. (最多 200 字)
externalUid查詢stringThe media your system knows by this id (externalRef.uid), among this token's outside system type only. Needs a token with an outside system type: without one, 422 with code provider_type_missing. (最多 200 字)

範例

curl -s https://cms.drmn.app/api/integrations/v1/media \
  -H "Authorization: Bearer $DRMN_INTEGRATION_TOKEN"

回傳 200 MediaPage

欄位型別說明
itemsMedia[]必填
nextCursorstring | null必填Pass as cursor for the next page; null on the last page.
{
  "items": [
    {
      "id": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
      "name": "Autumn menu",
      "type": "image",
      "width": 1920,
      "height": 1080,
      "durationSeconds": 15,
      "tags": [
        {
          "id": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
          "name": "Autumn menu"
        }
      ],
      "externalRefs": [
        {
          "providerType": "Autumn",
          "uid": "Autumn",
          "name": "Autumn menu",
          "url": "https://…",
          "meta": {
            "content-type": "image/jpeg",
            "content-length": "245760"
          },
          "syncedAt": "2026-10-17T08:00:00.000Z"
        }
      ],
      "thumbnailUrl": "https://…",
      "createdAt": "2026-10-17T08:00:00.000Z",
      "fileUrl": "https://…"
    }
  ],
  "nextCursor": null
}

錯誤

狀態什麼時候
400 Bad RequestA query parameter is not valid.
401 UnauthorizedThe token is missing, unknown, expired or revoked, or its merchant is suspended or its plan has ended, or its partner is paused or suspended.
403 ForbiddenThe token lacks the scope this endpoint needs (the message names it), or, for a token not bound to a partner, the merchant's plan does not include DRMN Ads (code: plan).
429 Too Many RequestsMore than 120 requests in a minute with this token.

單一媒體

GET/media/{id}範圍 media:read

Needs the media:read scope. With media:files too, each media item carries fileUrl.

參數

名稱位置型別說明
id路徑(必填)string (uuid)A media id.

範例

curl -s https://cms.drmn.app/api/integrations/v1/media/0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f \
  -H "Authorization: Bearer $DRMN_INTEGRATION_TOKEN"

回傳 200 Media

欄位型別說明
idstring (uuid)必填
namestring必填
type"image" | "video" | "web"必填
widthinteger | null必填Pixels; null when unknown (and for web pages).
heightinteger | null必填Pixels; null when unknown (and for web pages).
durationSecondsnumber | null必填A video's length; null for images and web pages.
tagsTag[]必填
externalRefsExternalRef[]必填Where the item came from outside the CMS; empty for media added in the CMS.
thumbnailUrlstring (uri) | null必填A signed URL that stops working 15 minutes after the response; null when there is no thumbnail.
createdAtstring (date-time)必填
fileUrlstring (uri) | null選填Only with the media:files scope. The file itself: a signed URL that stops working 15 minutes after the response, or a web page's own address. Absent without that scope.
{
  "id": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
  "name": "Autumn menu",
  "type": "image",
  "width": 1920,
  "height": 1080,
  "durationSeconds": 15,
  "tags": [
    {
      "id": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
      "name": "Autumn menu"
    }
  ],
  "externalRefs": [
    {
      "providerType": "Autumn",
      "uid": "Autumn",
      "name": "Autumn menu",
      "url": "https://…",
      "meta": {
        "content-type": "image/jpeg",
        "content-length": "245760"
      },
      "syncedAt": "2026-10-17T08:00:00.000Z"
    }
  ],
  "thumbnailUrl": "https://…",
  "createdAt": "2026-10-17T08:00:00.000Z",
  "fileUrl": "https://…"
}

錯誤

狀態什麼時候
401 UnauthorizedThe token is missing, unknown, expired or revoked, or its merchant is suspended or its plan has ended, or its partner is paused or suspended.
403 ForbiddenThe token lacks the scope this endpoint needs (the message names it), or, for a token not bound to a partner, the merchant's plan does not include DRMN Ads (code: plan).
404 Not FoundNo such item in the token's merchant.
429 Too Many RequestsMore than 120 requests in a minute with this token.

列出活動(不含已封存),最近修改的在前

GET/campaigns範圍 campaigns:read

Needs the campaigns:read scope.

參數

名稱位置型別說明
cursor查詢stringThe nextCursor of the previous page.
limit查詢integer1–200, 預設 50
tag查詢string (uuid)[]A tag id from GET /tags. Repeat it to require every tag listed.
q查詢stringMatches the campaign's name, ignoring case. (最多 200 字)

範例

curl -s https://cms.drmn.app/api/integrations/v1/campaigns \
  -H "Authorization: Bearer $DRMN_INTEGRATION_TOKEN"

回傳 200 CampaignPage

欄位型別說明
itemsCampaign[]必填
nextCursorstring | null必填Pass as cursor for the next page; null on the last page.
{
  "items": [
    {
      "lineageId": "0192f0c4-1b2c-7d3e-8f4a-5b6c7d8e9f0a",
      "name": "Autumn menu",
      "status": "running",
      "flight": {
        "start": "Autumn",
        "end": "Autumn"
      },
      "tags": [
        {
          "id": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
          "name": "Autumn menu"
        }
      ]
    }
  ],
  "nextCursor": null
}

錯誤

狀態什麼時候
400 Bad RequestA query parameter is not valid.
401 UnauthorizedThe token is missing, unknown, expired or revoked, or its merchant is suspended or its plan has ended, or its partner is paused or suspended.
403 ForbiddenThe token lacks the scope this endpoint needs (the message names it), or, for a token not bound to a partner, the merchant's plan does not include DRMN Ads (code: plan).
429 Too Many RequestsMore than 120 requests in a minute with this token.

單一活動,以及它播放的媒體

GET/campaigns/{lineageId}範圍 campaigns:read

Needs the campaigns:read scope.

參數

名稱位置型別說明
lineageId路徑(必填)string (uuid)A campaign's lineage id.

範例

curl -s https://cms.drmn.app/api/integrations/v1/campaigns/0192f0c4-1b2c-7d3e-8f4a-5b6c7d8e9f0a \
  -H "Authorization: Bearer $DRMN_INTEGRATION_TOKEN"

回傳 200 CampaignDetail

欄位型別說明
lineageIdstring (uuid)必填The campaign's stable id: it stays the same across versions.
namestring必填
status"running" | "upcoming" | "draft" | "ended" | "withdrawn"必填running, upcoming or ended while live; else draft (never published) or withdrawn.
flightobject必填The live version's flight, else the newest version's.
tagsTag[]必填
mediaIdsstring (uuid)[]必填The media the live version plays (landscape and portrait), in play order, each once; empty when nothing is live.
contentobject | null必填The live version's content in play order; null when nothing is live.
{
  "lineageId": "0192f0c4-1b2c-7d3e-8f4a-5b6c7d8e9f0a",
  "name": "Autumn menu",
  "status": "running",
  "flight": {
    "start": "Autumn",
    "end": "Autumn"
  },
  "tags": [
    {
      "id": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
      "name": "Autumn menu"
    }
  ],
  "mediaIds": [
    "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f"
  ],
  "content": {
    "landscape": {
      "playlistId": "0192f0c4-2c3d-7e4f-9a5b-6c7d8e9f0a1b",
      "items": [
        {
          "mediaId": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
          "type": "image",
          "durationSeconds": 15
        }
      ]
    },
    "portrait": null
  }
}

錯誤

狀態什麼時候
401 UnauthorizedThe token is missing, unknown, expired or revoked, or its merchant is suspended or its plan has ended, or its partner is paused or suspended.
403 ForbiddenThe token lacks the scope this endpoint needs (the message names it), or, for a token not bound to a partner, the merchant's plan does not include DRMN Ads (code: plan).
404 Not FoundNo such item in the token's merchant.
429 Too Many RequestsMore than 120 requests in a minute with this token.

列出共用的播放清單,最近修改的在前

GET/playlists範圍 playlists:read

Needs the playlists:read scope.

參數

名稱位置型別說明
cursor查詢stringThe nextCursor of the previous page.
limit查詢integer1–200, 預設 50
q查詢stringMatches the playlist's name, ignoring case. (最多 200 字)

範例

curl -s https://cms.drmn.app/api/integrations/v1/playlists \
  -H "Authorization: Bearer $DRMN_INTEGRATION_TOKEN"

回傳 200 PlaylistPage

欄位型別說明
itemsPlaylist[]必填
nextCursorstring | null必填Pass as cursor for the next page; null on the last page.
{
  "items": [
    {
      "id": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
      "name": "Autumn menu",
      "createdAt": "2026-10-17T08:00:00.000Z",
      "updatedAt": "2026-10-17T08:00:00.000Z"
    }
  ],
  "nextCursor": null
}

錯誤

狀態什麼時候
400 Bad RequestA query parameter is not valid.
401 UnauthorizedThe token is missing, unknown, expired or revoked, or its merchant is suspended or its plan has ended, or its partner is paused or suspended.
403 ForbiddenThe token lacks the scope this endpoint needs (the message names it), or, for a token not bound to a partner, the merchant's plan does not include DRMN Ads (code: plan).
429 Too Many RequestsMore than 120 requests in a minute with this token.

單一播放清單,依播放順序列出項目

GET/playlists/{id}範圍 playlists:read

Needs the playlists:read scope.

參數

名稱位置型別說明
id路徑(必填)string (uuid)A playlist id, e.g. a campaign's content.landscape.playlistId.

範例

curl -s https://cms.drmn.app/api/integrations/v1/playlists/0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f \
  -H "Authorization: Bearer $DRMN_INTEGRATION_TOKEN"

回傳 200 PlaylistDetail

欄位型別說明
idstring (uuid)必填
namestring必填
createdAtstring (date-time)必填
updatedAtstring (date-time)必填
totalDurationSecondsnumber必填
itemsPlayItem[]必填In play order.
{
  "id": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
  "name": "Autumn menu",
  "createdAt": "2026-10-17T08:00:00.000Z",
  "updatedAt": "2026-10-17T08:00:00.000Z",
  "totalDurationSeconds": 45,
  "items": [
    {
      "mediaId": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
      "type": "image",
      "durationSeconds": 15
    }
  ]
}

錯誤

狀態什麼時候
401 UnauthorizedThe token is missing, unknown, expired or revoked, or its merchant is suspended or its plan has ended, or its partner is paused or suspended.
403 ForbiddenThe token lacks the scope this endpoint needs (the message names it), or, for a token not bound to a partner, the merchant's plan does not include DRMN Ads (code: plan).
404 Not FoundNo such item in the token's merchant.
429 Too Many RequestsMore than 120 requests in a minute with this token.

開始上傳一個檔案到媒體庫

POST/media/uploads範圍 media:write

Needs the media:write scope. Then PUT the file (and thumbnail) to the returned URLs and call finalize. An accessible exact file returns duplicateOf and nothing to upload. Partner-bound media:write does not require media:read: send externalRef and only reuse your own source items. Unbound tokens still need media:read.

請求內容 UploadRequest

欄位型別說明
idstring (uuid)必填Your id for this file, a UUID (v7 is best). Sending the same id again is a safe retry: it never adds a second item.
namestring必填The name shown in the media library. (最多 200 字)
fileNamestring必填最多 500 字
mimeTypestring必填image/jpeg, image/png, image/webp, video/mp4 or video/webm.
fileSizeinteger必填Bytes. Images up to 50 MB, videos up to 2 GB.
checksumstring必填The file's SHA-256, lower-case hex.
durationnumber | null選填A video's length in seconds.
widthinteger | null選填
heightinteger | null選填
hasThumbnailboolean選填True when you will PUT a JPEG thumbnail (480 px wide is best) too.
thumbnailSizeinteger | null選填The thumbnail's bytes, at most 1 MB; required with hasThumbnail.
codecstring | null選填A video's codec (h264, hevc, …); normalized and stored with the media item and used for compatibility warnings. (最多 50 字)
externalRefobject選填Records where the file comes from. Needs a token with an outside system type (Settings → Integrations). A uid already linked to a ready item returns that item as duplicateOf. Required for a partner uploading without media:read; such a partner may only reuse its own source items.

範例

curl -s -X POST https://cms.drmn.app/api/integrations/v1/media/uploads \
  -H "Authorization: Bearer $DRMN_INTEGRATION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"id":"0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f","name":"Autumn menu","fileName":"autumn-menu.jpg","mimeType":"image/jpeg","fileSize":245760,"checksum":"9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08","duration":15,"width":1920,"height":1080,"hasThumbnail":true,"thumbnailSize":18432,"codec":"h264","externalRef":{"uid":"Autumn","url":"https://…","meta":{"content-type":"image/jpeg","content-length":"245760"}}}'

回傳 200 UploadTicket

欄位型別說明
mediaIdstring (uuid)必填The item's id: yours, or the existing item's when duplicateOf is set.
duplicateOfobject | null必填Set when an accessible exact file already exists: nothing to upload or finalize, use mediaId. A partner without media:read only reuses its own source items.
uploadobject | null必填Where to PUT the file; null for a duplicate.
thumbnailUploadobject | null必填Where to PUT the thumbnail; null without one.
warningsobject[]必填Video compatibility warnings for the merchant's screens. Never blocking.
{
  "mediaId": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
  "duplicateOf": {
    "id": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
    "name": "Autumn menu",
    "type": "image"
  },
  "upload": null,
  "thumbnailUpload": null,
  "warnings": [
    {
      "code": "Autumn",
      "message": "This token does not have the media:write scope this endpoint needs."
    }
  ]
}

錯誤

狀態什麼時候
400 Bad RequestThe body is not valid JSON or not what this endpoint takes; the message names the fields.
401 UnauthorizedThe token is missing, unknown, expired or revoked, or its merchant is suspended or its plan has ended, or its partner is paused or suspended.
403 ForbiddenThe token lacks the scope this endpoint needs, or the merchant's plan does not allow it (code: plan): a token not bound to a partner needs a plan with DRMN Ads.
404 Not FoundA write-only partner named another buyer's upload id or external source uid.
409 Conflictcode: storage_quota_exceeded: the merchant's storage is full. code: id_conflict: the id is another item's.
413 Payload Too LargeThe body is larger than 16 KB.
422 UnprocessableThe file is not accepted: type, size, checksum or name; the message says which. A partner without media:read must send externalRef. code: provider_type_missing: externalRef was sent with a token that has no outside system type.
429 Too Many RequestsMore than 30 writes in a minute with this token (counted apart from reads).

完成上傳:素材變成可以播放

POST/media/uploads/{id}/finalize範圍 media:write

Needs the media:write scope. Checks that the file was stored with the declared size. Returns the item as GET /media/{id} does when media:read is granted. A write-only partner can only finalize its own source item and receives a receipt: tags and externalRefs are empty, thumbnailUrl is null, no fileUrl. Finalizing a ready own item again returns it.

參數

名稱位置型別說明
id路徑(必填)string (uuid)The mediaId from POST /media/uploads.

範例

curl -s -X POST https://cms.drmn.app/api/integrations/v1/media/uploads/0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f/finalize \
  -H "Authorization: Bearer $DRMN_INTEGRATION_TOKEN"

回傳 200 Media

欄位型別說明
idstring (uuid)必填
namestring必填
type"image" | "video" | "web"必填
widthinteger | null必填Pixels; null when unknown (and for web pages).
heightinteger | null必填Pixels; null when unknown (and for web pages).
durationSecondsnumber | null必填A video's length; null for images and web pages.
tagsTag[]必填
externalRefsExternalRef[]必填Where the item came from outside the CMS; empty for media added in the CMS.
thumbnailUrlstring (uri) | null必填A signed URL that stops working 15 minutes after the response; null when there is no thumbnail.
createdAtstring (date-time)必填
fileUrlstring (uri) | null選填Only with the media:files scope. The file itself: a signed URL that stops working 15 minutes after the response, or a web page's own address. Absent without that scope.
{
  "id": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
  "name": "Autumn menu",
  "type": "image",
  "width": 1920,
  "height": 1080,
  "durationSeconds": 15,
  "tags": [
    {
      "id": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
      "name": "Autumn menu"
    }
  ],
  "externalRefs": [
    {
      "providerType": "Autumn",
      "uid": "Autumn",
      "name": "Autumn menu",
      "url": "https://…",
      "meta": {
        "content-type": "image/jpeg",
        "content-length": "245760"
      },
      "syncedAt": "2026-10-17T08:00:00.000Z"
    }
  ],
  "thumbnailUrl": "https://…",
  "createdAt": "2026-10-17T08:00:00.000Z",
  "fileUrl": "https://…"
}

錯誤

狀態什麼時候
400 Bad RequestThe body is not valid JSON or not what this endpoint takes; the message names the fields.
401 UnauthorizedThe token is missing, unknown, expired or revoked, or its merchant is suspended or its plan has ended, or its partner is paused or suspended.
403 ForbiddenThe token lacks the scope this endpoint needs, or the merchant's plan does not allow it (code: plan): a token not bound to a partner needs a plan with DRMN Ads.
404 Not FoundNo such upload in the token's merchant or, for a write-only partner, outside its own source items.
413 Payload Too LargeThe body is larger than 16 KB.
422 UnprocessableThe file was not stored, or not with the declared size; PUT it again.
429 Too Many RequestsMore than 30 writes in a minute with this token (counted apart from reads).

替媒體加標籤

POST/media/{id}/tags範圍 tags:write

Needs the tags:write scope. Up to 10 names a call. Only adds: taking tags off is not offered. A bound partner without effective tags:read may tag only its own ready, undeleted uploaded media; no library reads are granted. Narrow partner writes atomically check the current target and both tag caps before committing tags, links or audits; their tags array is empty to avoid exposing library metadata. Ordinary integrations still need tags:read and keep canonical tag receipts. Repeated additions return added: 0.

參數

名稱位置型別說明
id路徑(必填)string (uuid)A media id.

請求內容 AddTagsRequest

欄位型別說明
addstring[]必填Tag names. A name the merchant already has (ignoring case and spacing) reuses that tag; others are created. (1–10 個)

範例

curl -s -X POST https://cms.drmn.app/api/integrations/v1/media/0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f/tags \
  -H "Authorization: Bearer $DRMN_INTEGRATION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"add":["Autumn","Group buy"]}'

回傳 200 AddTagsResult

欄位型別說明
mediaIdstring (uuid)必填
tagsTag[]必填The tags the names resolved to for a library-authorized integration; empty for a narrow partner's basic receipt.
addedinteger必填How many of them the item did not have yet.
{
  "mediaId": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
  "tags": [
    {
      "id": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
      "name": "Autumn menu"
    }
  ],
  "added": 1
}

錯誤

狀態什麼時候
400 Bad RequestThe body is not valid JSON or not what this endpoint takes; the message names the fields.
401 UnauthorizedThe token is missing, unknown, expired or revoked, or its merchant is suspended or its plan has ended, or its partner is paused or suspended.
403 ForbiddenThe token lacks the scope this endpoint needs, or the merchant's plan does not allow it (code: plan): a token not bound to a partner needs a plan with DRMN Ads.
404 Not FoundNo such media item in the token's merchant, or a narrow partner writer does not own a ready, undeleted upload with this id. No tags are created for a rejected target.
413 Payload Too LargeThe body is larger than 16 KB.
422 UnprocessableThe body asks to remove tags, or the item would have too many tags.
429 Too Many RequestsMore than 30 writes in a minute with this token (counted apart from reads).

依名稱列出標籤

GET/tags範圍 tags:read

Needs the tags:read scope.

參數

名稱位置型別說明
cursor查詢stringThe nextCursor of the previous page.
limit查詢integer1–200, 預設 50
q查詢stringMatches the tag's name, ignoring case. (最多 200 字)

範例

curl -s https://cms.drmn.app/api/integrations/v1/tags \
  -H "Authorization: Bearer $DRMN_INTEGRATION_TOKEN"

回傳 200 TagPage

欄位型別說明
itemsTag[]必填
nextCursorstring | null必填Pass as cursor for the next page; null on the last page.
{
  "items": [
    {
      "id": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
      "name": "Autumn menu"
    }
  ],
  "nextCursor": null
}

錯誤

狀態什麼時候
400 Bad RequestA query parameter is not valid.
401 UnauthorizedThe token is missing, unknown, expired or revoked, or its merchant is suspended or its plan has ended, or its partner is paused or suspended.
403 ForbiddenThe token lacks the scope this endpoint needs (the message names it), or, for a token not bound to a partner, the merchant's plan does not include DRMN Ads (code: plan).
429 Too Many RequestsMore than 120 requests in a minute with this token.

列出合作夥伴自己的預約,最早變動的在前

GET/bookings範圍 bookings:read

Needs the bookings:read scope.

參數

名稱位置型別說明
updatedSince查詢string (date-time)Only bookings changed after this time: poll with the last updatedAt you saw.
cursor查詢stringThe nextCursor of the previous page.
limit查詢integer1–100, 預設 50

範例

curl -s https://cms.drmn.app/api/integrations/v1/bookings \
  -H "Authorization: Bearer $DRMN_INTEGRATION_TOKEN"

回傳 200 BookingPage

欄位型別說明
itemsBooking[]必填
nextCursorstring | null必填
{
  "items": [
    {
      "id": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
      "ref": "Autumn",
      "name": "Autumn menu",
      "status": "pending",
      "state": "requested",
      "changePending": false,
      "statusReason": "Autumn",
      "reviews": {
        "platform": null,
        "merchant": null
      },
      "liveVersion": 1,
      "flight": {
        "start": "Autumn",
        "end": "Autumn"
      },
      "updatedAt": "Autumn"
    }
  ],
  "nextCursor": null
}

錯誤

狀態什麼時候
400 Bad RequestA query parameter is not valid.
401 UnauthorizedThe token is missing, unknown, expired or revoked, or its merchant is suspended or its plan has ended, or its partner is paused or suspended.
403 ForbiddenThe token lacks the scope this endpoint needs (the message names it), or, for a token not bound to a partner, the merchant's plan does not include DRMN Ads (code: plan).
429 Too Many RequestsMore than 120 requests in a minute with this token.

合作夥伴自己的單一預約

GET/bookings/{ref}範圍 bookings:read

Needs the bookings:read scope.

參數

名稱位置型別說明
ref路徑(必填)stringThe partner's own id for the booking (the EC's group-buy id).

範例

curl -s https://cms.drmn.app/api/integrations/v1/bookings/0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f \
  -H "Authorization: Bearer $DRMN_INTEGRATION_TOKEN"

回傳 200 Booking

欄位型別說明
idstring (uuid)必填
refstring必填
namestring必填
status"pending" | "approved" | "rejected" | "cancelled" | "withdrawn"必填What is stored.
state"requested" | "in_review" | "rejected" | "scheduled" | "live" | "ended" | "cancelled" | "withdrawn"必填What it looks like now: approved bookings are scheduled, live or ended by their flight in the screens' time zones.
changePendingboolean必填An approved booking has a change waiting for review; the earlier version keeps playing.
statusReasonstring | null必填The merchant's rejection or withdrawal reason. For an approved booking, this can explain a refused change while the earlier version keeps playing.
reviewsobject必填
liveVersioninteger | null必填The version on screens; null when nothing plays.
flightobject | null必填
updatedAtstring必填
{
  "id": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
  "ref": "Autumn",
  "name": "Autumn menu",
  "status": "pending",
  "state": "requested",
  "changePending": false,
  "statusReason": "Autumn",
  "reviews": {
    "platform": null,
    "merchant": null
  },
  "liveVersion": 1,
  "flight": {
    "start": "Autumn",
    "end": "Autumn"
  },
  "updatedAt": "Autumn"
}

錯誤

狀態什麼時候
401 UnauthorizedThe token is missing, unknown, expired or revoked, or its merchant is suspended or its plan has ended, or its partner is paused or suspended.
403 ForbiddenThe token lacks the scope this endpoint needs (the message names it), or, for a token not bound to a partner, the merchant's plan does not include DRMN Ads (code: plan).
404 Not FoundNo such item in the token's merchant.
429 Too Many RequestsMore than 120 requests in a minute with this token.

宣告一筆預約:建立或修改

PUT/bookings/{ref}範圍 bookings:write

Needs the bookings:write scope. Send the whole booking every time: the same body again changes nothing. A new or changed booking waits for the merchant (state in_review) unless the merchant approves this partner automatically; a change that only takes away (fewer screens, a shorter flight, fewer plays or hours) goes on screens at once. Only a token bound to a partner.

參數

名稱位置型別說明
ref路徑(必填)stringThe partner's own id for the booking (the EC's group-buy id).

請求內容 BookingRequest

欄位型別說明
namestring必填最多 120 字
targetsobject選填Left out (or naming nothing) = every screen the merchant opened to you. Named targets reach only those of their screens the merchant opened to you; none left is a 422. At most 200 screens after intersection. Re-expanded at review and approval; a changed scope requires a fresh review hash. Published versions keep their screens.
flightobject必填Required, at most 93 days.
hoursobject[] | null選填When it may play each week; null or left out = all day.
saturationnumber選填Plays per loop, 0.1–10 in steps of 0.1; 1 when left out. (0.1–10)
playUnit"item" | "playlist"選填A web booking always plays as a playlist; item is refused on a sync group's screens.
mode"rotate"選填Only rotate in v1.
contentobject必填

範例

curl -s https://cms.drmn.app/api/integrations/v1/bookings/0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f \
  -H "Authorization: Bearer $DRMN_INTEGRATION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"Autumn menu","targets":{"locationIds":["0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f"],"screenRefs":["Autumn"],"tagIds":["0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f"],"orientation":"landscape"},"flight":{"start":"Autumn","end":"Autumn"},"hours":[{"days":[1],"start":"Autumn","end":"Autumn"}],"saturation":15,"playUnit":"item","mode":"rotate","content":{"kind":"media","items":[{"mediaId":"0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f","url":"https://…","durationSeconds":15}],"portraitItems":[{"mediaId":"0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f","url":"https://…","durationSeconds":15}],"frame":null}}'

回傳 200 BookingPutResult

欄位型別說明
idstring (uuid)必填
refstring必填
namestring必填
status"pending" | "approved" | "rejected" | "cancelled" | "withdrawn"必填What is stored.
state"requested" | "in_review" | "rejected" | "scheduled" | "live" | "ended" | "cancelled" | "withdrawn"必填What it looks like now: approved bookings are scheduled, live or ended by their flight in the screens' time zones.
changePendingboolean必填An approved booking has a change waiting for review; the earlier version keeps playing.
statusReasonstring | null必填The merchant's rejection or withdrawal reason. For an approved booking, this can explain a refused change while the earlier version keeps playing.
reviewsobject必填
liveVersioninteger | null必填The version on screens; null when nothing plays.
flightobject | null必填
updatedAtstring必填
outcome"unchanged" | "renamed" | "requested" | "published"必填unchanged: the same request again, nothing written. requested: waits for the merchant. published: on screens at once (automatic approval, or a change that only takes away).
{
  "id": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
  "ref": "Autumn",
  "name": "Autumn menu",
  "status": "pending",
  "state": "requested",
  "changePending": false,
  "statusReason": "Autumn",
  "reviews": {
    "platform": null,
    "merchant": null
  },
  "liveVersion": 1,
  "flight": {
    "start": "Autumn",
    "end": "Autumn"
  },
  "updatedAt": "Autumn",
  "outcome": "unchanged"
}

錯誤

狀態什麼時候
400 Bad RequestThe body is not valid JSON or not what this endpoint takes; the message names the fields.
401 UnauthorizedThe token is missing, unknown, expired or revoked, or its merchant is suspended or its plan has ended, or its partner is paused or suspended.
403 ForbiddenThe token lacks the scope this endpoint needs, or the merchant's plan does not allow it (code: plan): a token not bound to a partner needs a plan with DRMN Ads.
404 Not FoundA location, tag or screenRef that is not the merchant's, or a media id your partner did not sync in.
409 Conflictcode: booking_closed: the booking was cancelled or withdrawn; send a new ref. code: partner_paused: the merchant has not linked this partner.
413 Payload Too LargeThe body is larger than 16 KB.
422 UnprocessableThe booking breaks a rule: flight, hours, too many screens, no screen the merchant opened to you, a web page longer than a slot, item on a sync group…; the message says which.
429 Too Many RequestsMore than 30 writes in a minute with this token (counted apart from reads).

取消一筆預約

POST/bookings/{ref}/cancel範圍 bookings:write

Needs the bookings:write scope. It leaves the screens at once and the ref cannot be used again. Cancelling twice changes nothing.

參數

名稱位置型別說明
ref路徑(必填)stringThe partner's own id for the booking (the EC's group-buy id).

範例

curl -s -X POST https://cms.drmn.app/api/integrations/v1/bookings/0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f/cancel \
  -H "Authorization: Bearer $DRMN_INTEGRATION_TOKEN"

回傳 200 Booking

欄位型別說明
idstring (uuid)必填
refstring必填
namestring必填
status"pending" | "approved" | "rejected" | "cancelled" | "withdrawn"必填What is stored.
state"requested" | "in_review" | "rejected" | "scheduled" | "live" | "ended" | "cancelled" | "withdrawn"必填What it looks like now: approved bookings are scheduled, live or ended by their flight in the screens' time zones.
changePendingboolean必填An approved booking has a change waiting for review; the earlier version keeps playing.
statusReasonstring | null必填The merchant's rejection or withdrawal reason. For an approved booking, this can explain a refused change while the earlier version keeps playing.
reviewsobject必填
liveVersioninteger | null必填The version on screens; null when nothing plays.
flightobject | null必填
updatedAtstring必填
{
  "id": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
  "ref": "Autumn",
  "name": "Autumn menu",
  "status": "pending",
  "state": "requested",
  "changePending": false,
  "statusReason": "Autumn",
  "reviews": {
    "platform": null,
    "merchant": null
  },
  "liveVersion": 1,
  "flight": {
    "start": "Autumn",
    "end": "Autumn"
  },
  "updatedAt": "Autumn"
}

錯誤

狀態什麼時候
400 Bad RequestThe body is not valid JSON or not what this endpoint takes; the message names the fields.
401 UnauthorizedThe token is missing, unknown, expired or revoked, or its merchant is suspended or its plan has ended, or its partner is paused or suspended.
403 ForbiddenThe token lacks the scope this endpoint needs, or the merchant's plan does not allow it (code: plan): a token not bound to a partner needs a plan with DRMN Ads.
404 Not FoundNo such booking for this partner.
413 Payload Too LargeThe body is larger than 16 KB.
429 Too Many RequestsMore than 30 writes in a minute with this token (counted apart from reads).

共用的資料結構

Media

欄位型別說明
idstring (uuid)必填
namestring必填
type"image" | "video" | "web"必填
widthinteger | null必填Pixels; null when unknown (and for web pages).
heightinteger | null必填Pixels; null when unknown (and for web pages).
durationSecondsnumber | null必填A video's length; null for images and web pages.
tagsTag[]必填
externalRefsExternalRef[]必填Where the item came from outside the CMS; empty for media added in the CMS.
thumbnailUrlstring (uri) | null必填A signed URL that stops working 15 minutes after the response; null when there is no thumbnail.
createdAtstring (date-time)必填
fileUrlstring (uri) | null選填Only with the media:files scope. The file itself: a signed URL that stops working 15 minutes after the response, or a web page's own address. Absent without that scope.

Tag

欄位型別說明
idstring (uuid)必填
namestring必填

ExternalRef

欄位型別說明
providerTypestring必填The outside system's type, e.g. drmn_ec: set on the token that wrote it.
uidstring必填The item's id in that system, as sent in externalRef.uid.
namestring必填The integration's name when it wrote the ref, e.g. 團購 EC.
urlstring (uri) | null必填Back to the item in that system; null when none was sent.
metaobject | null必填That system's own fields as sent in externalRef.meta; the CMS does not read them.
syncedAtstring (date-time)必填When that system last sent it.

Campaign

欄位型別說明
lineageIdstring (uuid)必填The campaign's stable id: it stays the same across versions.
namestring必填
status"running" | "upcoming" | "draft" | "ended" | "withdrawn"必填running, upcoming or ended while live; else draft (never published) or withdrawn.
flightobject必填The live version's flight, else the newest version's.
tagsTag[]必填

CampaignDetail

欄位型別說明
lineageIdstring (uuid)必填The campaign's stable id: it stays the same across versions.
namestring必填
status"running" | "upcoming" | "draft" | "ended" | "withdrawn"必填running, upcoming or ended while live; else draft (never published) or withdrawn.
flightobject必填The live version's flight, else the newest version's.
tagsTag[]必填
mediaIdsstring (uuid)[]必填The media the live version plays (landscape and portrait), in play order, each once; empty when nothing is live.
contentobject | null必填The live version's content in play order; null when nothing is live.

CampaignContent

欄位型別說明
playlistIdstring (uuid) | null必填The playlist it was published from (GET /playlists/{id}); null when that playlist was deleted since.
itemsPlayItem[]必填In play order, as frozen at publish: what screens play now.

Playlist

欄位型別說明
idstring (uuid)必填
namestring必填
createdAtstring (date-time)必填
updatedAtstring (date-time)必填

PlaylistDetail

欄位型別說明
idstring (uuid)必填
namestring必填
createdAtstring (date-time)必填
updatedAtstring (date-time)必填
totalDurationSecondsnumber必填
itemsPlayItem[]必填In play order.

PlayItem

欄位型別說明
mediaIdstring (uuid)必填
type"image" | "video" | "web"必填
durationSecondsnumber必填How long it plays, in seconds: the item's own setting, else the media's length or the default.

PresignedUpload

欄位型別說明
urlstring (uri)必填PUT the bytes here within 1 hour.
headersobject必填Send every one of these headers unchanged: they are part of the signature.

Error

欄位型別說明
error"invalid_request" | "unauthorized" | "forbidden" | "not_found" | "method_not_allowed" | "conflict" | "payload_too_large" | "unprocessable" | "rate_limited" | "internal"必填
messagestring必填
codestring選填Which reason behind the status: for a 409 storage_quota_exceeded, id_conflict, booking_closed or partner_paused; for a 403 plan; for a 422 invalid or provider_type_missing.