Find is working , but not findone

System Information
  • Strapi Version: 1.22.5
  • Operating System: Mac El capitan
  • Database: Sqlite
  • Node Version:
  • NPM Version: 6.13.4
  • Yarn Version: 1.22.5

I was trying the Restaurant tutorial. After following everything
I went to settings>>roles>>public to set user-roles for category and restaurants

I found that findOne was not working when checking the URL :
http://localhost:1337/restaurants

{“statusCode”:403,“error”:“Forbidden”,“message”:“Forbidden”}

But it worked only when I selected Find:

[{“id”:1,“name”:“Biscotte Restaurant”,“description”:“Welcome to Biscotte restaurant! Restaurant Biscotte offers a cuisine based on fresh, quality products, often local, organic when possible, and always produced by passionate producers.”,“published_at”:“2020-11-01T13:32:15.775Z”,“created_at”:“2020-11-01T13:03:22.217Z”,“updated_at”:“2020-11-01T13:32:15.820Z”,“categories”:[{“id”:1,“name”:“French Food”,“published_at”:“2020-11-01T13:32:37.001Z”,“created_at”:“2020-11-01T13:05:59.429Z”,“updated_at”:“2020-11-01T13:32:37.113Z”},{“id”:2,“name”:“Brunch”,“published_at”:“2020-11-01T13:32:30.656Z”,“created_at”:“2020-11-01T13:18:17.762Z”,“updated_at”:“2020-11-01T13:32:30.747Z”}]}]

What is the problem with findone?

The URL for the GET request for findOne should be

http://localhost:1337/restaurants/:id

where you replace :id with the id number of the restaurant

1 Like

Hey, @Vishwas_Gagrani could you go to “settings”, “roles and permissions”, then make sure that the “find” option is selected for the public role? If it isn’t, then select it, and click save!