Before you can make requests to the Wazoku API, you'll need to authenticate with the API.
You can authenticate with our API by obtaining either an API token or OAuth2 access token.
Note: Your access token carries many privileges, so be sure to keep it secure! Do not share your access token in a publicly accessible area such as GitHub, client-side code, and so forth. It's only intended for secure server-to-server communication.
Table of contents
If you're a site admin, you can generate one or more API tokens for yourself or another user. The token gives you unlimited access to the API endpoints on behalf of the user that's visiting the site.
Log in to your platform site as a site Admin.
Select Settings > Admin Panel > Integrations > Public API Tokens.
Enter a user's email address and a memorable name for the API token.
Click Generate.
You will receive an email with a link to your API token.
Note: It’s recommended that you copy the API token, as once you've viewed your API token, you won’t be able to see it again on the access page.
Here's an example request you can make using curl:
curl 'https://public-api.wazoku.com/api/v4/challenges' -H 'Authorization: Token <token_value>'
Before you can get your access token, you'll need to register your app.
The registration endpoint is https://<platform_site_domain>/oauth2/applications/register/
Log in to your platform site as a site Admin.
Register your application at https://<platform_site_domain>/oauth2/applications/register/
Specify the below parameters on the application form:
Name: App name
Redirect URI: Where to redirect and send your temporary authorization code afterward.
Click Save.
Note: The
client_id
andclient_secret
are automatically generated, and the registered app will be linked to the platform site domain used to create the app.Tip: The
redirect_uri
you specify should have a way to display the code passed down with the URL, so it's parsed correctly, and it becomes easier for you to quickly use it in your operations.
The authorization endpoint is https://<platform_site_domain>/oauth2/authorize/
Submit a GET request to the authorization endpoint https://<platform_site_domain>/oauth2/authorize/?client_id=<client_id>&response_type=code&redirect_uri=<redirect_uri>
When prompted in the browser, click Authorize.
The OAuth 2.0 dialog will redirect the user's browser via HTTP 302 to the redirect_uri
with an authorization code appended:
https://[:redirect_uri]?code=[:code]
.
The token endpoint is https://<platform_site_domain>/oauth2/token/
Submit a POST request to the token endpoint https://<platform_site_domain>/oauth2/token/
Specify the below parameters in the request body:
client_id: <client_id>
<client_secret>
<oauth_client_redirect_uri>
<code>
An access token will be returned, which can be used to make further requests to the Wazoku API.
Once you have your access token, you can test it by sending a test request to:
curl 'https://public-api.wazoku.com/api/v4/challenges?access_token=<access_token>'
You can also get an access token by logging in to your platform site using the login endpoint https://<platform_site_domain>/api/v4/authorization/login
Submit a POST request to the login endpoint https://<platform_site_domain>/api/v4/authorization/login/
Specify the below parameters:
domain: <platform_site_domain>
<client_id>
<your_password>
<your_username>
An access token will be returned as part of the response.
Service accounts are a special Wazoku user account that can access the public API and have permission to read/write content on behalf of other users.
If you would like a user account created, please contact our support team at support@wazoku.com.
Once you have a service account, you can make requests on behalf of another user in a couple of ways:
To indicate which user your request should be made on behalf of, you can add the following header and identifiers to your request:
SA-USER-ID: email:other_user@wazoku.com
SA-USER-ID: external-id:1A2B3C4D
Here's an example request using curl:
curl 'https://public-api.wazoku.com/api/v4/challenges' -H 'SA-USER-ID: email:other_user@wazoku.com'
For GET requests, you can add a query string parameter and the same identifiers to indicate which account to use:
curl 'https://public-api.wazoku.com/api/v4/challenges?SA-USER-ID=email:other_user@wazoku.com'
Most of our listing endpoints allow you to order and filter the results.
For ordering, use order
parameter. It usually accepts at least created
and modified
. To reverse the order, just put -
before it (e.g. -created
).
For filtering, lots of options are available. For example, to filter ideas by number of comments, use num_comments
parameter. Its format: [min_value]..[max_value]
, either minimal or maximal value can be omitted.