OssnServices API always gives empty responses

T C Posted in Technical Support 4 years ago

Hi,
I've installed the OssnServices API v6.2 on my OSSN v5.2 (I intentionally use this version) and generated an API key. Afterwards, I'm trying to make a GET request via https://my.domain.net/community/api/1.0/user_friends?api_key_token=abcd1234&guid=4 but I'm always getting an empty response. Am I doing something wrong or did I forget something?

Thanks in advance.

Replies
German Michael Zülsdorff Replied 4 years ago

That is: We can't use 'ü' in German translations. Good to know.

German T C Replied 4 years ago

I finally found the error.
Apparently this is connected to a translation unit issue - probably because there is an ü inside my ossnservices:success translation. removing the German translation file and copying the English one to it solved the problem, which makes it quite clear that it must be an encoding problem.
Maybe someone else has this issue so this may help him as well.

German T C Replied 4 years ago

That was too quick - it still doesn't work.
If I I miss out the &guid= query parameter, I get a "user doesn't exist" message:
{ "merchant": "myCommunity", "url": "https://my.net/work/", "time_token": 1598556573, "payload": false, "code": "103", "message": "Dieser Nutzer existiert nicht" }

However, if I am adding the parameter e.g. &guid=4 to the URL, I am getting an empty response again.

German T C Replied 4 years ago

WELL that was a really stupid error:
https://url.tld/api/1.0 should be https://url.tld/api/v1.0.
it works.
Thanks a lot for your time and sorry for wasting it, Arsalan.

German T C Replied 4 years ago

By the way, the code of the OssnServices class seems to be a bit faulty, at least inside the function genKey():

return hash('ripemd256', md5() . microtime() . rand(0, 2));: the function md5() doesn't return anything if it doesn't get any parameter parsed. that's a bit weird.

German T C Replied 4 years ago

Arsalan,
I'm sorry, after some struggle setting up the OSSN installation (directory access right problems etc.) I didn't want to waste any more time setting up an installation I don't even need so I will have to go with the one I have now.

Just to make sure: does the OssnServices v6.2 work with OSSN v5.2?
Do I need to have private profiles turned off or do I need to have any special .htaccess or apache2.conf configuration set?

German T C Replied 4 years ago

No worries. However, I don't really know what you mean by FTP or PHPMyAdmin details. I'm not using PHPMyAdmin for SQL and I don't really know what to send you for FTP details.
Tomorrow I want to try it with a fresh installation of OSSN to see if it works. maybe it's an issue with my apache2 config or htaccess?

Indonesian Arsalan Shah Replied 4 years ago

I tried v6.2 and it worked fine for me. enter image description here

Indonesian Arsalan Shah Replied 4 years ago

Sorry i forgot to reply you. Maybe you can send ftp details and phpmyadmin details.

German T C Replied 4 years ago

I didn't try it on a fresh install yet but I'll try it tomorrow.
what exactly do you need from the web hosting control panel? my web server is self-hosted. it's php-apache docker container running on an Ubuntu 20.04 server.