Back to top

Please, Dont Hack Me API

Please, Dont Hack Me is a simple, private, and free file host. (don’t hack plz)

Authentication

Please, Dont Hack Me uses a bearer style authentication using tokens. These tokens can be aquired from the users dashboard. The token 0e5p0djfuvnhc4ub6gai69bbe8a80ph7qpns68gij42lmmis0svh will be used as an example token, and does not work in production. All API requests must have the following header, substituting the token with yours.

Authorization: bearer 0e5p0djfuvnhc4ub6gai69bbe8a80ph7qpns68gij42lmmis0svh

Caution

Make sure you replace the example token with your own token.

Media Types

This API will always return JSON as a response. The request can be either JSON or url encoded.

Error States

The common HTTP Response Status Codes are used. In addition, the response from the server will include {success: false} and an error message.

Code Name Description
200 OK The request has succeeded.
401 Unauthorized The request requires user authentication
403 Forbidden The server understood the request, but is refusing to fulfill it due to.
412 Precondition Failed The request is missing a required parameter .
418 I’m a Teapot I’m a Teapot.
420 Enhance Your Calm Just slow down a bit, dude.
500 Internal Server Error A generic server error message, something broke.

User

Interact with the user object.

Get User

Get User
GET/api/user/{?attribute}

This endpoint returns the User’s information

The User resource has the following attributes:

  • success

  • name

  • token

  • premium

  • files

If the parameter attribute is unspecified, the endpoint will return all of the attributes, otherwise, it will only be limited to the attribute specicified.

Example URI

GET https://please.dont-hack.me/api/user/?attribute=files
URI Parameters
HideShow
attribute
string (optional) Example: files

Specific attribute of the user to retrieve.

Request
HideShow
Headers
Authorization: bearer 0e5p0djfuvnhc4ub6gai69bbe8a80ph7qpns68gij42lmmis0svh
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "success": true,
  "name": "pixiys",
  "token": "0e5p0djfuvnhc4ub6gai69bbe8a80ph7qpns68gij42lmmis0svh",
  "premium": false,
  "files": [
    {
      "originalname": "10dmivm.png",
      "mimetype": "image/png",
      "filename": "22igbpt.png",
      "size": 82426,
      "url": "https://please.dont-hack.me/22igbpt.png",
      "collection": "wow"
    }
  ]
}

File

Endpoints relating to file manipulation.

Upload a File

Upload a File
POST/api/upload

Upload a file to the server. The central feature of this service. Files should be attached with multipart/form-data

The Upload resource has the following attributes:

  • success

  • files

Example URI

POST https://please.dont-hack.me/api/upload
Request
HideShow
Headers
Authorization: bearer 0e5p0djfuvnhc4ub6gai69bbe8a80ph7qpns68gij42lmmis0svh
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "success": true,
  "files": [
    {
      "originalname": "Blmq2QnIIAAWyO7.jpg",
      "mimetype": "image/jpeg",
      "filename": "2r2ud88.jpg",
      "size": 8127,
      "url": "https://please.dont-hack.me/2r2ud88.jpg",
      "collection": ""
    }
  ]
}
Response  412
HideShow
Headers
Content-Type: application/json
Body
{
  "success": false,
  "message": "No files provided"
}

Change Collection of a File

Change Collection of a File
PATCH/api/collection

Updates the collection of a file.

The Delete resource has the following attributes:

  • success

  • message

  • collection

Example URI

PATCH https://please.dont-hack.me/api/collection
Request
HideShow
Headers
Authorization: bearer 0e5p0djfuvnhc4ub6gai69bbe8a80ph7qpns68gij42lmmis0svh
Body
{
  "file": "2r2ud88.jpg",
  "collection": "test"
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "success": true,
  "message": "Updated collection",
  "collection": "test"
}
Response  412
HideShow
Headers
Content-Type: application/json
Body
{
  "success": false,
  "message": "No file provided"
}

Delete a File

Delete a File
DELETE/api/delete

Deletes a file from a server and database.

The Delete resource has the following attributes:

  • success

  • message

  • file

Example URI

DELETE https://please.dont-hack.me/api/delete
Request
HideShow
Headers
Authorization: bearer 0e5p0djfuvnhc4ub6gai69bbe8a80ph7qpns68gij42lmmis0svh
Body
{
  "file": "2r2ud88.jpg"
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "success": true,
  "message": "File deleted",
  "file": "2r2ud88.jpg"
}
Response  401
HideShow
Headers
Content-Type: application/json
Body
{
  "success": false,
  "message": "Not owner of file"
}
Response  403
HideShow
Headers
Content-Type: application/json
Body
{
  "success": false,
  "message": "File is premium"
}
Response  412
HideShow
Headers
Content-Type: application/json
Body
{
  "success": false,
  "message": "No file provided"
}
Response  500
HideShow
Headers
Content-Type: application/json
Body
{
  "success": false,
  "message": "File does not exist"
}

Premium

These endpoints can only be accessed with premium accounts

Upload a Premium File

Upload a Premium File
POST/api/premium/upload

Upload a file to the server. Files should be attached with multipart/form-data

Premium api keeps the original file name and seperates the file into its own user folder.

The Upload resource has the following attributes:

  • success

  • files

Example URI

POST https://please.dont-hack.me/api/premium/upload
Request
HideShow
Headers
Authorization: bearer 0e5p0djfuvnhc4ub6gai69bbe8a80ph7qpns68gij42lmmis0svh
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "success": true,
  "files": [
    {
      "originalname": "Blmq2QnIIAAWyO7.jpg",
      "mimetype": "image/jpeg",
      "filename": "2r2ud88.jpg",
      "size": 8127,
      "url": "https://please.dont-hack.me/pixiys/Blmq2QnIIAAWyO7.jpg",
      "collection": "",
      "premium": true
    }
  ]
}
Response  401
HideShow
Headers
Content-Type: application/json
Body
{
  "success": false,
  "message": "Unauthorized"
}
Response  412
HideShow
Headers
Content-Type: application/json
Body
{
  "success": false,
  "message": "No files provided"
}

Delete a Premium File

Delete a Premium File
DELETE/api/premium/delete

Deletes a file from a server and database.

You must use premium delete for premium files.

The Delete resource has the following attributes:

  • success

  • message

  • file

Example URI

DELETE https://please.dont-hack.me/api/premium/delete
Request
HideShow
Headers
Authorization: bearer 0e5p0djfuvnhc4ub6gai69bbe8a80ph7qpns68gij42lmmis0svh
Body
{
  "file": "Blmq2QnIIAAWyO7.jpg"
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "success": true,
  "message": "File deleted",
  "file": "Blmq2QnIIAAWyO7.jpg"
}
Response  401
HideShow
Headers
Content-Type: application/json
Body
{
  "success": false,
  "message": "Unauthorized"
}
Response  401
HideShow
Headers
Content-Type: application/json
Body
{
  "success": false,
  "message": "Not owner of file"
}
Response  403
HideShow
Headers
Content-Type: application/json
Body
{
  "success": false,
  "message": "File is not premium"
}
Response  412
HideShow
Headers
Content-Type: application/json
Body
{
  "success": false,
  "message": "No file provided"
}
Response  500
HideShow
Headers
Content-Type: application/json
Body
{
  "success": false,
  "message": "File does not exist"
}

Generated by aglio on 20 Nov 2018