Introduction
Welcome to the Clipboard API! With it you can: get an API key, set and get clipboard contents.
Authentication
The Request returns JSON structured like this:
{
"access_token": "",
"scope": "read write",
"refresh_token": "",
"token_type": "Bearer",
"expires_in": 36000
}
Clipboard uses API keys to allow access to the API. Use the following API endpoint to create an account and get a API key.
HTTP Request
POST https://vast-chamber-77416.herokuapp.com/sign_up
Body Parameters
| Parameter | Description |
|---|---|
| username | The username for a new account |
| password | The password associated with username |
Clipboard expects for the API key to be included in all API requests to the server in a header that looks like the following:
Authorization: Bearer API_KEY_HERE
Clipboard
Set Data
This endpoint creates a new clipboard and sets the contents.
The setData command returns JSON structured like this:
{
"id": "LxF4yGsq",
}
HTTP Request
POST https://vast-chamber-77416.herokuapp.com/api/clipboard
Body Parameters
Text Upload
| Parameter | Description |
|---|---|
| text | The text to be uploaded |
File Upload
| Parameter | Description |
|---|---|
| file | The file to be uploaded |
Get Data
This endpoint retrieves a specific clipboard's content.
HTTP Request
The response for text returns JSON structured like this:
{
"data": "text"
}
GET https://vast-chamber-77416.herokuapp.com/api/clipboard/getData/?session_id=[id]
URL Parameters
| Parameter | Description |
|---|---|
| id | The ID of the clipboard data to retrieve |
Get Metadata
This endpoint retrieves a specific clipboard media's metadata.
The response for text returns JSON structured like this:
{
"entry": {
"session_id": "LfK6nnSq",
"creation_time": "2018-04-15T22:26:29.227258Z"
},
"media_type": "Text"
}
The response for a file returns JSON structured like this:
{
"entry": {
"session_id": "x2ORXMPE",
"creation_time": "2018-04-15T23:08:51.932987Z"
},
"FileMetaData": {
"file_name": "10677856_7r6NaRe.jpg",
"file_length": 3,
"file_type": "image/jpeg"
},
"media_type": "File"
}
HTTP Request
GET https://vast-chamber-77416.herokuapp.com/api/clipboard/getMetadata/?session_id=[id]
URL Parameters
| Parameter | Description |
|---|---|
| ID | The ID of the clipboard to retrieve |
Errors
The Clipboard API uses the following error codes:
| Error Code | Meaning |
|---|---|
| 400 | Bad Request -- Your request is invalid. |
| 401 | Unauthorized -- Your API key is wrong. |
| 404 | Not Found |
| 429 | Too Many Requests |
| 500 | Internal Server Error |
| 503 | Service Unavailable |