# Public REST API

The Sleekplan API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes and authentication.

You can use the Sleekplan API for operations within your Sleekplan product (e.g. read, create, update, or delete posts and changelog updates). The API key you use to authenticate the request determines whether the request is made by you.

Base url

https://api.sleekplan.com/v1/

# Authentication

The Sleekplan API uses API key to authenticate requests. You can view and manage your API keys in the Sleekplan Dashboard.

Your API key carry many privileges, so be sure to keep them secure! Do not share your secret API key in publicly accessible areas such as GitHub, client-side code, and so forth. Authentication to the API is performed via HTTP Basic Auth. Provide your API key as the basic auth username value. You do not need to provide a password. You can also provide the API key with an URL parameter ?api_key=96323866321ab812adf3509b1b436af5dac2b9a47.

If you need to authenticate via bearer auth (e.g., for a cross-origin request), use -H "Authorization: Bearer 96323866321ab812adf3509b1b436af5dac2b9a47" instead of -u 96323866321ab812adf3509b1b436af5dac2b9a47. All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.

curl https://api.sleekplan.com/v1/posts \
  -u 96323866321ab812adf3509b1b436af5dac2b9a47:

attention

A sample API key is included in all the examples here, which is not usable for making requests. To test requests using your account, replace the sample API key with your actual API key.

# Errors

Sleekplan uses conventional HTTP response codes to indicate the success or failure of an API request. In general: Codes in the 2xx range indicate success. Codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted, a charge failed, etc.). Codes in the 5xx range indicate an error with Sleekplans's servers (these are rare).

Success response: a successful query returns a json string with status "success" and data, which contains the resturned data.

{
    "status": "success",
    "data": {...}
}

Error response: an unsuccessful query returns a json string with status "error" and an error message.

{
    "status": "error",
    "message": "Error message ..."
}

In addition to the returned json string Sleekplan uses conventional HTTP response codes to indicate the success or failure of an API request.

HTTP Status Code Data Description
OK 200 - Everything worked as expected.
Bad Request 400 - The request was unacceptable, often due to missing a required parameter.
Unauthorized 401 - No valid API key provided.
Request Failed 402 - The parameters were valid but the request failed.
Forbidden 403 - The API key doesn't have permissions to perform the request.
Not Found 404 - The requested resource doesn't exist.

# Available Endpoints

The API is organized around the following resources:

# Feedback posts

Method Endpoint Paramter Description
GET /posts type, sort, filter, owner, search, segment, page Get a list of posts
POST /post title, type, description, user Create a new post
GET /post/ID - Get a single post
PUT /post/ID title, type, description Edit a post
DELETE /post/ID - Delete a post

# Changelog updates

Method Endpoint Paramter Description
GET /updates type, search, page Get a list of updates
POST /update title, type, description Create a new update
GET /update/ID - Get a single update
PUT /update/ID title, type, description Edit update data
DELETE /update/ID - Delete a update

# Examples (GET /posts)

curl https://api.sleekplan.com/v1/posts
?type=all&sort=trend&filter=open&page=0 \
  -u 96323866321ab812adf3509b1b436af5dac2b9a47: \
  -G

The result looks like below:

{
    "status": "success",
    "data": {
        "items": {
            "3": {
                "feedback_id": "3",
                "product_id": "1",
                "title": "Show/search for similar ideas as you [...]",
                "description": "This can help us avoid users posting a [...]",
                "status": "open",
                "trend": "0",
                "type": "user-interface",
                "total_up": "9",
                "total_down": "0",
                "total_sum": "9",
                "total_comments": "0",
                "total_ratio": "9",
                "total_subscriber": "1",
                "scoring": "0.55",
                "effort": "1",
                "created": "2020-05-22 16:49:00",
                "updated": "2020-05-22 16:49:00",
                "user": {
                    "user_id": "4",
                    "admin_id": 0,
                    "data_name": "lennishq",
                    "data_mail": "",
                    "data_img": "https://storage.sleekplan.com/..."
                }
            },
        }
    }
}