Developers //

API Reference

This page is under construction.

Welcome to the Layer7 Solutions API reference. We provide an API for you to use for your
own subreddit-specific applications or anything else you wish. Using our API you can manage
your TheSentinelBot blacklist, fetch mod matrices, mod logs, and more.

Have a question or need help? Try asking in our subreddit at /r/Layer7

Overview

The web API takes the form https://layer7.solutions/api/v1/METHOD.
For example, https://layer7.solutions/api/v1/identity.

All methods must be called using HTTPS. The response will always be in JSON format.
The properties within the response are defined in the documentation for the relevant method.

Errors

If an error occurred, there will be two properties: error and
error_description. The error code will remain constant for the given error type,
whereas the error_description is a human-readable description of the error and may change
at any time.

{
"error": "ERROR_CODE",
"error_description": "Something happened",
}

The HTTP status code will also be different from the usual 200. For example, if your
request had invalid or missing parameters then the status code will be 400 Bad request, and
if you attempt to make a request on a subreddit you don't mod then it'll be 403 Forbidden.

Authenticating

The api uses OAuth 2. If you are unsure of how to use OAuth 2, search for OAuth 2 tutorials.

And that's it! And don't forget about the 'expires_in': 3600 part of the
access_token response. You'll have to fetch a new access token every hour.

Here's a list of all our scopes for ease of copying:

Subreddit Notation

Take note that wherever you see {subreddit}, whether as part of the path or
as a query parameter value, you can use our
Subreddit Notation

However, wherever you see {srname} allows only one subreddit.

API Methods // identity

GET:/identity

Returns the current user's username, a boolean value representing whether the
user mods at least one subreddit, and some time information about the current user's activity
on the layer7.solutions website.

Limit your query to actions whose subject user is in the given set of authors.
Do not include the "/u/", just the subject username.

label: thingid

Multiple values: allowed

Limit your query to actions whose thing ID is in the given set of thing IDs.
The thing id should include the t#_ prefix.

before (optional)

Used for pagination. If this argument is present, fetching will start before the entry with the ID
that matches the value of this argument. Not inclusive of the entry with the ID.
Use before when going back a page.

after (optional)

Used for pagination. If this argument is present, fetching will start after the entry with the ID
that matches the value of this argument. Not inclusive of the entry with the ID.
Use after when going forward a page.

If both before and after are present, after will be ignored
and before will be used.

The before and after properties in datainfo are not
copies of the parameters received by the request, but rather the before and
after values you should use to traverse to the previous or next page respectively.
If before is null, then that means there is no previous page.