Our Developers API allows you to make changes to your site remotely with programming languages!
The NeoCities API is a REST API, which uses query parameters for input, and returns data in the JSON format (except for file downloads). It uses client-side HTTP AUTH to authenticate, using your user/site name and password as the credentials. It is designed to play nicely with the most common HTTP libraries available in programming languages, and can be easily used with cURL (a command-line tool for making HTTP requests you can use by opening a terminal on your computer).
That's a lot of buzz words if you're new to programming. Don't worry, it's easier than it sounds! We'll walk you through some working examples you can get started with.
Uploads files to your site. You can upload as many files as you want with a single query, as long as the entire request stays within the disk space limit. The parameter name should be the name of the file, with the extension so we know what kind of file it is (index.html).
Upload a single local file (local.html), which will be named hello.html on your site:
$ curl -F hello.html=@local.html https://USER:PASS@neocities.org/api/upload
This example uses the neocities module, which works for node.js and web browsers (via browserify). You can install it by running npm install neocities --global in your terminal.
var NeoCities = require('neocities') var api = new NeoCities('YOURUSERNAME', 'YOURPASSWORD') // Upload a file called local.html from your computer, // which will be named newfile.html on the site. api.uploadFile('newfile.html', './local.html', function(resp) { if(resp.result == 'error') throw new Error(resp.error_type+' - '+resp.message) // Display response from API console.log(resp) })