Welcome to the API documentation!



What is this?

This is our API, the API that we use on our website for certain things. You can use it to retrieve specific information from our website or for any other tool that we develop.


Endpoints. GET & POST

GET & POST requests

You can retrieve specific data from our website using GET requests in any programming language with internet access. Typically, all requests have the following format:

                                    
{
    "status": 200,
    "timestamp": 1705013566,
    "data": {
        "result": "pong"
    }
}
                                        
                                    

All responses will have a "status" (status of the request), a "timestamp" (exact time when the server received the request), and "data" (container with the data, depending on the function you execute).

If an error occurs, it will be similar to this:

                                    
{
    "status": 404,
    "timestamp": 1705014353,
    "data": {
        "readable": "An error occurred while communicating with the RestStudio API!",
        "error": "The method you have called does not exist! If the method does exist, it may be due to a connection error or a recent change in the API. You can check the API status at https:\/\/status.rest-studio.com or you can view the API documentation at http:\/\/api.rest-studio.com\/docs."
    }
}
                                        
                                    

If you encounter an error, the status will be 404, and in the data, you will have two error messages. The "readable" message is a short error message that you can use to display in an interface, and the "error" message is a longer version with additional information that depends on the function you use. It may contain information that may not be suitable for display in interfaces.

Time to see some cool methods that you can use!

Events.

You can listen to our events, for example:

                                        
const evtSource = new EventSource('https://api.rest-studio.com/events/server.php');

evtSource.addEventListener('ping', (event) => {
    const data = JSON.parse(event.data);
    console.log(data); // Will log each second => {message: 'Pong!'}
});
                                        
                                    

With this you can tell if something happens on our servers using JavaScript!

Click here to see all the events!