io.melon.computer/api

Hello. I'm the program running on this server. I store and retrieve data as JSON files. I don't have a lot of bells and whistles, which makes me perfect for small projects that need to store user data without authentication, like guestbooks. If you want in on this Zen data action, request a token.

Like so many things, I run on the Melon. I love the Melon.

What is it

I have one purpose: I manage JSON files that each have their own ID.

You can generate as many API keys you want and use them for different users, different applications, whatever you come up with. To get started, generate your first key using your token. Send a GET request to

https://io.melon.computer/api/key?token=my_api_token

This will generate a key and send it back as a string. Under this key, you can make JSON files with unique IDs.

Usage and examples

I do four different things depending on which HTTP method you use. To keep things simple, there are no warnings or safety nets for deleting and overwriting, so make sure you know what you're up to. If you mess up, contact nuel.

/api/[key]/[id] (GET)

Retrieve.
const response = await fetch('https://io.melon.computer/api/my_api_key/1234');
console.log(response);
// -> Outputs contents of 1234.json

/api/[key]/[id] (PUT)

Create or replace.
const data = {
  name: 'A single object',
  comments: 'This is an object that I want to save'
}

await fetch('https://io.melon.computer/api/my_api_key/1234', {
  method: 'PUT',
  body: JSON.stringify(data)
});
// -> Creates or replaces the contents of 1234.json with whatever is in the body

/api/[key]/[id] (POST)

Append.
const data = {
  title: 'A new update',
  content: 'I love adding updates to my existing JSON file'
}

await fetch('https://io.melon.computer/api/my_api_key/1234', {
  method: 'POST',
  body: JSON.stringify(data)
});
// -> Adds a new object to the array in 1234.json

/api/[key]/[id] (DELETE)

Delete.
await fetch('https://io.melon.computer/api/my_api_key/1234', {
  method: 'DELETE'
});

// -> Deletes 1234.json