Noma

Get a Collection

Get a Collection

Returns one collection by slug, including field definitions (same shape as each element in List Collections).

Request

GET /api/collections/{slug} HTTP/1.1
Host: app.nomacms.com
project-id: <project-uuid>
Authorization: Bearer <api-token>
Accept: application/json

Replace {slug} with the collection slug (for example blog-posts).

Requires the read ability on the token.

Path parameters

ParamDescription
slugCollection slug in the URL path

Query parameters

None.

Response (200)

JSON object with:

FieldTypeDescription
uuidstringCollection UUID
namestringDisplay name
slugstringURL-safe identifier
is_singletonbooleanWhether at most one entry is allowed
created_atstringISO 8601 timestamp
updated_atstringISO 8601 timestamp
fieldsarrayField definitions (flattened list; group children use parent_field_id)

The fields array matches List Collections (field columns: id, uuid, type, label, name, and so on).

Errors

StatusWhen
400Missing project-id or project cannot be resolved (see Authentication)
401Missing or invalid bearer token
403Token does not have read (or *)
404Unknown collection slug (Collection not found.) or no project with that UUID
429Rate limited

Example

import { createClient } from "@nomacms/js-sdk"
 
const client = createClient({
  projectId: process.env.NOMA_PROJECT_ID!,
  apiKey: process.env.NOMA_API_KEY!,
})
 
const collection = await client.collections.get("blog-posts")
 
console.log(collection)
import axios from "axios"
 
async function main() {
  const { data } = await axios.get("https://app.nomacms.com/api/collections/blog-posts", {
    headers: {
      "project-id": process.env.NOMA_PROJECT_ID!,
      Authorization: `Bearer ${process.env.NOMA_API_KEY}`,
      Accept: "application/json",
    },
  })
  console.log(data)
}
 
void main()
<?php
 
$slug = 'blog-posts';
$ch = curl_init('https://app.nomacms.com/api/collections/' . rawurlencode($slug));
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 \
  -H "project-id: $NOMA_PROJECT_ID" \
  -H "Authorization: Bearer $NOMA_API_KEY" \
  -H "Accept: application/json" \
  "https://app.nomacms.com/api/collections/blog-posts"
package main
 
import (
	"io"
	"net/http"
	"os"
)
 
func main() {
	req, err := http.NewRequest("GET", "https://app.nomacms.com/api/collections/blog-posts", 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"
 
uri = URI("https://app.nomacms.com/api/collections/blog-posts")
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
end
import os
import urllib.parse
import urllib.request
 
slug = "blog-posts"
path = "/api/collections/" + urllib.parse.quote(slug, safe="")
url = "https://app.nomacms.com" + path
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())
  • Authentication - Headers and abilities
  • List Collections - All collections
  • Create a Collection - POST /api/collections
  • JavaScript SDK - collections.get

Search documentation

Find guides and reference pages