ClipBin Login

API Information

This API allows users to retrieve and add data to ClipBin. It includes two primary functions: get_data (GET request) and post_data (POST request).

Endpoints

1. GET /get_data

Retrieve data from the database based on specific parameters.

  • Endpoint: /get_data
  • Method: GET
  • Description: Retrieves data from the database based on the provided parameters.

Query Parameters

Parameter Type Required Description
id string Yes The unique identifier for the data.
name string No The name associated with the data.
pwd string No The password for authorization.
unlisted string No Filter for unlisted data. Accepted values: true or false.

Responses

200 OK: Successfully retrieved data.

[
    {
        "id": "URL Id",
        "name": "Sample Name",
        "text": "Sample Text",
        "time": "Saving Time"
    }
]

400 Bad Request: Missing or incorrect request parameters.

{
    "Error": "Missing Parameters!"
}
{
    "Message": "To Search, enter Id not Name with unlisted!"
}

401 Unauthorized: Authentication failed (incorrect pwd).

{
    "Error": "Incorrect Password"
}

404 Not Found: No data found.

{
    "Error": "No Data"
}

Example Request

GET /get_data?id=1&name=Sample&pwd=example_password&unlisted=false

Example Response

[
    {
        "id": "URL Id",
        "name": "Sample Name",
        "text": "Sample Text",
        "time": "Saving Time"
    }
]

2. POST /post_data

Add new data to the database.

  • Endpoint: /post_data
  • Method: POST
  • Description: Adds new data to the database with the provided details.

Request Parameters

Parameter Type Required Description
name string Yes The name associated with the data.
text string Yes The text content to be stored.
pwd string No The password for protecting the data.
unlisted string No Specify if the data should be unlisted. Accepted values: true or false.

Body Example:

{
    "name": "Sample Name",
    "text": "Sample Text",
    "pwd": "example_password",
    "unlisted": "false"
}

Responses

201 Created: Successfully added data.

{
    "id": "url_id", "Message": "Successfully added!"
}

400 Bad Request: Missing parameters or failed to add data.

{
    "Error": "Missing Parameters!"
}
{
    "Error": "Couldn't add. Something went wrong."
}

Example Request

POST /post_data
            
Body:
            
{
    "name": "Sample Name",
    "text": "Sample Text",
    "pwd": "example_password",
    "unlisted": "false"
}

Example Response

{
    "id": "clip_id", "Message": "Successfully added!"
}

Error Codes

Status Code Description
200 OK – Request succeeded.
201 Created – Resource successfully created.
400 Bad Request – Request was invalid.
401 Unauthorized – Authentication failed.
404 Not Found – Resource not found.

Authentication

(pwd) is required for retrieving protected data and optional for adding data.