Jump to content

Recommended Posts

Posted

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

 

 

 

  • 3 weeks later...
Posted

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

Posted

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.

Posted
21 hours ago, Jim M said:

Please also ensure that you're setting a user agent or you will get blocked.

image.thumb.png.7b842ce49d117e65ed3ad86c8b8ce532.png

 

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?

 

 

Posted

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

 

 

 

Posted

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

 CleanShot 2025-01-11 at 19.32.57.png

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...