OptimoCMSDocs

Media

Media library and uploads

GET
/v1/sites/{siteId}/media

Authorization

ApiKeyAuth
X-Api-Key<token>

API key obtained from the CMS dashboard.

In: header

Path Parameters

siteId*string

Query Parameters

limit?integer
Default25
Rangevalue <= 100
cursor?string
type?string
Value in"image" | "video" | "document"

Response Body

application/json

curl -X GET "https://example.com/v1/sites/string/media"
{
  "data": [
    {
      "id": "string",
      "filename": "string",
      "url": "string",
      "type": "image",
      "size": 0,
      "createdAt": "2019-08-24T14:15:22Z"
    }
  ],
  "meta": {
    "requestId": "d385ab22-0f51-4b97-9ecd-b8ff3fd4fcb6",
    "timestamp": "2019-08-24T14:15:22Z"
  },
  "pagination": {
    "total": 0,
    "limit": 0,
    "nextCursor": "string"
  }
}
GET
/v1/sites/{siteId}/media/search

Authorization

ApiKeyAuth
X-Api-Key<token>

API key obtained from the CMS dashboard.

In: header

Path Parameters

siteId*string

Query Parameters

q*string
limit?integer
Default25
Rangevalue <= 100
cursor?string
type?string
Value in"image" | "video" | "document"

Response Body

application/json

application/json

curl -X GET "https://example.com/v1/sites/string/media/search?q=string"
{
  "data": [
    {
      "id": "string",
      "filename": "string",
      "url": "string",
      "type": "image",
      "size": 0,
      "createdAt": "2019-08-24T14:15:22Z"
    }
  ],
  "meta": {
    "requestId": "d385ab22-0f51-4b97-9ecd-b8ff3fd4fcb6",
    "timestamp": "2019-08-24T14:15:22Z"
  },
  "pagination": {
    "total": 0,
    "limit": 0,
    "nextCursor": "string"
  }
}
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {}
  },
  "meta": {
    "requestId": "d385ab22-0f51-4b97-9ecd-b8ff3fd4fcb6",
    "timestamp": "2019-08-24T14:15:22Z"
  }
}
POST
/v1/sites/{siteId}/media/upload-url

Authorization

ApiKeyAuth
X-Api-Key<token>

API key obtained from the CMS dashboard.

In: header

Path Parameters

siteId*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://example.com/v1/sites/string/media/upload-url" \  -H "Content-Type: application/json" \  -d '{    "filename": "string",    "contentType": "string",    "size": 1  }'
{
  "data": {
    "uploadUrl": "http://example.com",
    "fileId": "string",
    "expiresAt": "2019-08-24T14:15:22Z"
  },
  "meta": {
    "requestId": "d385ab22-0f51-4b97-9ecd-b8ff3fd4fcb6",
    "timestamp": "2019-08-24T14:15:22Z"
  }
}
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {}
  },
  "meta": {
    "requestId": "d385ab22-0f51-4b97-9ecd-b8ff3fd4fcb6",
    "timestamp": "2019-08-24T14:15:22Z"
  }
}