Urgent Help Needed: Understanding UNA API and OAuth2 Module
Hi All,
I really need some help with the above. I have spent the last few weeks trying to understand how the UNA API works without any luck. I have read the API wiki page multiple times but still have no clue how it works.
The wiki page mentions that the API is part of the OAuth2 module. My question is, how does one install this module? I also noticed that the backend API is available on the storefront as a paid module, but there is no information on what it does.
I really need help with this and am willing to pay for guidance on creating a public API, as this issue has brought my project to a halt.
Many thanks in advance.
-
-
·
LeonidS
- ·
Hello @Olu Ade !
If you mean this module https://unacms.com/view-product/oauth2-server then it is installed as any other app: via the Studio->Apps Market. Then you need to follow the instructions in the app itself. Could you please specify your purposes with API?
-
·
LeonidS
-
- · Olu Ade
-
·
In reply to LeonidS
- ·
Hello @LeonidS
What I want is the ability to automate the creation of new posts, discussions, and ads via feeds from an external source.
The idea is to write an external program (using Go, Python, etc.) that reads from an RSS feed and creates news posts, discussions, and ads based on the feed data. We currently use Flarum, which has an exposed REST API for this purpose, but Flarum no longer meets our needs. UNA doesn't have this functionality, and I was wondering if it's something that can be easily implemented.
Alternatively, is there documentation of UNA's data flow that shows how posts, discussions, and ads are created?
I would really appreciate your help on this.
Many thanks in advance.
-
Please follow UNA API documentation with secret key authentication and the provided example with curl command line on how to use this API:
-
- · InPage
- ·
@Olu Ade have you had any luck authenticating with the API.
We are not having any success.
-
- · Olu Ade
-
·
In reply to InPage
- ·
I could only get it working by using the API key. If you try to call
api.php
using the curl example from the Dev API page, it will fail due to a PHP Fatal error in theaddData
function withinmodules/base/general/classes/BxBaseModGeneralFormsEntryHelper.php
. The issue arises because the method expects an array as the second parameter, but an object is being passed instead. To resolve this, I had to check the type of the parameter and cast it to an array if necessary. With this fix, I was able to successfully create a post using curl. I hope this helps. -
- · InPage
-
·
In reply to Olu Ade
O
- ·
Thank you @Olu Ade
We are slowly starting to see some results and found some helpful information in the actual module files.
- API FILE: modules>boonex>api>classes> BxApiModule.php
- OAuth FILE: modules>boonex>oauth2>classes> BxOAuthModule.php
Please share if you find anything else that works. I'll update here if we have more success.
-
- · Olu Ade
-
·
In reply to InPage
- ·
@InPage Thank you for the update.
However, I couldn't locate the files mentioned above in my current Version 14.0.0-A3 installation. Is there something I might be overlooking?
-
-
- · Olu Ade
-
·
In reply to InPage
- ·
@InPage , seems am using a slightly older version. will install this latest version and have a play