-
I've created a SQL query, and trying to call it using the api.
however this always returns 404. is there a setting I need to set? https://docs.orchardcore.net/en/latest/docs/reference/modules/Queries/#apiqueriesname I don't see any additional steps in the docs. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @weirdyang,
In the second scenario, it's possible that you are using an incorrect query name, or you are calling your API query anonymously, from the browser or from Postman, without having permission to do so. It's usually better to invoke a query by providing OAuth 2.0 authentication. I experienced a similar issue here (always try to search in the "Issues" section, not just in "Discussions", sometimes you can find helpful information). Instead, for a quick development testing, you can expose your query API endpoint by changing the "Anonymous" role permission in the "Queries (OrchardCore.Queries)" section (from the admin panel: Roles > Anonymous > Edit), in this way everybody can call your query endpoint. However, this approach is not recommended in a production environment. Also for your microservices or website, activating OAuth 2.0 authentication is always the best practice. Keep in mind that the "Anonymous" user role has limited permissions, so depending on your needs, even in development, implementing OAuth 2.0 might be better than giving permission to every single module. Additionally, if you're a new user interested in contributing to the documentation of Orchard Core, to enhance it, you can do so by editing the page directly on GitHub, in this specific case here (you can always find the same page you mentioned, in a similar path in the OrchardCore solution "docs" folder). I hope this helps, thank you. |
Beta Was this translation helpful? Give feedback.
Hi @weirdyang,
{your domain or localhost}/api/queries/queryname
?In the second scenario, it's possible that you are using an incorrect query name, or you are calling your API query anonymously, from the browser or from Postman, without having permission to do so. It's usually better to invoke a query by providing OAuth 2.0 authentication. I experienced a similar issue here (always try to search in the "Issues" section, not just in "Discussions", sometimes you can find helpful information).
Essentially, to resolv…