Contents

Media

Resolve a media id to its public URL.

Base URL, authentication and conventions of this API are on the Content Delivery API page.

get/media/{mediaId}

Resolve a media id to its URL

302 redirect to the stable public URL of a media file of this site. Meant for your server to turn a media id found in blocks/fields into a URL. Never use this endpoint as src of an <img>/<video>: the browser would need the token. Put the Location URL in your HTML instead.

Read the Location header without following the redirect: most HTTP clients follow it by default (with Guzzle pass 'allow_redirects' => false, with fetch pass redirect: "manual" — server-side only, since browsers hide the header of a manual redirect).

GET https://api-brain.nucleoplatform.com/api/delivery/v1/acme/sites/12/media/{mediaId}
Authentication: Bearer token
Rate limit: 120 requests per 1m, per IP

Path parameters

  • mediaIdintegerrequired
    Example: 311

Responses

  • 302Redirect to the public file.
    Headers
    • Location
  • 401Missing or unknown delivery token.
    • messagestring
  • 404Not found. Also returned when the workspace slug is unknown or when the token belongs to another site (Nucleo never confirms that a site exists to a token that cannot read it). The text of message varies with the case: branch on the 404 status only.
    • messagestring
  • 429More than 120 requests in a minute from the same IP.
    Headers
    • Retry-After
    • X-RateLimit-Limit
    • X-RateLimit-Remaining
    • messagestring
Request
curl -i -X GET https://api-brain.nucleoplatform.com/api/delivery/v1/acme/sites/12/media/311 \
  -H "Authorization: Bearer $NUCLEO_CMS_TOKEN"
Response
{
  "message": "Delivery token required (Authorization: Bearer)."
}
Was this page helpful?