Tying a collection to a data source or API
- Dominant language
- JavaScript
- Stars
- 19.4k
- Forks
- 3.1k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 9
Description
Tying the collection to an external data source via an API would allow for automated entry creation and decrease work required to maintain sites connecting to external API's.
For example…
```yml
{
name: "authors",
label: "Authors",
entrySourceApi: "https://api.netlify.com/my-project/users"
}
```
The authors collection would then mirror the users you have given access to access your CMS. Any additional information associated with that user can be stored in the CMS without having to store sensitive information such as passwords in your git repo.
Here is another example...
```yml
{
name: "products",
label: "Products",
entrySourceApi:: "https://api.shopify.com/34rq234f3rwev/products",
netlifyApiKeyId: "SHOPIFY_API_KEY"
}
```
Disclosure: not super familiar with Shopify's API or Netlify API keys, but you get the idea.
This way you can store data that is site specific while letting shopify manage titles, images, checkout, etc. In this case we’d need to trigger a rebuild using webhooks whenever a new product is added to Shopify so that the product entries stay up to date. At that point the product id would be added as a preconfigured hidden field via the product capability and can be used by the developer in the site.
This collection may be classified as a folder collection type but it is synced with a data source so adding via the Netlify CMS UI may not be desired at that point.
Thoughts on this approach?
Contributor guide
Assessment
This issue has not been assessed yet.