Version: 0.9.1 (beta)
Supported client libraries: Javascript, Python
This function creates the url endpoint for api calls or widgets and can be used for all apis.
Options
makeUrl()
directly makes this obsolete, just use path directly.Throws endpoint.EndpointException
if required values are missing.
Returns
Url to be used in http requests
Javascript Examples
This example returns the url to call getItem of a mystorage DataStorage service.
// get DataStorage.getItem api url
var url = nive.endpoint.makeUrl({
'method': 'getItem',
'name': 'mystorage',
'version': 'api'
});
The same as above. But this time the domain is explicitly added to the url.
// get DataStorage.getItem api url for domain 'mydomain'
var url = nive.endpoint.makeUrl({
'method': 'getItem',
'name': 'mystorage',
'domain': 'mydomain.com',
'version': 'api'
});
If hosted on nive.io you can also simply pass the domain as my-nive-domain. It will be extended to my-nive-domain.nive.io.
// get DataStorage.getItem api url for domain 'mydomain'
var url = nive.endpoint.makeUrl({
'method': 'getItem',
'name': 'mystorage',
'domain': 'my-nive-domain',
'version': 'api'
});
The File Store service uses a hirarchical directory structure to store content. To
list the files contained in /first/second
directory you need to pass in the parameter
path
.
// get FileHost.list api url for the subtree level '/first/second'
var url = nive.endpoint.makeUrl({
'method': 'list',
'name': 'myapp',
'version': 'api',
'path': '/first/second'
});
This example returns the url to load the signup widget of the User Account service.
// get user signup widget url
var url = nive.endpoint.makeUrl({
'method': 'signup',
'version': 'widget',
'name': 'users'
});