How to drive the saggerhub api
Hi. It appears that I should be able to use swaggerhub to pull data from my WA database with the API, but I can't figure out how to do this because the code in the code window of swagger is 'read only'. I can see that I have to change it so that it points to my WA site, and although I have an option to enter API key to authenticate, there seems no way to change the site. Help appreciated
I have to admit, authorization with login/password through swaggerhub stopped working. Authorization with API key (2-nd in a list) still works.
I can recommend to use one of these options:
1 POSTMAN – is a great tool to work with API. It is possible to import swagger description.
2 Use our test tool at API browser. It is a web application located at https://api.wildapricot.org/ui/home/requestoauthtoken
I did try the OAuth with password method too, but just to be sure I tried again. Firstly, I assume I use pwd/user of an admin of the WA site (I've tried two valid admin details). I added clientID and secret that I know to work already. Continually get a popup asking for user/pwd.
I then tried with asking for "type: basic auth" which only needs user/pwd and I find out that my admin users are seen as invalid: "auth errorError: Unauthorized, error: invalid_client" so I'm not able to pass the Auth stage with those user details.
Finally I tried OAuth with clientCredentials, using clientId and secret that I am already able to pull data with in my actual app. I get error: "auth errorError: Bad Request, error: unauthorized_client, description: Client is not authorized to use this grant type."
What in fact is the 'client' in this case? Is it the WA account? Or is it something to do with how swaggerhub attempts to validate? It seems the problem is in this (unless I totally have overlooked something)
Looks like you use "OAuth2, accessCode" mode to access api. This mode is described in swagger specification, but is it not possible to use it from SwaggerHub interface. I recommend to use "OAuth2, password" or "OAuth2, application" mode from SwaggerHub interface.
I changed order of authorization modes, so that "OAuth2, password" will be the first in the list. Please give it a try and let me know if something goes wrong.
Thanks Dmitry, this is where I am having the problems - when I use the auth button, it asks for client ID and secret only. I enter valid data for these and select scope, click 'authorise' and a new page opens to:
Obviously this fails (with "website not found" because it is pointing to "your_organisation" but it is not clear how I can change this. That is why I mentioned that the API was read-only. Is there another way to point this authentication to the actual client site?
Have the same issue. To get around this, I used the C# sample program on https://github.com/WildApricot/ApiSamples and prevailed upon it to get my data.