# 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 almost all operations within your Sleekplan product (e.g. create, update or delete items and comments). The API key you use to authenticate the request determines whether the request is made by you. The Sleekplan API differs for every account as we release new versions and tailor functionality. Log in to see docs customized to your version of the API, with your test key and data.

Base url

https://api.sleekplan.com/public/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 ?token=4eC39HqLyjWDarjtT1zdp7dc.

If you need to authenticate via bearer auth (e.g., for a cross-origin request), use -H "Authorization: Bearer 4eC39HqLyjWDarjtT1zdp7dc" instead of -u 4eC39HqLyjWDarjtT1zdp7dc. 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/charges \
  -u 4eC39HqLyjWDarjtT1zdp7dc:

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 Stripe'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.

# Endpoints

Method Endpoint Description
GET /items Get feedback items
GET ---

# Examples (GET feedback items)

curl https://api.sleekplan.com/public/v1/feedback/1/items
?type=all&sort=trend&filter=open&page=0 \
  -u 4eC39HqLyjWDarjtT1zdp7dc: \
  -G
{
    "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://sleekplan-storage.s3.amazonaws.com/..."
                }
            },
        }
    }
}