Code examples

Replace "00000000-0000-0000-0000-000000000000" with unique code of your Bridge (go to Bridge property for more detail e example) or use Alias to create dynamica connector.


Base Bridge Url

http://www.dataserviceapp.com/API/Get/00000000-0000-0000-0000-000000000000

Web Service Connector (ALPHA)

http://www.dataserviceapp.com/API/WS/00000000-0000-0000-0000-000000000000?WSDL

JavaScript

JQuery Ajax (jsonp)
<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>

$.ajax({
    url: "http://www.dataserviceapp.com/API/Get/00000000-0000-0000-0000-000000000000/json",
    type: "POST",
    crossDomain: true,
    dataType: "jsonp",
    cache: false,
    data: {
        pexample: 'value of parameter 1'
    },
    success: function( jsonData ) {
        alert(jsonData.bridgename);
    }
})    
                    
JQuery getJSON (jsonp)
<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
$.getJSON("http://www.dataserviceapp.com/API/Get/00000000-0000-0000-0000-000000000000/json?callback=?", function (jsonData) {
    alert(jsonData.bridgename);
});

C# (.Net, Xamarin, Mono)

Simple way
using System.Net;
...

WebClient webclient = new WebClient();
var data = webclient.DownloadString("http://www.dataserviceapp.com/API/Get/00000000-0000-0000-0000-000000000000");
Using JSON.Net
using Newtonsoft.Json.Linq;
using System.Net;
...

WebClient webclient = new WebClient();
var data = webclient.DownloadString("http://www.dataserviceapp.com/API/Get/00000000-0000-0000-0000-000000000000/json");

dynamic jsonobject = Newtonsoft.Json.JsonConvert.DeserializeObject(data);

var value = jsonobject.bridgename;
Using Linq To XML
using System.Xml.Linq;
...
XElement root = XElement.Load(@"http://www.dataserviceapp.com/API/Get/00000000-0000-0000-0000-000000000000/xml");  
IEnumerable<XElement> result = from el in root.Elements("result node") select el;  

foreach (XElement el in result)  
    Console.WriteLine(el);  

Windows PowerShell

Use ConvertFrom-Json
PS C:\> $j = Invoke-WebRequest -Uri "http://www.dataserviceapp.com/API/Get/00000000-0000-0000-0000-000000000000/json" | ConvertFrom-Json
PS C:\> $j.bridgename

PHP

Simple parse
<?php
    // copy file content into a string var
    $json_file = file_get_contents('http://www.dataserviceapp.com/API/Get/00000000-0000-0000-0000-000000000000/json');

    // convert the string to a json object
    $jfo = json_decode($json_file);

    // read the title value
    $title = $jfo->bridgename;
?>

Android

public JSONParser jsonParser = new JSONParser();

// Building Parameters ( you can pass as many parameters as you want)
List<NameValuePair> params = new ArrayList<NameValuePair>();

params.add(new BasicNameValuePair("name", name));
params.add(new BasicNameValuePair("age", 25));

// Getting JSON Object
JSONObject json = jsonParser.makeHttpRequest("http://www.dataserviceapp.com/API/Get/00000000-0000-0000-0000-000000000000/json", "POST", params);

Code example with custom configuration is available for single Bridge in Bridge property page.


Copyright © RB-Soft 2015