Bash Client
The Bash client simplifies interaction with the service. Download it here:
Download Bash Client | GitLab Repository
Examples
- Authentication:
./pastebin_client.sh login admin password123
- Create a Paste (with expiration and privacy):
echo "Hello World" | ./pastebin_client.sh create plaintext yes no
Creates a paste in
plaintext
format that expires in 1 day and is public. Useyes
for a private paste. - Upload a File (with expiration and privacy):
./pastebin_client.sh upload script.py python yes no
Uploads
script.py
as a Python paste that expires in 1 day and is public. Useyes
as the last argument for a private paste. - View a Paste:
./pastebin_client.sh view 1
- View Raw Content:
./pastebin_client.sh view_raw 1
- List Pastes:
./pastebin_client.sh list
- Delete a Paste:
./pastebin_client.sh delete 1
- Search Paste Contents:
./pastebin_client.sh search "search term"
- User Details:
./pastebin_client.sh details
- Mark a Paste as Favorite:
./pastebin_client.sh favorite 1
- Remove a Paste from Favorites:
./pastebin_client.sh unfavorite 1
- Download a Paste:
./pastebin_client.sh download 1
- List Favorites:
./pastebin_client.sh list_favorites
- List Pastes Shared With Others:
./pastebin_client.sh shared_with_others
- List Pastes Shared With Me:
./pastebin_client.sh shared_with_me
- Share a Paste:
./pastebin_client.sh share 1 username true
Shares paste with ID 1 with
username
, allowing edit iftrue
is passed. - Unshare a Paste:
./pastebin_client.sh unshare 1 test
- Edit a Paste (via Editor):
./pastebin_client.sh edit 1
Opens paste with ID 1 in your default editor. Upon saving and exiting, the updated content is sent to the server.
- Remove GPS Metadata from an Image:
./pastebin_client.sh remove_gps 1
Removes GPS metadata from the image associated with paste ID 1.
Curl Examples
Interact directly with the service using curl
.
- Authentication:
curl -X POST https://paste.priet.us/api/token \ -H "Content-Type: application/json" \ -d '{"username":"admin","password":"password123"}'
- Create a Paste (with expiration and privacy):
echo "Hello World" | curl -X POST https://paste.priet.us/paste \ -H "Authorization: Bearer <YOUR_TOKEN>" \ -F "c=@-" \ -F "expire=yes" \ -F "private=no"
Creates a paste that expires in 1 day and is public. Use
private=yes
to make it private. - Upload a File (with expiration and privacy):
curl -X POST https://paste.priet.us/paste \ -H "Authorization: Bearer <YOUR_TOKEN>" \ -F "c=@script.py" \ -F "expire=yes" \ -F "private=no"
Uploads
script.py
that expires in 1 day and is public. Useprivate=yes
to make it private. - View a Paste:
curl https://paste.priet.us/paste/1/json \ -H "Authorization: Bearer <YOUR_TOKEN>"
- View Raw Content:
curl https://paste.priet.us/paste/1/raw \ -H "Authorization: Bearer <YOUR_TOKEN>"
- List Pastes:
curl -H "Authorization: Bearer <YOUR_TOKEN>" https://paste.priet.us/pastes
- Delete a Paste:
curl -X DELETE https://paste.priet.us/paste/1 \ -H "Authorization: Bearer <YOUR_TOKEN>"
- Search Paste Contents:
curl -X GET https://paste.priet.us/pastes/search?q="search term" \ -H "Authorization: Bearer <YOUR_TOKEN>"
- User Details:
curl -X GET https://paste.priet.us/user/details \ -H "Authorization: Bearer <YOUR_TOKEN>"
- Mark a Paste as Favorite:
curl -X POST https://paste.priet.us/api/paste/1/favorite \ -H "Authorization: Bearer <YOUR_TOKEN>"
- Remove a Paste from Favorites:
curl -X POST https://paste.priet.us/api/paste/1/unfavorite \ -H "Authorization: Bearer <YOUR_TOKEN>"
- Download a Paste:
curl -X GET https://paste.priet.us/api/paste/1/download \ -H "Authorization: Bearer <YOUR_TOKEN>" \ -J -O
- List Favorites:
curl -X GET https://paste.priet.us/api/favorites \ -H "Authorization: Bearer <YOUR_TOKEN>"
- List Pastes Shared With Others:
curl -X GET https://paste.priet.us/api/shared_with_others \ -H "Authorization: Bearer <YOUR_TOKEN>"
- List Pastes Shared With Me:
curl -X GET https://paste.priet.us/api/shared_with_me \ -H "Authorization: Bearer <YOUR_TOKEN>"
- Share a Paste:
curl -X POST https://paste.priet.us/api/paste/1/share \ -H "Authorization: Bearer <YOUR_TOKEN>" \ -H "Content-Type: application/json" \ -d '{ "username": "test_user", "can_edit": true }'
Shares paste with ID 1 with
test_user
, allowing edit ifcan_edit
istrue
. - Unshare a Paste:
curl -X POST https://paste.priet.us/api/paste/1/unshare \ -H "Authorization: Bearer <YOUR_TOKEN>" \ -H "Content-Type: application/json" \ -d '{ "username": "test" }'
- Edit a Paste:
curl -X PUT https://paste.priet.us/api/paste/1 \ -H "Authorization: Bearer <YOUR_TOKEN>" \ -H "Content-Type: application/json" \ -d '{ "content": "Updated content here" }'
Overwrites the content of paste with ID 1 using JSON. Make sure the authenticated user has edit permission.
- Remove GPS Metadata from an Image:
curl -X POST https://paste.priet.us/api/removegps \ -H "Authorization: Bearer <YOUR_TOKEN>" \ -H "Content-Type: application/json" \ -d '{ "paste_id": 1 }'
Removes GPS metadata from the image associated with paste ID 1.