Closed bcleonard closed 4 months ago
Hi @bcleonard thanks for the feedback. You may be the first besides myself to comment on this :-)
The REST API is something fairly new and it only works in dev mode since version 2.x, i.e. if you install COPS with all the required dev
packages in composer.json
From my perspective the /restapi.php/openapi
URL works fine, as you get a functional Swagger UI interface with all the APIs working properly when you try /restapi.php
since version 2.1.4.
Of course, that's assuming you do have a working base URL for your installation. For example, in my Ubuntu wsl2 distribution I have a symlink from the COPS source repo to /var/www/html/cops with /var/www/html served with Apache, and I can access the REST API via http://localhost/cops/restapi.php for development, and similarly from my Synology NAS in production.
Does that help at all?
Hmm, actually never mind the dev mode - I moved nikic/fast-route to production around version 2.1.3 already.
The comment on the working base URL remains though, and yes, the functionality has changed a bit since the initial 1.3.6 release - sorry for the confusion.
The equivalent of the old restapi.php
would now be restapi.php/index
Note: if you have a setup that requires the use of $config['cops_full_url']
this will now be used in restapi.php in release 2.4.1
/*
* Full URL prefix (with trailing /)
* useful especially for Opensearch where a full URL is often required
* For example Mantano, Aldiko and Marvin require it.
*/
$config['cops_full_url'] = '';
Hi @bcleonard with the input above were you able to fix your homepage link?
sorry, been way to busy the last week. I had a chance to test it this morning. I'm still not able to get the either the original api nor your new openapi url.
I pulled 2.4.1. I'm not using cops_full_url
With nginx in front of the COPS site, you probably need to double-check if it is configured to support PATH_INFO first - see https://www.nginx.com/resources/wiki/start/topics/examples/phpfcgi/
Then you may need to specify cops_full_url
now in order to get the right absolute URLs instead of the relative URLs it used in older versions.
Once they're configured to reflect how you set up your environment, you should be good to go for all future versions :-)
PATH_INFO was the issue. Once I enabled that, i can now get to the old restapi via /restapi.php/index.
BTW, I did not need to set cops_full_url
Glad it worked out :-)
BTW, if the PATH_INFO hadn't worked out, only a few /restapi.php/
For all standard COPS pages you could always fall back to using the old getJSON.php?page=...
syntax too :-)
restapi.php is broken starting with release 2.1.4 (I suspect it was 2.1.3, but that was unreleased).
I noticed it when my homepage link using the api broke after the upgrade to 2.3.1.
When accessing /restapi.php, I get the following error: Fetch error Not Found /restapi.php/openapi
Please see the attached screenshots for a working/not-working.
I suspect that the openapi stuff has not been fully implemented. If that is the case, I recommend that you roll back the changes until its fully baked.