How to access to label, placeholder fields in a schema endpoint?

I have an endpoint like this to get the schema data of this collection but in entries I only get the data type but not the custom label, placeholder or description of each entrie.
Is there a way to get this data?

https://admin.legalbusiness.app/api/content-type-builder/content-types/api::octuber-reports-2023.october-reports-2023

@BenjaminSierra
Custom labels, Placeholders and Descriptions are fields that are in table “strapi_core_store_settings”.

I believe that “naturally” there is no way to obtain this data, but if you implement a service that accesses the strapi function shown below, you can get it and return it in a custom API.


const prefixContentManager = "plugin_content_manager_configuration_content_types";
let contentID = "api::octuber-reports-2023.octuber-reports-2023";
let sqlStatement = `SELECT value FROM strapi_core_store_settings WHERE [key] = ${prefixContentManager}::${contentID}`;

const result = await strapi.db.connection.raw(sqlStatement);

console.log("Here are the ContentManager FormView json with values:", result);

I haven’t tested this code, but I believe it works, just adapt it to your return needs.

1 Like

I think you can also get access by using strapi.store.get()

you can checkout this code as reference.

Thank you! Your answer was very useful. I created this API controller using your contribution:

const { createCoreController } = require(“@strapi/strapi”).factories;

module.exports = createCoreController(
“api::octuber-reports-2023.october-reports-2023”,
({ strapi }) => ({
async schema(ctx) {
try {
const prefixContentManager =
“plugin_content_manager_configuration_content_types”;
let contentID = ctx.request.query.api;
let sqlStatement =
“SELECT * FROM strapi_core_store_settings WHERE key = '” +
prefixContentManager +
“::” +
contentID +
“'”;
const result = await strapi.db.connection.context.raw(sqlStatement);
ctx.body = JSON.parse(result[0].value);
} catch (err) {
ctx.body = err;
}
},
})
);

1 Like

I’m glad to help in any way I can, have a great day!