Save fetched data from IMDb into Strapi fields

System Information
  • Strapi Version: v4
  • Operating System: macOS
  • Database: MySQL
  • Node Version:
  • NPM Version:
  • Yarn Version:

Hello there, I have collection type called ‘movie’ and text field which I am adding an IMDb url
What I want to do is to create serval other fields like : rating, runtime, poster etc… and those fields will be auto filled via the data I will fetch from omdb API

I am trying to figure where is the right place for this logic? Should I use lifecycle and then fill the others fields in beforeCteate? Maybe afterCreate , and what about afterUpdate ??

I already have an IMDb service that get IMDb I’d and return the all data

Any ideas? Thanks

I don’t when you want update you other fields from url. some cases:

  • If you want write data to strapi on your IMDb service (maybe when you have new data), You can create the fields on admin panel, then use strapi’s api. docs: CRUD operations with Entity Service API - Strapi Developer Docs
  • If you want strapi auto get IMDb service data, I think it depends your requirement detail.
  • otherwise you wanna get other filed when someone’s requests offer a url, it depends whether you want store data in strapi or not. If so, beforeUpdate/beforeCreate may be your choice, otherwise extending core controller is another choice. Backend customization - Controllers - Strapi Developer Docs

Maybe more detail of your problem will help others to get ideas.