Public HelpRange API Documentation

Introduction

HelpRange provides API for uploading files and obtaining analytics data. The HelpRange API is organized around REST. Our API has predictable, resource-oriented URLs, and uses HTTP response codes to indicate API errors.


Authentication

Authenticate your account by including your API Key in every API request. Your API key carries many privileges, so be sure to keep it secure! Do not share your API key in publicly accessible areas such GitHub, client-side code, and so forth.

Where is my API Key?

Go to your account's profile. There you will find your API Key.

How to include it in request?

You need to put value of your API Key in HTTP header Authorization

Example:

$ curl -X GET https://www.helprange.com/public-api/directory -H 'Authorization: t7ktuxyzb7emijofz9o8852i'


Error Codes

HelpRange API uses HTTP response codes to indicate API errors

403 Forbidden - You do not have permission to use this endpoint. Probably you are using invalid API Key or trying to use directory or file of someone else.

404 Not Found - Resource related to your request was not found.

400 Bad Request - Your request is invalid probably because you are not passing valid parameters.


Endpoints

[GET] List of directories assigned to you

URL:

/public-api/directory

Example of request:

$ curl -X GET https://www.helprange.com/public-api/directory -H 'Authorization: t7ktuxyzb7emijofz9o8852i'

JSON Response:

{ "directories": [
  { "id": 17, "name": "sales_documents" },
  { "id": 28, "name": "marketing_documents" }
] }

[GET] List of files in directory

URL:

/public-api/directory/<directory_id>/file

Example of request:

$ curl -X GET https://www.helprange.com/public-api/directory/243/file -H 'Authorization: t7ktuxyzb7emijofz9o8852i'

JSON Response:

{ "files": [
  {
    "id": 250,
    "name": "marketing_copy.pdf",
    "file_links": [
        {
          "id": 264,
          "uuid": "471dcc98874d4d0cb7c3eb1874c4e3db",
          "link": "/view/471dcc98874d4d0cb7c3eb1874c4e3db",
          "name": "default"
        }
    ]
]}

[GET] Statistics of file

URL:

/public-api/file/<file_id>/statistics

Example of request:

$ curl -X GET https://www.helprange.com/public-api/file/124/statistics -H 'Authorization: t7ktuxyzb7emijofz9o8852i'

JSON Response:

{
  "engagement_score": 11.57,
  "total_views": 39,
  "avg_time_seconds": 24,
  "avg_time_per_page_seconds": [ 10, 6, 4, 9, 15, 2, 78, 73, 0, 4, 0, 0, 0, 0, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
}

[POST] Upload file to directory

Hint: using the same <file_name> and uploading different file results in overwriting old file in HelpRange

URL:

/public-api/directory/<directory_id>/upload/<file_name>

Example of request:

$ curl -X POST https://www.helprange.com/public-api/directory/38/upload/filenewname.pdf
-H 'Authorization: t7ktuxyzb7emijofz9o8852i'
-H 'content-type: multipart/form-data'
-F "file=@/upload/my_sales_document.pdf;type=application/pdf"

JSON Response (id of uploaded file and default link to document):

{
  "id": 260,
  "default_link": "/view/8956d1e7b91b47e196a8040b1d4894f8"
}