C
C
chincharovpc2020-08-20 00:27:36
MySQL
chincharovpc, 2020-08-20 00:27:36

How to build Rest API correctly?

There is an entity Contacts

Contacts can be of 7 types
1. ORGANIZERS: full name, city, number, status. social networks, comment
2. CROPS: name. social networks, link, administrator, coverage, cost
3. Mass media: name. Full name. email. Contact. city. position. website. social networks
4. PITCH: public. Full name. email. contact. comment. position. coverage. social networks
5. PHOTOS: Public. FULL NAME. Email. Contact. city. comment. status. Portfolio. Reference
6. WORKERS. name, city, status. number, social networks, comment
7. SITES: name. capacity. the address. contact. city. price. rider. social network. site

common fields only a few.

Question: Should I create one table for each type or store all fields in json (in one table)?

I'm writing a Rest API.
There will be pagination, sorting and search in the fields.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Ivan Shumov, 2020-08-20
@inoise

Depends on the context, subject area and how all this data is supposed to be used. This is at least. Well, monolithic or microservice architecture.

Y
Yerlan Ibraev, 2020-08-20
@mad_nazgul

1. The Rest API has an indirect relationship to data storage, it's about accessing and manipulating data
2. The main principle of the Rest API is that each entity has a unique address (the list of entities is a separate entity).
Based on this principle, build your REST API.
And you can store as and where you like.

D
Dimonchik, 2020-08-20
@dimonchik2013

What is a good book on web api design in microservice architecture?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question