Jump to content
WebFlake
  • 0

rest api dont work


xodiak

Question

i tryed to use rest & oAuth

 

ive got

In order to use the REST API:

  1. Download htaccess
  2. Upload it to the /api folder in your site's directory (/var/www/html/api).
  3. Rename it to '.htaccess' (with no file name).

 

The API endpoint is not giving the expected response. Check you followed the instructions correctly. The URL being tested is: https://testdomainblablabla/api/index.php?/core/hello

 

 

 

 

 

and i do all the rules ?

Edited by xodiak
Link to comment
Share on other sites

14 answers to this question

Recommended Posts

  • 0

You can find the REST API documentation of the official IPS site: https://invisioncommunity.com/developers/rest-api/index/

Using an API Key (Easy)
The community administrator can generate API keys in AdminCP → System → REST & OAuth → API Keys. Each API Key will need to be configured to which endpoints it can access.

The way to provide the API key in your request depends on the server on which the community is running. The recommended approach is HTTP Basic Auth. Send your API key as the username, with no password. For example:

<?php
$communityUrl = 'https://www.example.com/ips4/';
$apiKey = 'c7a349a1629f02cd2855a58d77646f6d';
$endpoint = '/core/hello';
	
$curl = curl_init( $communityUrl . 'api' . $endpoint );
curl_setopt_array( $curl, array(
	CURLOPT_RETURNTRANSFER	=> TRUE,
	CURLOPT_HTTPAUTH	=> CURLAUTH_BASIC,
	CURLOPT_USERPWD		=> "{$apiKey}:"
) );
$response = curl_exec( $curl );

 

  • Support Team - September 9th, 2017 - June 8, 2018
  • Junior Moderator - December 14th 2018 - November 16th, 2019
  • Designer - November 16th, 2019 - June 5th, 2020
  • Moderator - June 5th, 2020 - August 28th, 2020
Link to comment
Share on other sites

  • 0
4 minutes ago, Jeffrey said:

You can find the REST API documentation of the official IPS site: https://invisioncommunity.com/developers/rest-api/index/

Using an API Key (Easy)
The community administrator can generate API keys in AdminCP → System → REST & OAuth → API Keys. Each API Key will need to be configured to which endpoints it can access.

The way to provide the API key in your request depends on the server on which the community is running. The recommended approach is HTTP Basic Auth. Send your API key as the username, with no password. For example:


<?php
$communityUrl = 'https://www.example.com/ips4/';
$apiKey = 'c7a349a1629f02cd2855a58d77646f6d';
$endpoint = '/core/hello';
	
$curl = curl_init( $communityUrl . 'api' . $endpoint );
curl_setopt_array( $curl, array(
	CURLOPT_RETURNTRANSFER	=> TRUE,
	CURLOPT_HTTPAUTH	=> CURLAUTH_BASIC,
	CURLOPT_USERPWD		=> "{$apiKey}:"
) );
$response = curl_exec( $curl );

 

i  want to generate like you said but i have the errors ?

Link to comment
Share on other sites

  • 0
2 minutes ago, xodiak said:

i  want to generate like you said but i have the errors ?

Did you create an api key on your forum?

I checked your website and it gives the following error:

{
    "errorCode": "2S290\/6",
    "errorMessage": "NO_API_KEY"
}

 

Edited by Jeffrey
  • Support Team - September 9th, 2017 - June 8, 2018
  • Junior Moderator - December 14th 2018 - November 16th, 2019
  • Designer - November 16th, 2019 - June 5th, 2020
  • Moderator - June 5th, 2020 - August 28th, 2020
Link to comment
Share on other sites

  • 0

As the REST API documentation says:

  1.  Generate an API Key in: AdminCP → System → REST & OAuth → API Keys
  2.  Follow the instructions in the AdminCP
  • Support Team - September 9th, 2017 - June 8, 2018
  • Junior Moderator - December 14th 2018 - November 16th, 2019
  • Designer - November 16th, 2019 - June 5th, 2020
  • Moderator - June 5th, 2020 - August 28th, 2020
Link to comment
Share on other sites

  • 0
13 minutes ago, Cookie Monster said:

Did you setup furl first? If you do then it should work fine. 

Also note that some servers requires the auth key in the url and others requires it in the header when you send it. 

The user has furl enabled. He's having issues with even being able to access the REST API inside the AdminCP.

I tried to recreate, however it worked perfectly for me.

Edited by Jeffrey
  • Support Team - September 9th, 2017 - June 8, 2018
  • Junior Moderator - December 14th 2018 - November 16th, 2019
  • Designer - November 16th, 2019 - June 5th, 2020
  • Moderator - June 5th, 2020 - August 28th, 2020
Link to comment
Share on other sites

  • 0

If furl is enabled it should lot include index.php as that is non furl. 

But could be a corrupt htaccess or wrong filename for it. 

As it still can't see the htaccess file according to the admincp imo

VAEfvMI.png

Liked what i posted remember to feed me a cookie ->
Or you can add a cookie to myCookieJar

Link to comment
Share on other sites

  • 0
1 hour ago, Cookie Monster said:

If furl is enabled it should lot include index.php as that is non furl. 

But could be a corrupt htaccess or wrong filename for it. 

As it still can't see the htaccess file according to the admincp imo

furl is enabled and have a own htaccess for the main directory ! ( have to download it in acp )

 

Everything works but  rest api dont work.

 

Link to comment
Share on other sites

  • 0
4 hours ago, Cookie Monster said:

It's two different htaccess files btw. 

One is for api the other one is for the domain itself. 

i can only download 1 htacess file look at the screen, where i find the other htacess ?

Greetz

 

Close it, it was my r proxy

 

sorry haha

 

thanks for any help

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...