Triocoder Cloud API

Last updated: June 1st, 2020

Get Started

What is it?

Triocoder Account is simple to use URL availibility checker. It tells you wheater url is available or not.

Keys

On this page you'll learn how to create request to use our API. To get started your account must be eligible to use our Triocoder Cloud API.

Go to Eligibility Request Form

How does it work?

Keys

When you send a request our server checks your API Key. It finds it in the database and increase your usage by 1. It also helps us limit usage for monetised APIs.

You can view your api keys here

Processing

Our server gets URL from your request. With help of HTTP Headers it checks if URL is online.

Construction

Info:

Communication between server and client is handled by JSON!

Request

JSON request is sent to server (https://apis.triocoder.com/cloud_api.php).

Request Example
{"key":"YOUR_API_KEY", "url":"https://example.com"}
Explanation

First element in JSON named KEY is where you put your API key accessible on Developer Console.

Second element in JSON named URL is where you put URL address that you want to check.

Response

There are 3 valid responses that server can output you.

First Response
{success: "no", msg: "Key not found."}
Explanation

Element SUCCESS was NO, which means that your request was not successful. The reason is described in element MSG.

Second Response
{success: "yes", urlOnline:false, msg: "Url offline."}
Explanation

Element SUCCESS was YES, which means that your request was successful. However, element URLONLINE suggests that the URL was not online.

Third Response
{success: "yes", urlOnline:true, msg: "Url online."}
Explanation

Element SUCCESS was YES, which means that your request was successful. Element URLONLINE suggests that the URL was online.

Code Examples

Something to help you get started.

Useful Tip:

It is recomended to use libraries to perform API requests. In our Java example library BSON is used to construct JSON for request. After that libraries OkHTTP and Okio are used to perform HTTP request.

Java Code Example
package com.your.package;

import java.io.IOException;
import org.bson.Document;
import okhttp3.Call;
import okhttp3.FormBody;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class Main {

    public static void main(String[] args) {
        //create new BSON document
        Document jsonToSend = new Document();
        
        /*ADD ITEMS TO JSON*/
        
        //Your API key
        jsonToSend.append("key", "YOUR_API_KEY");
        
        //Url that you want to check
        jsonToSend.append("url", "https://example.com");
        
        //Convert BSON document to String
        String sendRaw = jsonToSend.toJson();
        
        //Declare and create client
        OkHttpClient client = new OkHttpClient();
        
        //Create request body
        RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=UTF-8"), sendRaw);
        Request request = new Request.Builder()
                .url("https://apis.triocoder.com/cloud_api.php")
                .post(body)
                .build();
        Call call = client.newCall(request);

        
        call.enqueue(new okhttp3.Callback() {
            @Override
            public void onFailure(Call call, IOException e) {
                //Request failed, output exeption
                System.out.println("FAIL: " + e.getMessage());
            }

            @Override
            public void onResponse(Call call, Response response) throws IOException {
                //request successfull
                String serverResponse = response.body().string();
                
                //output server response
                System.out.println(serverResponse);
            }
        });
    }
}