Skip to main content

Strapi API Settings

In Strapi, there is no such thing as called format/ template for users to follow. When you create a Content Type, you will have a certain number of REST API endpoints available to interact with it. Therefore,  in order to connect to FluxStore Strapi, users must strictly follow our coding rules including collection/content types names, JSON serializer names, etc. If users wish to customize their Strapi settings, please refer to Strapi Docs for Strapi configurations and JSON-serializable plugin. However, in those cases, InspireUI will not be in charge of support services.

1. Define content types

1.1 Product content type

A Content Type, also called a model, is a type of data. The Strapi API includes by default, the user Content Type. Right now we need products, so our new Content Type is going to product (Content Types are always singular).

Here are the required steps:

  • Navigate to the Content Type Builder in the sidebar ( or http://localhost:xxxx/admin/plugins/content-type-builder).
  • Click on + Create new collection type.
  • Set Product as name.
  • Click on Continue and create the followings fields:
  1. title with Short Text type
  2. vendor with Short Text type
  3. is_featured with Boolean type
  4. is_out_of_stock with Boolean type
  5. is_active with Boolean type
  6. is_sale with Boolean type
  7. price with Number type, and decimal Number format
  8. sale_price with Number type, and decimal Number format
  9. review with Number type, and integer Number format
  10. inventory with Number type, and integer Number format
  11. images with Multiple Media type
  12. thumbnail with Single Media type
  13. video with Single Media type, support to play Video type.
  • Click on Finish
  • Click on Save, the server should restart automatically.

Question: You might realize that some fields are not used in the project at all. Why should we implement it?

Answer: Those fields might not be used at the moment. However, they will be useful in the near future when we update new features. They would minimize errors as much as possible in those cases.

1.2 Product-category content type

Similar to creating a Product content type, repeat those steps, and create a Product-category content type with those fields:

  1. title with Short Text type
  2. slug with Short Text type
  3. description with Long text type
  4. feature_image with Single Media type

1.3 Shipping content type

Create a Shipping content type with those fields:

  1. title with Short Text type
  2. description with Long Text type
  3. cost with Number type, and decimal Number format

1.4 Payment content type

Create a Payment content type with those fields:

  1. title with Short Text type
  2. description with Long Text type

1.5 User content type

Create a User content type with those fields:

  1. username with Short Text type
  2. email with Email type
  3. provider with Short Text type
  4. password with Password type
  5. resetPasswordToken with Short Text type
  6. confirmed with Boolean type
  7. blocked with Boolean type
  8. displayName with Short Text type

1.6 Order content type

Create an Order content type with just 1 field: total with decimal Number format

2. Define relations

2.1 Product relation

  • Go to Content-Types Builder at the left-hand side menu bar. Choose Product collection type then click + Add another field
  • Create a many-to-many Relation with Product-Category content type as below:

  • Also, create a many-to-many relation with Order as below:

2.2 Order relations

  • In Order content type, create a relation with Payment as below

  • Create a relation with Shipping as below

  • Also, create a relation with User as below:

3. Create some entries

When completing all of your content types, the next thing that you need to do is to create some data for it (so that we can test later). To do so, click on Products under Collection Types list on the left-hand side menu bar. You are now in the Content Manager plugin: an auto-generated user interface that lets you see and edit entries. Let's create a sample product

And the final result would look like this:

Continue creating as many entries as you want that you would like to see on your app.

4. Allow access

When you are creating a content type, Strapi created a few set of files located in api/your-content-type-name. The find route is available at http://localhost:xxxx/your-content-type-name or However, due to Strapi APIS security, any access to those URLs would be blocked by 403 forbidden error. In order to let FluxStore Strapi access your data, follow those steps:

  1. Navigate to the Settings then Roles & Permissions
  2. Click on the Public role
  3. Tick the findfindone and count checkboxes of the available routes
  4. Save.

Important: do the same thing for the authenticated role.

Now go back to, for example, http://localhost:xxxx/products or . At this point, you should be able to see your list of products.