How to create a data collection ( not page or post )?

How to create a data collection ( not page or post ) and put in from backend and get by Apis?

Hey @biapar :wave:
Could do with a bit more information and context on this one. Be more than happy to help if you can let us know what you’re trying to do :blush:

Thanks for your reply.
I wish to create a “document type” and put in data that I’ll read/write with Api from an app. For example: I create a event model with title, photo, data from / to, description, open on/off. Then I create event from ghost panel. After that datas are read from an app. Like strapi.io ( see it ).

Thanks for providing more detail. This can be done by creating a new internal tag, called something like #events which you can tag on posts. Posts already have titles, feature images, descriptions and can include extra data in their post content. New events can be created directly in Ghost admin by adding a single tag. The API can then retrieve those events like so:

const api = new GhostContentAPI({
  url: 'https://example.ghost.io',
  hey: 'XXXXXXXXXXXXXXXXXXXXXXXXXX',
  version: "v3"
});

// fetch all posts that have #event applied in the tags
api.posts
    .browse({limit: 'all', filter: 'tag:hash-event'})
    .then((posts) => {
        posts.forEach((post) => {
            console.log(post.title);
        });
    })
    .catch((err) => {
        console.error(err);
    });

More info on retrieving filtered posts can be found here in our docs:
https://ghost.org/docs/api/v3/javascript/filtering/

Hope this helps :blush:

So, it’s not possible to create a new or complete different element custom type from post or page with custom fields.

This could be a new interesting thing to introduce.

1 Like

Using the technique explained would effectively provide the same features, plus with the use of custom views you can see all your events in one place within Ghost admin :blush:

Is there some working example or showcase?

But an editor can forget to add the tag. How to add custom fields?

Adding a tag is just the same as adding a custom field, both can be forgotten :sweat_smile:

And how to add custom field?