I am developing a Citations plugin for OJS 3.3 (later also for 3.2 and 3.4). This plugin will give more accurate and detailed citations metadata. Furthermore, this plugin will also publish the metadata to external open access websites such as wikidata, croci, (crossref) etc.
For parsing the raw references, I created a PHP method/class. In the “Submit an Article” wizard I want to create a button, which will post the raw references from the textarea to a custom API endpoint. My plugin should than catch this endpoint, parse the raw references with this method/class and return the parsed citations as json. Well that’s the idea anyways.
My question is, how can I create such a custom API endpoint? Is there a plugin or core functionality I can examine and use as an example? Or can you point me in the right direction or advice me how to proceed?
If you want your own endpoint (ie - api/v1/my-custom-endpoint), the LoadHandler hook along with the API Handler documentation that @henriqueramos posted is best.
If you want to extend an existing endpoint with new routes (ie - api/v1/submissions/{id}/my-custom-route), you will want to use the APIHandler::endpoints hook.
Idea was to create a new custom API endpoint like api/v1/optimetaCitations, but maybe it’s more practical to extend submissions endpoint at this point.
I’ll give a go with the given solutions. Thanks again.