directus / v8-archive

Directus Database API — Wraps Custom SQL Databases with a REST/GraphQL API
https://docs.directus.io/api/reference.html
505 stars 204 forks source link

Reading data from api #2200

Open ingen2 opened 4 years ago

ingen2 commented 4 years ago

Feature Request

We need to add a interface to reading data from our custom web service, I mean instead of reading data from a database, data will read from an api that response is json. How can we do it?

What problem does this feature solve?

In microservice project , we have many database (with limited access on it) , and one api gateway. this feature hlep better using in microservices project.

How do you think this should be implemented?

There must be an connection beside the database connection.

for example : In create collection page, it can has source field with api or database option. When source is api user can set api options (with setting CURD links in api)

benhaynes commented 4 years ago

Interesting. What you're requesting can be done now, but only in custom interfaces. The idea of building it into the core as a datatype is pretty cool though. I defer to @rijkvanzanten on this one... the main question is: can this be done in a very generalized way (core) so that it would work or be useful to at least 80% of users who want to connect to an external dataset.

This example is old, so I don't know if it still works 100%, but we have a custom stock interface example that is similar to what you're looking to build (might be a good starting point):

https://github.com/directus/example-interface-stock

benhaynes commented 4 years ago

Also, there's a big difference between an interface (reading one external value at the field level) and a collection (reading in an entire dataset, including PK). Both are interesting ideas... but very different in implementation.

Both directions might benefit from a core cache though.