Get an Entry
Returns a single content entry in a collection by entry UUID.
Request
GET /api/{collection}/{uuid} HTTP/1.1
Host: app.nomacms.com
project-id: <project-uuid>
Authorization: Bearer <api-token>
Accept: application/jsonRequires the read ability on the token.
Path parameters
| Param | Description |
|---|---|
collection | Collection slug |
uuid | Content entry UUID |
Query parameters
| Param | Description |
|---|---|
state | draft or published. Invalid values are treated as published. Default published. Rows are filtered to this state unless translation_locale is set: then the entry at uuid is resolved first without a state filter, and the linked translation is filtered by state. |
locale | Optional. When set, the entry must match this locale. |
translation_locale | Optional. When set, the API resolves a linked translation in this locale instead of returning the path UUID’s row. See Translations. |
exclude | Comma-separated field names to omit from fields. |
timestamps | If present, includes created_at and updated_at. |
Response (200)
JSON object with the same entry shape as List Entries (uuid, locale, published_at, fields, optional timestamps).
The state field is not included in the response body.
Errors
| Status | When |
|---|---|
| 400 | Missing project-id or project cannot be resolved |
| 401 | Missing or invalid bearer token |
| 403 | Token does not have read (or *) |
| 404 | Collection not found, entry not found, translation not found, or entry has no translation group (see messages below) |
Translation-related 404 messages
When translation_locale is set:
Translation not found for locale '{locale}'.— no linked entry in that locale.This entry has no translations linked.— the entry has no translation group.
Example
import { createClient } from "@nomacms/js-sdk"
const client = createClient({
projectId: process.env.NOMA_PROJECT_ID!,
apiKey: process.env.NOMA_API_KEY!,
})
const entry = await client.content.get("blog-posts", entryUuid, {
state: "published",
locale: "en",
})
console.log(entry)import axios from "axios"
async function main() {
const { data } = await axios.get(
`https://app.nomacms.com/api/blog-posts/${encodeURIComponent(entryUuid)}`,
{
params: { state: "published", locale: "en" },
headers: {
"project-id": process.env.NOMA_PROJECT_ID!,
Authorization: `Bearer ${process.env.NOMA_API_KEY}`,
Accept: "application/json",
},
},
)
console.log(data)
}
void main()<?php
$collection = 'blog-posts';
$uuid = getenv('ENTRY_UUID');
$path = '/api/' . rawurlencode($collection) . '/' . rawurlencode($uuid);
$query = http_build_query([
'state' => 'published',
'locale' => 'en',
]);
$url = 'https://app.nomacms.com' . $path . '?' . $query;
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_HTTPHEADER => [
'project-id: ' . getenv('NOMA_PROJECT_ID'),
'Authorization: Bearer ' . getenv('NOMA_API_KEY'),
'Accept: application/json',
],
CURLOPT_RETURNTRANSFER => true,
]);
echo curl_exec($ch);curl -sS -G "https://app.nomacms.com/api/blog-posts/${ENTRY_UUID}" \
--data-urlencode "state=published" \
--data-urlencode "locale=en" \
-H "project-id: $NOMA_PROJECT_ID" \
-H "Authorization: Bearer $NOMA_API_KEY" \
-H "Accept: application/json"package main
import (
"io"
"net/http"
"net/url"
"os"
)
func main() {
base, err := url.Parse("https://app.nomacms.com/api/blog-posts/" + url.PathEscape(os.Getenv("ENTRY_UUID")))
if err != nil {
panic(err)
}
q := base.Query()
q.Set("state", "published")
q.Set("locale", "en")
base.RawQuery = q.Encode()
req, err := http.NewRequest("GET", base.String(), nil)
if err != nil {
panic(err)
}
req.Header.Set("project-id", os.Getenv("NOMA_PROJECT_ID"))
req.Header.Set("Authorization", "Bearer "+os.Getenv("NOMA_API_KEY"))
req.Header.Set("Accept", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
_, _ = io.Copy(os.Stdout, res.Body)
}require "net/http"
require "uri"
entry_uuid = ENV.fetch("ENTRY_UUID")
uri = URI("https://app.nomacms.com/api/blog-posts/#{entry_uuid}")
uri.query = URI.encode_www_form(
"state" => "published",
"locale" => "en"
)
req = Net::HTTP::Get.new(uri)
req["project-id"] = ENV.fetch("NOMA_PROJECT_ID")
req["Authorization"] = "Bearer #{ENV.fetch('NOMA_API_KEY')}"
req["Accept"] = "application/json"
Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
puts http.request(req).body
endimport os
import urllib.parse
import urllib.request
entry_uuid = os.environ["ENTRY_UUID"]
path = "/api/blog-posts/" + urllib.parse.quote(entry_uuid, safe="")
params = {"state": "published", "locale": "en"}
query = urllib.parse.urlencode(params)
url = f"https://app.nomacms.com{path}?{query}"
req = urllib.request.Request(
url,
headers={
"project-id": os.environ["NOMA_PROJECT_ID"],
"Authorization": f"Bearer {os.environ['NOMA_API_KEY']}",
"Accept": "application/json",
},
)
with urllib.request.urlopen(req) as res:
print(res.read().decode())Related
- List Entries - Filters and pagination
- Translations -
translation_localeand linking entries - JavaScript SDK -
content.get