Created Web API (markdown)

Jesse Boyd 2016-08-16 00:55:21 +10:00
parent 6cdc1c3f15
commit e50a9dd508

27
Web-API.md Normal file

@ -0,0 +1,27 @@
FAWE allows you to upload or download schematics from a compatible and configured webserver.
### Relevant config options
```yml
web:
# I am already hosting a web interface for you here
url: "http://empcraft.com/fawe/"
```
### Website software
https://github.com/boy0001/plotupload + custom style
### Uploading a clipboard
If it returns null, it indicates the upload was unsuccessful.
```Java
URL url = FaweAPI.upload(clipboard, format);
```
### Downloading:
```Java
URL base = new URL(Settings.WEB.URL);
URL url = new URL(base, "uploads/" + uuid + ".schematic");
ReadableByteChannel rbc = Channels.newChannel(url.openStream());
InputStream in = Channels.newInputStream(rbc);
// Load and paste the stream (assuming it's a schematic format) etc.
EditSession editSession = ClipboardFormat.SCHEMATIC.load(file).paste(world, position, allowUndo, !noAir, (Transform) null);
```