Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt November 11, 2024
Remotia Posted December 18, 2024 Posted December 18, 2024 I'm wondering if there is an API to query the posts or perhaps a way to directly access the SQL data base? I'm looking to bulk migrate some data and using the public URLs is problematic with Cloudflare's anti-bot stuff that's blocking my GET requests. I believe there is some cookie or header voodoo that I'm not quiet doing right to bypass it using outgoing requests from nodejs. Thank you
Marc Posted December 18, 2024 Posted December 18, 2024 We have a REST API, which you can find more information on here https://invisioncommunity.com/developers/rest-api There is no direct access to the data on cloud, however we can provide a backup on request if required Remotia 1
Jim M Posted January 6 Posted January 6 2 minutes ago, Remotia said: Edited Let us know if we can be of assistance 🙂 SeNioR- 1
Remotia Posted January 6 Author Posted January 6 I'm still having trouble getting this working for a basic GET request mydomain.ipbhost.com/api/forums/topics I could not get basic auth to work. I just get a 500 error when I dont provide a password and use the API key as the username. When I do provide a username+password (just a fake one) I do get a 401 at least. I tried x-authorization header too, but that is also not working. Can I get an example in nodejs or postman how this baisc auth works? Thank you
Jim M Posted January 6 Posted January 6 You will want to provide the API key as both the username and password in basic auth. Please also ensure that you're setting a user agent or you will get blocked.
Remotia Posted January 7 Author Posted January 7 21 hours ago, Jim M said: Please also ensure that you're setting a user agent or you will get blocked. Thank you. Strangely, I'm seeing postman set cookies from the response headers which I find a bit strange for an API call since its not normally a browser that makes the API call. I'm wondering if I have the right URL?
Jim M Posted January 7 Posted January 7 You would need to pass a parameter. A generic list of all topics is not available. E.g.: /api/forums/topics?forums=6
Remotia Posted Saturday at 06:14 PM Author Posted Saturday at 06:14 PM This worked! I also had to spoof the user agent which I think must be a mistake for an API. And It would also be very helpful to have error messages that make sense like a 4xx error "missing parameter 'forums'" for example Thank you Jim
Daniel F Posted Saturday at 06:33 PM Posted Saturday at 06:33 PM The forums parameter isn't required, same with the user agent. If a required parameter is missing, you'll get a proper error message, EX0 - UNKNOWN_ERROR means something else, do you see any logged errors in your system log? e.g. this is my request without any parameters: <?php require 'init.php'; $url = 'http://ic5jan.test/'; $key = 'a487df1e88d6fc466fac6c8f3eb81843'; /* Fetch topics without any additional parameters */ $params = [ ]; print_r( \IPS\Http\Url::external( $url.'api/index.php?forums/topics' )->setQueryString( $params )->request()->login( $key, '' )->get()->decodeJson() ); which results in
Recommended Posts