Using Your API Key

All of the API endpoints described in this document require an API Key in the form of an OAuth 2.0 Bearer Token to be included in the authorization header of each request. The following specific instructions and examples walk through the process of using the Junkipedia API with this key.

Obtain An API Key

A valid API Key will be a string of digits mixed with upper and lower case letters. In the examples that follow, we will use Xyz123ApiKey as a placeholder for your actual API Key.

You can use your Junkipedia.org account to obtain an API Key with the following steps:

  1. Login to Junkipedia.org and navigate to your user account page from from the pulldown menu under your avatar icon in the upper right hand corner of the window.

  2. Click on "Manage API Keys".

  3. You can use any of the API Keys listed unless they are disabled. You can click "Create API Key" if there are none available.

Prepare Request Header With API Key

The header of each request will include an and authorization header line similar to the following:

  • Authorization: Bearer Xyz123ApiKey

Prepare an authorization line in this format using your own API Key.

Determine Request Method, Endpoint, Inputs, And URL

Use the list of available endpoints to select a desired endpoint and request method. For example, the GET /posts request uses the "GET" method with the "/posts" endpoint.

When issuing any request from the Junkipedia API, the endpoint is appended to the following common Base Path identifying Junkipedia's API server:

If the request includes query string input parameters, the URL will include a "?" appended after the endpoint name and followed by the URL encoded parameters. Examples of available parameters are given in the documentation for each endpoint.

If the request accepts input via the request body, it will be given in the form of a JSON object and appropriate examples will appear in the documentation for each endpoint. In general, an endpoint may accept input parameters either via query string or request body but not both ways.

Compose And Issue The Request

Using a programming language, script, or other tool, the elements mentioned above can be combined and issued as a request. The following example uses CURL to issue a GET /posts request without any input parameters.

curl --header 'Authorization: Bearer Xyz123ApiKey' \ --request GET 'https://www.junkipedia.org/api/v1/posts'

Note that the backslash character at the end of the first line in the command above is simply there to cause the newline character to be ignored so that the command can span two lines.

The following command issues a request to the same endpoint but this time passes one parameter in a URL encoded query string.

curl --header 'Authorization: Bearer Xyz123ApiKey' \ --request GET 'https://www.junkipedia.org/api/v1/posts?keyword=potus'

Last updated