<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[(API)Route not found &gt; schema&#x2F;diff]]></title><description><![CDATA[<p dir="auto">Hi there,</p>
<p dir="auto">I'm trying to connect to server.tld/schema/diff &amp; ./schema/apply via method POST but my instance always replies with a 404 "route not found".</p>
<ul>
<li>Version is 11.12.0</li>
<li>(API)User has Admin-Permissions</li>
<li>for example ./schema/snapshot is just working fine</li>
</ul>
<p dir="auto">Could it be that these two endpoints are "blocked" in cloudron directus apps? Can we "activate" them? Or should they work and the problem sits in front of the screen <img src="https://forum.cloudron.io/assets/plugins/nodebb-plugin-emoji/emoji/android/1f914.png?v=fed68e33a46" class="not-responsive emoji emoji-android emoji--thinking_face" style="height:23px;width:auto;vertical-align:middle" title="🤔" alt="🤔" /></p>
<p dir="auto">Kind regards<br />
Mario</p>
]]></description><link>https://forum.cloudron.io/topic/14346/api-route-not-found-schema-diff</link><generator>RSS for Node</generator><lastBuildDate>Mon, 11 May 2026 18:10:18 GMT</lastBuildDate><atom:link href="https://forum.cloudron.io/topic/14346.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 01 Oct 2025 09:05:55 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to (API)Route not found &gt; schema&#x2F;diff on Thu, 02 Oct 2025 16:55:30 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/mario-0" aria-label="Profile: Mario-0">@<bdi>Mario-0</bdi></a><br />
No problem, always happy to help.</p>
]]></description><link>https://forum.cloudron.io/post/113338</link><guid isPermaLink="true">https://forum.cloudron.io/post/113338</guid><dc:creator><![CDATA[james]]></dc:creator><pubDate>Thu, 02 Oct 2025 16:55:30 GMT</pubDate></item><item><title><![CDATA[Reply to (API)Route not found &gt; schema&#x2F;diff on Thu, 02 Oct 2025 07:35:48 GMT]]></title><description><![CDATA[<p dir="auto">Perfect explanation! Thanks for your patience: know things are much clearer <img src="https://forum.cloudron.io/assets/plugins/nodebb-plugin-emoji/emoji/android/1f680.png?v=fed68e33a46" class="not-responsive emoji emoji-android emoji--rocket" style="height:23px;width:auto;vertical-align:middle" title="🚀" alt="🚀" /></p>
]]></description><link>https://forum.cloudron.io/post/113293</link><guid isPermaLink="true">https://forum.cloudron.io/post/113293</guid><dc:creator><![CDATA[Mario 0]]></dc:creator><pubDate>Thu, 02 Oct 2025 07:35:48 GMT</pubDate></item><item><title><![CDATA[Reply to (API)Route not found &gt; schema&#x2F;diff on Wed, 01 Oct 2025 17:32:15 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/mario-0" aria-label="Profile: Mario-0">@<bdi>Mario-0</bdi></a></p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mario-0" aria-label="Profile: Mario-0">@<bdi>Mario-0</bdi></a> said in <a href="/post/113265">(API)Route not found &gt; schema/diff</a>:</p>
<blockquote>
<p dir="auto">With parsing json to yaml</p>
</blockquote>
<p dir="auto"><code>"$(yq .data schema.json)"</code> does not parse JSON to YAML.<br />
The command above returns the value inside the <code>"data":{}</code> object and <code>yq</code> does garbage in garbage out JSON&lt;=&gt;JSON.<br />
Using <code>yq</code> here might have been a little misleading.</p>
<p dir="auto">I use the tool <a href="https://github.com/mikefarah/yq" target="_blank" rel="noopener noreferrer nofollow ugc">yq</a> because, in my opinion, it offers a better feature set then <a href="https://github.com/jqlang/jq" target="_blank" rel="noopener noreferrer nofollow ugc">jq</a> which is just for JSON.</p>
<p dir="auto">The data you get from <code>/schema/snapshot</code> is nested inside the object <code>"data":{}</code> so in order to use the data you have to "step into" the <code>.data</code> object.<br />
That is what I am doing with <code>$(yq .data schema.json)</code>.<br />
Same with the response from <code>/schema/diff</code>.<br />
To POST the JSON inside <code>"data":{}</code> you have to "step into" the <code>.data</code> object.</p>
<p dir="auto">Example:</p>
<pre><code>curl --request GET --header 'Authorization: Bearer kJ7B6RXawG7C6Hc14AWpturoM3R_5t-r' https://directus.cloudron.dev/schema/snapshot
{"data":{"version":1,"directus":"11.12.0","vendor":"postgres","collections":[{"collection":"Cloudron_Forum_Example","meta":{"accountability":"all","archive_app_filter":true,"archive_field":null,"archive_value":null,"collapse":"open","collection":"Cloudron_Forum_Example","color":null,"display_template":null,"group":null,"hidden":false,"icon":null,"item_duplication_fields":null,"note":null,"preview_url":null,"singleton":false,"sort":null,"sort_field":null,"translations":null,"unarchive_value":null,"versioning":false},"schema":{"name":"Cloudron_Forum_Example"}}],"fields":[{"collection":"Cloudron_Forum_Example","field":"id","type":"integer","meta":{"collection":"Cloudron_Forum_Example","conditions":null,"display":null,"display_options":null,"field":"id","group":null,"hidden":true,"interface":"input","note":null,"options":null,"readonly":true,"required":false,"sort":1,"special":null,"translations":null,"validation":null,"validation_message":null,"width":"full"},"schema":{"name":"id","table":"Cloudron_Forum_Example","data_type":"integer","default_value":"nextval('\"Cloudron_Forum_Example_id_seq\"'::regclass)","max_length":null,"numeric_precision":32,"numeric_scale":0,"is_nullable":false,"is_unique":true,"is_indexed":false,"is_primary_key":true,"is_generated":false,"generation_expression":null,"has_auto_increment":true,"foreign_key_table":null,"foreign_key_column":null}},{"collection":"Cloudron_Forum_Example","field":"Data_Input_Text","type":"string","meta":{"collection":"Cloudron_Forum_Example","conditions":null,"display":null,"display_options":null,"field":"Data_Input_Text","group":null,"hidden":false,"interface":"input","note":null,"options":null,"readonly":false,"required":false,"sort":2,"special":null,"translations":null,"validation":null,"validation_message":null,"width":"full"},"schema":{"name":"Data_Input_Text","table":"Cloudron_Forum_Example","data_type":"character varying","default_value":null,"max_length":255,"numeric_precision":null,"numeric_scale":null,"is_nullable":true,"is_unique":false,"is_indexed":false,"is_primary_key":false,"is_generated":false,"generation_expression":null,"has_auto_increment":false,"foreign_key_table":null,"foreign_key_column":null}}],"relations":[]}}
</code></pre>
<p dir="auto">for better understanding:</p>
<pre><code class="language-bash">{"data":{INSIDE_HERE_IS_THE_DATA_YOU_WANT}}
</code></pre>
<p dir="auto">If you put the whole JSON Object inside a visualizer like e.g. <a href="https://jsoncrack.com/editor" target="_blank" rel="noopener noreferrer nofollow ugc">https://jsoncrack.com/editor</a> the visual might help.</p>
<p dir="auto"><img src="/assets/uploads/files/1759338884826-3829ea0d-db2c-4b16-9a22-598a72de1d5c-image-resized.png" alt="3829ea0d-db2c-4b16-9a22-598a72de1d5c-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">You can also append <code>yq</code> to the CURL request so you get the data directly.<br />
I also added <code>--prettyPrint</code> and <code>--output-format=json</code> for bedder readability here in the forum.<br />
Note: <code>yq</code> can work with <code>yaml</code> and <code>json</code> and with certain parameters, like <code>--prettyPrint</code> the default output is <code>yaml</code>, so you need to define <code>--output-format=json</code>.</p>
<pre><code class="language-bash">curl -s --request GET --header 'Authorization: Bearer kJ7B6RXawG7C6Hc14AWpturoM3R_5t-r' https://directus.cloudron.dev/schema/snapshot | yq .data --prettyPrint --output-format=json

{
  "version": 1,
  "directus": "11.12.0",
  "vendor": "postgres",
  "collections": [
    {
      "collection": "Cloudron_Forum_Example",
      "meta": {
        "accountability": "all",
        "archive_app_filter": true,
        "archive_field": null,
        "archive_value": null,
        "collapse": "open",
        "collection": "Cloudron_Forum_Example",
        "color": null,
        "display_template": null,
        "group": null,
        "hidden": false,
        "icon": null,
        "item_duplication_fields": null,
        "note": null,
        "preview_url": null,
        "singleton": false,
        "sort": null,
        "sort_field": null,
        "translations": null,
        "unarchive_value": null,
        "versioning": false
      },
      "schema": {
        "name": "Cloudron_Forum_Example"
      }
    }
  ],
  "fields": [
    {
      "collection": "Cloudron_Forum_Example",
      "field": "id",
      "type": "integer",
      "meta": {
        "collection": "Cloudron_Forum_Example",
        "conditions": null,
        "display": null,
        "display_options": null,
        "field": "id",
        "group": null,
        "hidden": true,
        "interface": "input",
        "note": null,
        "options": null,
        "readonly": true,
        "required": false,
        "sort": 1,
        "special": null,
        "translations": null,
        "validation": null,
        "validation_message": null,
        "width": "full"
      },
      "schema": {
        "name": "id",
        "table": "Cloudron_Forum_Example",
        "data_type": "integer",
        "default_value": "nextval('\"Cloudron_Forum_Example_id_seq\"'::regclass)",
        "max_length": null,
        "numeric_precision": 32,
        "numeric_scale": 0,
        "is_nullable": false,
        "is_unique": true,
        "is_indexed": false,
        "is_primary_key": true,
        "is_generated": false,
        "generation_expression": null,
        "has_auto_increment": true,
        "foreign_key_table": null,
        "foreign_key_column": null
      }
    },
    {
      "collection": "Cloudron_Forum_Example",
      "field": "Data_Input_Text",
      "type": "string",
      "meta": {
        "collection": "Cloudron_Forum_Example",
        "conditions": null,
        "display": null,
        "display_options": null,
        "field": "Data_Input_Text",
        "group": null,
        "hidden": false,
        "interface": "input",
        "note": null,
        "options": null,
        "readonly": false,
        "required": false,
        "sort": 2,
        "special": null,
        "translations": null,
        "validation": null,
        "validation_message": null,
        "width": "full"
      },
      "schema": {
        "name": "Data_Input_Text",
        "table": "Cloudron_Forum_Example",
        "data_type": "character varying",
        "default_value": null,
        "max_length": 255,
        "numeric_precision": null,
        "numeric_scale": null,
        "is_nullable": true,
        "is_unique": false,
        "is_indexed": false,
        "is_primary_key": false,
        "is_generated": false,
        "generation_expression": null,
        "has_auto_increment": false,
        "foreign_key_table": null,
        "foreign_key_column": null
      }
    }
  ],
  "relations": []
}
</code></pre>
<p dir="auto">I hope my explanation made it a little more understandable.</p>
]]></description><link>https://forum.cloudron.io/post/113277</link><guid isPermaLink="true">https://forum.cloudron.io/post/113277</guid><dc:creator><![CDATA[james]]></dc:creator><pubDate>Wed, 01 Oct 2025 17:32:15 GMT</pubDate></item><item><title><![CDATA[Reply to (API)Route not found &gt; schema&#x2F;diff on Wed, 01 Oct 2025 16:09:19 GMT]]></title><description><![CDATA[<p dir="auto">Thanks a lot for your support 🤩</p>
<p dir="auto">The "problem" was that I tried to send "pure" JSON to the diff-endpoint and this ended up in <em>route not found</em> (IMO not the best hint).<br />
With parsing json to yaml <code>--data "$(yq .data schema.json)"</code> the endpoint worked like expected.</p>
<p dir="auto">But why ist JSON not working!?</p>
<blockquote>
<p dir="auto">Compare the current instance's schema against the schema snapshot in JSON request body and retrieve the difference. [...] Alternatively, upload a JSON or YAML schema file. (ref: <a href="https://directus.io/docs/api/schema#retrieve-schema-snapshot" target="_blank" rel="noopener noreferrer nofollow ugc">https://directus.io/docs/api/schema#retrieve-schema-snapshot</a>)</p>
</blockquote>
<p dir="auto">Also I'm wondering if my approach is the "best" solution:</p>
<ul>
<li>schema/snapshot &gt; prod.json</li>
<li>work on the snapshot schema locally and track/commit changes to git-repo (prod.json &gt; local.json)</li>
<li>schema/diff (edited) local.json against server &gt; diff.json</li>
<li>schema/apply diff.json on server</li>
</ul>
<p dir="auto">Thanks for your support<br />
Mario</p>
]]></description><link>https://forum.cloudron.io/post/113265</link><guid isPermaLink="true">https://forum.cloudron.io/post/113265</guid><dc:creator><![CDATA[Mario 0]]></dc:creator><pubDate>Wed, 01 Oct 2025 16:09:19 GMT</pubDate></item><item><title><![CDATA[Reply to (API)Route not found &gt; schema&#x2F;diff on Wed, 01 Oct 2025 10:27:15 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/mario-0" aria-label="Profile: Mario-0">@<bdi>Mario-0</bdi></a></p>
<p dir="auto">Setting a user token to make the API calls less difficult but <code>auth/login</code> can also be used.<br />
Create a collection and added a <code>test_input</code> field.</p>
<p dir="auto">Getting the current schema and storing it into <code>schema.json</code></p>
<pre><code class="language-bash">curl --request GET --header 'Authorization: Bearer 3F410Ia783fuxm3OanzRIVyMzXS3Y77f' https://io.directus9.cloudronapp.cloudron.dev/schema/snapshot &gt; schema.json
</code></pre>
<p dir="auto">Adding another test Input field and store it to <code>schema2.json</code>.<br />
Getting a snapshot again:</p>
<pre><code class="language-bash">curl --request GET --header 'Authorization: Bearer 3F410Ia783fuxm3OanzRIVyMzXS3Y77f' https://io.directus9.cloudronapp.cloudron.dev/schema/snapshot &gt; schema2.json
</code></pre>
<p dir="auto">Getting the diff and storing it into <code>diff.json</code>:</p>
<pre><code class="language-bash">curl --request POST -H "Content-Type: application/json" --data "$(yq .data schema.json)" --header 'Authorization: Bearer 3F410Ia783fuxm3OanzRIVyMzXS3Y77f' https://io.directus9.cloudronapp.cloudron.dev/schema/diff &gt; diff.json
</code></pre>
<p dir="auto">Applying the <code>diff.json</code>.</p>
<pre><code>curl --request POST -H "Content-Type: application/json" --data "$(yq .data diff.json)" --header 'Authorization: Bearer 3F410Ia783fuxm3OanzRIVyMzXS3Y77f' https://io.directus9.cloudronapp.cloudron.dev/schema/apply
</code></pre>
<p dir="auto">I can see in the WebUI that the Schema was reverted with the diff.</p>
]]></description><link>https://forum.cloudron.io/post/113231</link><guid isPermaLink="true">https://forum.cloudron.io/post/113231</guid><dc:creator><![CDATA[james]]></dc:creator><pubDate>Wed, 01 Oct 2025 10:27:15 GMT</pubDate></item></channel></rss>