davinci api
Overview
$url is a service provided to a blog to retrieve data from other sites. It is the primary way that blogs retrieve data. $url uses the token mechanism to authenticate the current user to the site where the data is being retrieved. When making a call to a site for data, $url includes the users tokens in the HTTP POST.
Examples
The first example demonstrates retrieving data from a URL with a simple call to $url.

//Example : simple http GET request 
var data = await $url('http://www.url.com/data/');
		
The second example shows an alternate form of the first example, here the parameter is a dictionary with a property name url. This form of the call is more useful when you need to pass additional paremeters,

//Example : simple http GET request 
var data = await $url({
    url:'http://www.url.com/data/'                      
});
		
The third example demonstrates how to pass additional parameters to $url to configure its behaviour.

//Example : url POST
$url({
        url:'http://www.url.com/data/',
        type : 'POST',
        data:{
            name:'myname',
            number:10
        }
});
//params can be passed in as an array of params, in which case the response is an array of responses.

$url([{ url:'http://www.server.com' }, { url:'http://www.server2.com' }]).then(function(response){ });
$url('http://www.server.com').then(function(response){ });
		



Contents