Noma

Update an Entry

Update an Entry

Updates an existing content entry. The API exposes the same path for full replace (PUT) and partial (PATCH).

Request

PUT /api/{collection}/{uuid} HTTP/1.1
PATCH /api/{collection}/{uuid} HTTP/1.1
Host: app.nomacms.com
Content-Type: application/json
project-id: <project-uuid>
Authorization: Bearer <api-token>
Accept: application/json

Requires the update ability on the token.

Path parameters

ParamDescription
collectionCollection slug
uuidEntry UUID

JSON body

FieldTypeDescription
localestringNew locale for the entry (must satisfy project locale rules).
statestringdraft or published. Invalid values keep the existing state.
dataobjectField values keyed by field name.

PUT vs PATCH

  • PUT: Before applying data, the server removes all existing top-level field values and all field groups. Then it writes only what you send in data. Omitting data or sending {} clears custom field content (system columns such as locale/state are still updated from the top-level keys).
  • PATCH: Only keys present in data are replaced; other fields are unchanged. Required-field validation runs only for keys you include (and group rules follow the same idea). For password fields, sending an empty value keeps the stored hash when a value already exists.

Both methods update state / locale from the JSON body when provided.

Response (200)

JSON object: updated entry (uuid, locale, published_at, fields, optional timestamps if timestamps query param is set).

The state field is not included in the response body.

Errors

StatusWhen
400Missing project-id or project cannot be resolved
401Missing or invalid bearer token
403Token does not have update (or *)
404Collection or entry not found
422Validation failed

Example

import { createClient } from "@nomacms/js-sdk"
 
const client = createClient({
  projectId: process.env.NOMA_PROJECT_ID!,
  apiKey: process.env.NOMA_API_KEY!,
})
 
// Full replace (PUT)
await client.content.update("blog-posts", entryUuid, {
  state: "published",
  data: {
    title: "Hello (updated)",
    slug: "hello",
    content: "<p>Updated</p>",
  },
})
 
// Partial update (PATCH)
await client.content.patch("blog-posts", entryUuid, {
  data: {
    title: "New title only",
  },
})
import axios from "axios"
 
async function main() {
  const url = `https://app.nomacms.com/api/blog-posts/${encodeURIComponent(entryUuid)}`
  const headers = {
    "Content-Type": "application/json",
    "project-id": process.env.NOMA_PROJECT_ID!,
    Authorization: `Bearer ${process.env.NOMA_API_KEY}`,
    Accept: "application/json",
  }
 
  const replaced = await axios.put(url, {
    state: "published",
    data: {
      title: "Hello (updated)",
      slug: "hello",
      content: "<p>Updated</p>",
    },
    { headers },
  )
  console.log(replaced.data)
 
  const patched = await axios.patch(url, { data: { title: "New title only" } }, { headers })
  console.log(patched.data)
}
 
void main()
<?php
 
$uuid = getenv('ENTRY_UUID');
$url = 'https://app.nomacms.com/api/blog-posts/' . rawurlencode($uuid);
 
// Partial update (PATCH)
$patchBody = json_encode(['data' => ['title' => 'New title only']]);
$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'PATCH',
    CURLOPT_POSTFIELDS => $patchBody,
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
        'Content-Length: ' . strlen($patchBody),
        'project-id: ' . getenv('NOMA_PROJECT_ID'),
        'Authorization: Bearer ' . getenv('NOMA_API_KEY'),
        'Accept: application/json',
    ],
    CURLOPT_RETURNTRANSFER => true,
]);
echo curl_exec($ch);
# Partial update (PATCH)
curl -sS -X PATCH "https://app.nomacms.com/api/blog-posts/${ENTRY_UUID}" \
  -H "Content-Type: application/json" \
  -H "project-id: $NOMA_PROJECT_ID" \
  -H "Authorization: Bearer $NOMA_API_KEY" \
  -H "Accept: application/json" \
  -d '{"data":{"title":"New title only"}}'
 
# Full replace (PUT)
curl -sS -X PUT "https://app.nomacms.com/api/blog-posts/${ENTRY_UUID}" \
  -H "Content-Type: application/json" \
  -H "project-id: $NOMA_PROJECT_ID" \
  -H "Authorization: Bearer $NOMA_API_KEY" \
  -H "Accept: application/json" \
  -d '{"state":"published","data":{"title":"Hello (updated)","slug":"hello","content":"<p>Updated</p>"}}'
package main
 
import (
	"bytes"
	"encoding/json"
	"io"
	"net/http"
	"net/url"
	"os"
)
 
func main() {
	endpoint := "https://app.nomacms.com/api/blog-posts/" + url.PathEscape(os.Getenv("ENTRY_UUID"))
 
	// Partial update (PATCH)
	body := map[string]any{
		"data": map[string]any{
			"title": "New title only",
		},
	}
	raw, err := json.Marshal(body)
	if err != nil {
		panic(err)
	}
	req, err := http.NewRequest("PATCH", endpoint, bytes.NewReader(raw))
	if err != nil {
		panic(err)
	}
	req.Header.Set("Content-Type", "application/json")
	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 "json"
require "uri"
 
entry_uuid = ENV.fetch("ENTRY_UUID")
uri = URI("https://app.nomacms.com/api/blog-posts/#{entry_uuid}")
 
# Partial update (PATCH)
payload = { "data" => { "title" => "New title only" } }
req = Net::HTTP::Patch.new(uri)
req["Content-Type"] = "application/json"
req["project-id"] = ENV.fetch("NOMA_PROJECT_ID")
req["Authorization"] = "Bearer #{ENV.fetch('NOMA_API_KEY')}"
req["Accept"] = "application/json"
req.body = JSON.generate(payload)
 
Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
  puts http.request(req).body
end
import json
import os
import urllib.parse
import urllib.request
 
entry_uuid = os.environ["ENTRY_UUID"]
path = "/api/blog-posts/" + urllib.parse.quote(entry_uuid, safe="")
url = f"https://app.nomacms.com{path}"
 
# Partial update (PATCH)
payload = {"data": {"title": "New title only"}}
data = json.dumps(payload).encode()
req = urllib.request.Request(
    url,
    data=data,
    headers={
        "Content-Type": "application/json",
        "project-id": os.environ["NOMA_PROJECT_ID"],
        "Authorization": f"Bearer {os.environ['NOMA_API_KEY']}",
        "Accept": "application/json",
    },
    method="PATCH",
)
with urllib.request.urlopen(req) as res:
    print(res.read().decode())
  • Create an Entry - New rows
  • Delete an Entry - Remove or force-delete
  • JavaScript SDK - content.update, content.patch

Search documentation

Find guides and reference pages