Client Code Generation in Test&Doc APIs


This new utility consists of a client code editor for the APIs of the Ontologies in the most popular programming languages, in this way we will only have to copy the code that it generates and insert it in our applications.

For this we must access the API of the Ontology that we want to invoke. In this example, it will be “APARCAMIENTOSPUBLICOSMADRIDES “. So we will access the “API MANAGER” menu, and the “APIs” submenu:

Image 001

Once here, we go to “My Subscriptions” tab:Image 004

We choose the API that we want to test. And click on the “Test & Doc” button:Image 007

Here we have information about the API and the functions it exposes for its consumption. We are going to choose the “getAll” function:

Image 010

Next we are shown the information referring to that function, and on the right part a drop-down menu called “API Invocation” will appear, in which we will choose the language we want to use to invoke the function:

Image 013

And this will generate the piece of code needed to invoke the function. We will only have to complete this code using the logged user’s token in the “x-sofia2-apikey” part:

Image 016

I have created a sample page in HTML using JQuery, to insert the code that generates us for the API method, the HTML code used for the example would be:


<!DOCTYPE html>

<meta charset=”UTF-8″>
<title>Test API</title>

$(document).ready(function() {
$(“#myButton”).click(function() {

var settings = {
“async”: true,
“crossDomain”: true,
“url”: “;,
“method”: “GET”,
“headers”: {
“x-sofia2-apikey”: “********************”

$.ajax(settings).done(function (response) {
var num =;
$(“#helloWorldDiv”).html(“Request URL:
Num Result: ” + num);




<button id=”myButton”>Test API</button>




result could be something like this:

Image 028

Client Code Generation in Test&Doc APIs


Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de

Estás comentando usando tu cuenta de Cerrar sesión /  Cambiar )

Google photo

Estás comentando usando tu cuenta de Google. Cerrar sesión /  Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión /  Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión /  Cambiar )

Conectando a %s