What is the difference between strapi.service() and strapi.entityService()

System Information
  • Strapi Version: 4.3.2
  • Operating System: OSX
  • Database: MYSQL
  • Node Version: 16.16.0
  • NPM Version: 8.11.0
  • Yarn Version: 1.22.19

I have gone through the documentation and the different tutorials on Strapi Blog but I am not able to figure out the difference between strapi.service() and strapi.entityService().

Also when should one be used over the other and what are the advantages?

Help will be much appreciated.

I also have been wondering the same thing. They do the same thing looks like but just have different syntax.

Yes, I dug in and it seems like it’s the same thing just being called through a different syntax.

strapi.service() is a service a plugin or content-api is running. so you can call it internaly and get data from them.

strapi.entityService() is for quarying the database it is build ontop of the Query Engine API

1 Like

I didn’t get the point :frowning:
In the documentation is not clear when to use strapi.service and which is the syntax (I think that we can refer to entityService docs??).
Furthermore I’ve noticed that when we want to replace a core action we’ve to use strapi.service, but in my tests I’ve seen that we can use also entityService, the only difference is that the enityService didn’t response with the meta object with the documented functions (find(), findOne() …) but you can use findPage() function that is not documented and you get the meta object.
I’m very confused… but yes of course I get what I want, by reading example in blog and other place, but I think that some clarification would be great!

1 Like