API para desarrolladores de Vivoldi

Con la API REST de Vivoldi, puedes implementar funciones automatizadas y personalizadas en cualquier entorno — ya sea un sitio web, una aplicación móvil o un sistema interno.
Está diseñada para permitirte controlar las funciones clave de forma programática desde tu servidor o aplicación, sin necesidad de acceder directamente al panel de control.

La API se puede utilizar libremente desde diversos lenguajes y plataformas como JavaScript, Python, PHP, Java, Android e iOS.
Cada funcionalidad se ofrece de manera concisa e intuitiva, mejorando significativamente la eficiencia del desarrollo.

Para utilizar la API, necesitas una clave API para autenticación. Asegúrate de almacenarla de forma segura y de que no se exponga públicamente.

✨ Notas importantes:

  • La clave API se puede cambiar una vez al mes como máximo.
  • Los usuarios del plan gratuito también pueden utilizar la API sin restricciones.
  • La frecuencia de solicitudes y la velocidad de respuesta pueden variar según el plan contratado.

Cómo llamar a la API

Request
Host: https://vivoldi.com/api/{uri}
Authorization: APIKey {Your API Key}
Content-type: application/json
User-agent: {Your User-agent}
Accept-Language: en
Simplemente añada Authorisation, Content-type a su cabecera Http y llame a la API.
Response
{
	"code": 0,
	"message": "",
	"result": Object
}
CamposDescripciónTipo
codeCódigo de respuesta. Un valor de 0 indica éxito; cualquier otro valor indica fallo.
Este código es independiente del estado HTTP y se devuelve solo si el estado HTTP está en el rango 2xx o 3xx.
int
messageIncluido solo si code no es 0. Proporciona un mensaje de error que explica el fallo.
Puede estar vacío o no aparecer en caso de éxito.
string
resultLos datos reales devueltos por la API. Según el tipo de API, el formato puede ser una cadena de texto o un objeto JSON.object

Examples:

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8"/>
	<script src="https://code.jquery.com/jquery-3.4.1.min.js" crossorigin="anonymous"></script>
</head>

<body>

<form id="exampleForm">
	<button id="btnCreateLink" type="button">Create Link</button>
</form>

<script type="text/javascript">
$(function(){
	$("#btnCreateLink").on('click', function(evt){
		evt.preventDefault();

		$.ajax({
			type: 'POST',
			url: 'https://vivoldi.com/api/link/v2/create',
			data: JSON.stringify({'url':'https://google.com','domain':'https://vvd.bz'}),
			headers: {'Authorization':'APIKey oc3w9m4ytso9mv5e8yse9XXXXXXXXXX'},
			contentType: 'application/json; charset=utf-8',
			dataType: 'json',
			timeout: 5000
		}).done(function(res){
			if (res.code === 0) {
				alert('short url: ' + res.result);
			} else {
				alert('code: ' + res.code + ', message: ' + res.message);
			}
		}).fail(function(xhr, textStatus, e){
			alert('error: ' + e);
		});
	});
});
</script>

</body>
</html>
<?php
$url = "https://vivoldi.com/api/link/v2/create";
$params = array (
	"url" => "https://www.facebook.com/vivoldi365",
	"domain" => "https://vvd.bz",
);
$body = json_encode($params);

$headers = array(
	"Authorization: APIKey oc3w9m4ytso9mv5e8yse9XXXXXXXXXX",
	"Content-Type: application/json"
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10000);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$result = curl_exec($ch);

if ($result === FALSE) {
     echo "Error sending: " . curl_error($ch);
} else {
     print_r($result);
}
curl_close($ch);
?>
package com.example;

import org.json.JSONObject;
import org.springframework.http.HttpStatus;

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class CreateLink {
    public static void main(String[] args) {
        try (HttpClient client = HttpClient.newBuilder().build()) {
            JSONObject params = new JSONObject();
            params.put("url", "https://www.facebook.com/vivoldi365");
            params.put("domain", "https://vvd.bz");

            HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create("https://vivoldi.com/api/link/v2/create"))
                .header("Content-Type", "application/json")
                .header("Authorization", "APIKey oc3w9m4ytso9mv5e8yse9XXXXXXXXXX")
                .POST(HttpRequest.BodyPublishers.ofString(params.toString()))
                .build();

            HttpResponse<String> response;
            try {
                response = client.send(request, HttpResponse.BodyHandlers.ofString());
            } catch (Exception e) {
                throw new RuntimeException(e);
            }

            if (response != null) {
                if (response.statusCode() == HttpStatus.OK.value()) {
                    String jsonString = response.body();
                    if (jsonString != null && !jsonString.isEmpty()) {
                        JSONObject json = new JSONObject(jsonString);
                        if (json.getInt("code") == 0) {
                            System.out.println("Short URL: " + json.getString("result"));
                        } else {
                            System.out.println("Failed: " + String.format("[%d] %s", json.getInt("code"), json.getString("message")));
                        }
                    }
                }
            }
        }
    }
}
Póngase en contacto con Vivoldi si necesita mejoras o modificaciones de la API REST.