-
Notifications
You must be signed in to change notification settings - Fork 10
Setting up ShareX
This guide assumes you already have a running version of the ShareX Media Server, if you don't have a media server setup you can follow the installation guide.
Before you start, you'll first need to create an API token that can be used with ShareX requests, the API token is used to validate your image, file/text snippet uploads, and URL shortening requests, to ensure you're actually allowed to upload files.
To create an API token you can click on your account name in the navigation in the top right of the app, and then click on the API Tokens
menu item, this should move you to a page where you can create your own token, from there give the token a name, and make sure that you tick the upload permissions so the API token has the permissions to upload files to the media server.
After clicking on Create
you'll get a popup with your newly created API token, make sure to copy it so you have it for later, since it won't ever be shown to you again.
To setup a custom ShareX uploader you can navigate to: Destinations -> Custom Uploader Settings in the ShareX app.
From there create a new custom uploader, to setup everything we have to do a few things.
- Set the request method to
POST
. - Set the URL to the root of your media server, followed by the API endpoint for the type of uploader you're setting up, example
/api/images
for images. - Add an
Authorization
header to the request, and set the value toBearer <your API token>
- Set the "File from name" value to match what you're uploading, for images it would be
image
, for text files it should befile
, and for URL shortening it should beurl
. - Finally, click on the
response
tab, select the JSON option and set the URL to$json:resource_url$
, this will select the resource URL being generated by the API during the upload and make it available to you so you can copy it to your clipboard.
It should all look something like this.
Another option for quickly setting up ShareX to work with the media server is to import the requests directly into ShareX, to do this navigate to: Destinations -> Custom Uploader Settings in the ShareX app, from there copy one of the ShareX requests found below and import it.
Note: You should edit the URL that the request goes to, as-well-as the API token that is used so the requests are sent to the correct media server with proper authorization.
{
"Version": "13.1.0",
"Name": "ShareX Media Server - Images",
"DestinationType": "ImageUploader",
"RequestMethod": "POST",
"RequestURL": "http://sharex-media-server.local/api/images",
"Headers": {
"Authorization": "Bearer <your API token goes here>",
"Accept": "application/json"
},
"Body": "MultipartFormData",
"FileFormName": "image",
"URL": "$json:resource_url$"
}
{
"Version": "13.1.0",
"Name": "ShareX Media Server - Text & Files",
"DestinationType": "TextUploader, FileUploader",
"RequestMethod": "POST",
"RequestURL": "http://sharex-media-server.local/api/texts",
"Headers": {
"Authorization": "Bearer <your API token goes here>",
"Accept": "application/json"
},
"Body": "MultipartFormData",
"FileFormName": "file",
"URL": "$json:resource_url$"
}
{
"Version": "13.1.0",
"Name": "ShareX Media Server - URLs",
"DestinationType": "URLShortener",
"RequestMethod": "POST",
"RequestURL": "http://sharex-media-server.local/api/urls",
"Headers": {
"Authorization": "Bearer <your API token goes here>",
"Accept": "application/json"
},
"Body": "MultipartFormData",
"Arguments": {
"url": "$input$"
},
"URL": "$json:resource_url$"
}