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 | 查詢 | string | The nextCursor of the previous page. |
limit | 查詢 | integer | 1–200, 預設 50 |
tag | 查詢 | string (uuid)[] | A tag id from GET /tags. Repeat it to require every tag listed. |
q | 查詢 | string | Matches the media's name or description, ignoring case. (最多 200 字) |
externalUid | 查詢 | string | The 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
| 欄位 | 型別 | 說明 | |
|---|---|---|---|
items | Media[] | 必填 | |
nextCursor | string | 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 Request | A query parameter is not valid. |
401 Unauthorized | The 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 Forbidden | The 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 Requests | More 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
| 欄位 | 型別 | 說明 | |
|---|---|---|---|
id | string (uuid) | 必填 | |
name | string | 必填 | |
type | "image" | "video" | "web" | 必填 | |
width | integer | null | 必填 | Pixels; null when unknown (and for web pages). |
height | integer | null | 必填 | Pixels; null when unknown (and for web pages). |
durationSeconds | number | null | 必填 | A video's length; null for images and web pages. |
tags | Tag[] | 必填 | |
externalRefs | ExternalRef[] | 必填 | Where the item came from outside the CMS; empty for media added in the CMS. |
thumbnailUrl | string (uri) | null | 必填 | A signed URL that stops working 15 minutes after the response; null when there is no thumbnail. |
createdAt | string (date-time) | 必填 | |
fileUrl | string (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 Unauthorized | The 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 Forbidden | The 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 Found | No such item in the token's merchant. |
429 Too Many Requests | More than 120 requests in a minute with this token. |
列出活動(不含已封存),最近修改的在前
GET/campaigns範圍 campaigns:read
Needs the campaigns:read scope.
參數
| 名稱 | 位置 | 型別 | 說明 |
|---|---|---|---|
cursor | 查詢 | string | The nextCursor of the previous page. |
limit | 查詢 | integer | 1–200, 預設 50 |
tag | 查詢 | string (uuid)[] | A tag id from GET /tags. Repeat it to require every tag listed. |
q | 查詢 | string | Matches 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
| 欄位 | 型別 | 說明 | |
|---|---|---|---|
items | Campaign[] | 必填 | |
nextCursor | string | 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 Request | A query parameter is not valid. |
401 Unauthorized | The 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 Forbidden | The 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 Requests | More 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
| 欄位 | 型別 | 說明 | |
|---|---|---|---|
lineageId | string (uuid) | 必填 | The campaign's stable id: it stays the same across versions. |
name | string | 必填 | |
status | "running" | "upcoming" | "draft" | "ended" | "withdrawn" | 必填 | running, upcoming or ended while live; else draft (never published) or withdrawn. |
flight | object | 必填 | The live version's flight, else the newest version's. |
tags | Tag[] | 必填 | |
mediaIds | string (uuid)[] | 必填 | The media the live version plays (landscape and portrait), in play order, each once; empty when nothing is live. |
content | object | 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 Unauthorized | The 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 Forbidden | The 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 Found | No such item in the token's merchant. |
429 Too Many Requests | More than 120 requests in a minute with this token. |
列出共用的播放清單,最近修改的在前
GET/playlists範圍 playlists:read
Needs the playlists:read scope.
參數
| 名稱 | 位置 | 型別 | 說明 |
|---|---|---|---|
cursor | 查詢 | string | The nextCursor of the previous page. |
limit | 查詢 | integer | 1–200, 預設 50 |
q | 查詢 | string | Matches 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
| 欄位 | 型別 | 說明 | |
|---|---|---|---|
items | Playlist[] | 必填 | |
nextCursor | string | 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 Request | A query parameter is not valid. |
401 Unauthorized | The 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 Forbidden | The 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 Requests | More 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
| 欄位 | 型別 | 說明 | |
|---|---|---|---|
id | string (uuid) | 必填 | |
name | string | 必填 | |
createdAt | string (date-time) | 必填 | |
updatedAt | string (date-time) | 必填 | |
totalDurationSeconds | number | 必填 | |
items | PlayItem[] | 必填 | 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 Unauthorized | The 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 Forbidden | The 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 Found | No such item in the token's merchant. |
429 Too Many Requests | More 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
| 欄位 | 型別 | 說明 | |
|---|---|---|---|
id | string (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. |
name | string | 必填 | The name shown in the media library. (最多 200 字) |
fileName | string | 必填 | 最多 500 字 |
mimeType | string | 必填 | image/jpeg, image/png, image/webp, video/mp4 or video/webm. |
fileSize | integer | 必填 | Bytes. Images up to 50 MB, videos up to 2 GB. |
checksum | string | 必填 | The file's SHA-256, lower-case hex. |
duration | number | null | 選填 | A video's length in seconds. |
width | integer | null | 選填 | |
height | integer | null | 選填 | |
hasThumbnail | boolean | 選填 | True when you will PUT a JPEG thumbnail (480 px wide is best) too. |
thumbnailSize | integer | null | 選填 | The thumbnail's bytes, at most 1 MB; required with hasThumbnail. |
codec | string | null | 選填 | A video's codec (h264, hevc, …); normalized and stored with the media item and used for compatibility warnings. (最多 50 字) |
externalRef | object | 選填 | 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
| 欄位 | 型別 | 說明 | |
|---|---|---|---|
mediaId | string (uuid) | 必填 | The item's id: yours, or the existing item's when duplicateOf is set. |
duplicateOf | object | 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. |
upload | object | null | 必填 | Where to PUT the file; null for a duplicate. |
thumbnailUpload | object | null | 必填 | Where to PUT the thumbnail; null without one. |
warnings | object[] | 必填 | 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 Request | The body is not valid JSON or not what this endpoint takes; the message names the fields. |
401 Unauthorized | The 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 Forbidden | The 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 Found | A write-only partner named another buyer's upload id or external source uid. |
409 Conflict | code: storage_quota_exceeded: the merchant's storage is full. code: id_conflict: the id is another item's. |
413 Payload Too Large | The body is larger than 16 KB. |
422 Unprocessable | The 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 Requests | More 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
| 欄位 | 型別 | 說明 | |
|---|---|---|---|
id | string (uuid) | 必填 | |
name | string | 必填 | |
type | "image" | "video" | "web" | 必填 | |
width | integer | null | 必填 | Pixels; null when unknown (and for web pages). |
height | integer | null | 必填 | Pixels; null when unknown (and for web pages). |
durationSeconds | number | null | 必填 | A video's length; null for images and web pages. |
tags | Tag[] | 必填 | |
externalRefs | ExternalRef[] | 必填 | Where the item came from outside the CMS; empty for media added in the CMS. |
thumbnailUrl | string (uri) | null | 必填 | A signed URL that stops working 15 minutes after the response; null when there is no thumbnail. |
createdAt | string (date-time) | 必填 | |
fileUrl | string (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 Request | The body is not valid JSON or not what this endpoint takes; the message names the fields. |
401 Unauthorized | The 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 Forbidden | The 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 Found | No such upload in the token's merchant or, for a write-only partner, outside its own source items. |
413 Payload Too Large | The body is larger than 16 KB. |
422 Unprocessable | The file was not stored, or not with the declared size; PUT it again. |
429 Too Many Requests | More 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
| 欄位 | 型別 | 說明 | |
|---|---|---|---|
add | string[] | 必填 | 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
| 欄位 | 型別 | 說明 | |
|---|---|---|---|
mediaId | string (uuid) | 必填 | |
tags | Tag[] | 必填 | The tags the names resolved to for a library-authorized integration; empty for a narrow partner's basic receipt. |
added | integer | 必填 | 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 Request | The body is not valid JSON or not what this endpoint takes; the message names the fields. |
401 Unauthorized | The 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 Forbidden | The 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 Found | No 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 Large | The body is larger than 16 KB. |
422 Unprocessable | The body asks to remove tags, or the item would have too many tags. |
429 Too Many Requests | More than 30 writes in a minute with this token (counted apart from reads). |
依名稱列出標籤
GET/tags範圍 tags:read
Needs the tags:read scope.
參數
| 名稱 | 位置 | 型別 | 說明 |
|---|---|---|---|
cursor | 查詢 | string | The nextCursor of the previous page. |
limit | 查詢 | integer | 1–200, 預設 50 |
q | 查詢 | string | Matches 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
| 欄位 | 型別 | 說明 | |
|---|---|---|---|
items | Tag[] | 必填 | |
nextCursor | string | 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 Request | A query parameter is not valid. |
401 Unauthorized | The 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 Forbidden | The 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 Requests | More 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 | 查詢 | string | The nextCursor of the previous page. |
limit | 查詢 | integer | 1–100, 預設 50 |
範例
curl -s https://cms.drmn.app/api/integrations/v1/bookings \
-H "Authorization: Bearer $DRMN_INTEGRATION_TOKEN"
回傳 200 BookingPage
| 欄位 | 型別 | 說明 | |
|---|---|---|---|
items | Booking[] | 必填 | |
nextCursor | string | 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 Request | A query parameter is not valid. |
401 Unauthorized | The 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 Forbidden | The 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 Requests | More than 120 requests in a minute with this token. |
合作夥伴自己的單一預約
GET/bookings/{ref}範圍 bookings:read
Needs the bookings:read scope.
參數
| 名稱 | 位置 | 型別 | 說明 |
|---|---|---|---|
ref | 路徑(必填) | string | The 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
| 欄位 | 型別 | 說明 | |
|---|---|---|---|
id | string (uuid) | 必填 | |
ref | string | 必填 | |
name | string | 必填 | |
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. |
changePending | boolean | 必填 | An approved booking has a change waiting for review; the earlier version keeps playing. |
statusReason | string | null | 必填 | The merchant's rejection or withdrawal reason. For an approved booking, this can explain a refused change while the earlier version keeps playing. |
reviews | object | 必填 | |
liveVersion | integer | null | 必填 | The version on screens; null when nothing plays. |
flight | object | null | 必填 | |
updatedAt | string | 必填 |
{
"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 Unauthorized | The 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 Forbidden | The 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 Found | No such item in the token's merchant. |
429 Too Many Requests | More 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 | 路徑(必填) | string | The partner's own id for the booking (the EC's group-buy id). |
請求內容 BookingRequest
| 欄位 | 型別 | 說明 | |
|---|---|---|---|
name | string | 必填 | 最多 120 字 |
targets | object | 選填 | 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. |
flight | object | 必填 | Required, at most 93 days. |
hours | object[] | null | 選填 | When it may play each week; null or left out = all day. |
saturation | number | 選填 | 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. |
content | object | 必填 |
範例
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
| 欄位 | 型別 | 說明 | |
|---|---|---|---|
id | string (uuid) | 必填 | |
ref | string | 必填 | |
name | string | 必填 | |
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. |
changePending | boolean | 必填 | An approved booking has a change waiting for review; the earlier version keeps playing. |
statusReason | string | null | 必填 | The merchant's rejection or withdrawal reason. For an approved booking, this can explain a refused change while the earlier version keeps playing. |
reviews | object | 必填 | |
liveVersion | integer | null | 必填 | The version on screens; null when nothing plays. |
flight | object | null | 必填 | |
updatedAt | string | 必填 | |
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 Request | The body is not valid JSON or not what this endpoint takes; the message names the fields. |
401 Unauthorized | The 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 Forbidden | The 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 Found | A location, tag or screenRef that is not the merchant's, or a media id your partner did not sync in. |
409 Conflict | code: 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 Large | The body is larger than 16 KB. |
422 Unprocessable | The 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 Requests | More 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 | 路徑(必填) | string | The 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
| 欄位 | 型別 | 說明 | |
|---|---|---|---|
id | string (uuid) | 必填 | |
ref | string | 必填 | |
name | string | 必填 | |
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. |
changePending | boolean | 必填 | An approved booking has a change waiting for review; the earlier version keeps playing. |
statusReason | string | null | 必填 | The merchant's rejection or withdrawal reason. For an approved booking, this can explain a refused change while the earlier version keeps playing. |
reviews | object | 必填 | |
liveVersion | integer | null | 必填 | The version on screens; null when nothing plays. |
flight | object | null | 必填 | |
updatedAt | string | 必填 |
{
"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 Request | The body is not valid JSON or not what this endpoint takes; the message names the fields. |
401 Unauthorized | The 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 Forbidden | The 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 Found | No such booking for this partner. |
413 Payload Too Large | The body is larger than 16 KB. |
429 Too Many Requests | More than 30 writes in a minute with this token (counted apart from reads). |
共用的資料結構
Media
| 欄位 | 型別 | 說明 | |
|---|---|---|---|
id | string (uuid) | 必填 | |
name | string | 必填 | |
type | "image" | "video" | "web" | 必填 | |
width | integer | null | 必填 | Pixels; null when unknown (and for web pages). |
height | integer | null | 必填 | Pixels; null when unknown (and for web pages). |
durationSeconds | number | null | 必填 | A video's length; null for images and web pages. |
tags | Tag[] | 必填 | |
externalRefs | ExternalRef[] | 必填 | Where the item came from outside the CMS; empty for media added in the CMS. |
thumbnailUrl | string (uri) | null | 必填 | A signed URL that stops working 15 minutes after the response; null when there is no thumbnail. |
createdAt | string (date-time) | 必填 | |
fileUrl | string (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
| 欄位 | 型別 | 說明 | |
|---|---|---|---|
id | string (uuid) | 必填 | |
name | string | 必填 |
ExternalRef
| 欄位 | 型別 | 說明 | |
|---|---|---|---|
providerType | string | 必填 | The outside system's type, e.g. drmn_ec: set on the token that wrote it. |
uid | string | 必填 | The item's id in that system, as sent in externalRef.uid. |
name | string | 必填 | The integration's name when it wrote the ref, e.g. 團購 EC. |
url | string (uri) | null | 必填 | Back to the item in that system; null when none was sent. |
meta | object | null | 必填 | That system's own fields as sent in externalRef.meta; the CMS does not read them. |
syncedAt | string (date-time) | 必填 | When that system last sent it. |
Campaign
| 欄位 | 型別 | 說明 | |
|---|---|---|---|
lineageId | string (uuid) | 必填 | The campaign's stable id: it stays the same across versions. |
name | string | 必填 | |
status | "running" | "upcoming" | "draft" | "ended" | "withdrawn" | 必填 | running, upcoming or ended while live; else draft (never published) or withdrawn. |
flight | object | 必填 | The live version's flight, else the newest version's. |
tags | Tag[] | 必填 |
CampaignDetail
| 欄位 | 型別 | 說明 | |
|---|---|---|---|
lineageId | string (uuid) | 必填 | The campaign's stable id: it stays the same across versions. |
name | string | 必填 | |
status | "running" | "upcoming" | "draft" | "ended" | "withdrawn" | 必填 | running, upcoming or ended while live; else draft (never published) or withdrawn. |
flight | object | 必填 | The live version's flight, else the newest version's. |
tags | Tag[] | 必填 | |
mediaIds | string (uuid)[] | 必填 | The media the live version plays (landscape and portrait), in play order, each once; empty when nothing is live. |
content | object | null | 必填 | The live version's content in play order; null when nothing is live. |
CampaignContent
| 欄位 | 型別 | 說明 | |
|---|---|---|---|
playlistId | string (uuid) | null | 必填 | The playlist it was published from (GET /playlists/{id}); null when that playlist was deleted since. |
items | PlayItem[] | 必填 | In play order, as frozen at publish: what screens play now. |
Playlist
| 欄位 | 型別 | 說明 | |
|---|---|---|---|
id | string (uuid) | 必填 | |
name | string | 必填 | |
createdAt | string (date-time) | 必填 | |
updatedAt | string (date-time) | 必填 |
PlaylistDetail
| 欄位 | 型別 | 說明 | |
|---|---|---|---|
id | string (uuid) | 必填 | |
name | string | 必填 | |
createdAt | string (date-time) | 必填 | |
updatedAt | string (date-time) | 必填 | |
totalDurationSeconds | number | 必填 | |
items | PlayItem[] | 必填 | In play order. |
PlayItem
| 欄位 | 型別 | 說明 | |
|---|---|---|---|
mediaId | string (uuid) | 必填 | |
type | "image" | "video" | "web" | 必填 | |
durationSeconds | number | 必填 | How long it plays, in seconds: the item's own setting, else the media's length or the default. |
PresignedUpload
| 欄位 | 型別 | 說明 | |
|---|---|---|---|
url | string (uri) | 必填 | PUT the bytes here within 1 hour. |
headers | object | 必填 | 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" | 必填 | |
message | string | 必填 | |
code | string | 選填 | 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. |
