Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted December 18, 2024Dec 18 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
December 18, 2024Dec 18 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
January 6Jan 6 Author 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
January 6Jan 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.
January 7Jan 7 Author 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?
January 7Jan 7 You would need to pass a parameter. A generic list of all topics is not available. E.g.: /api/forums/topics?forums=6
January 11Jan 11 Author 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
January 11Jan 11 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