IntroductionBefore you beginTerminologyGetting startedGroupsFilesFoldersTemplatesEmail templatesAppsErrors
Authorization
Accounts
User accounts
Retrieve an entity
You can use the path /nodes/entity to navigate through all entity instances.
Retrieve an entity
GET/nodes/entity/{path}
Parameters
path
string (optional)The entity path.Request
curl --include \--header "Content-Type: application/json" \--header "Accept: application/json" \'https://rest.smartvault.com/nodes/entity/{path}'
// Maven : Add these dependecies to your pom.xml (java6+)// <dependency>// <groupId>org.glassfish.jersey.core</groupId>// <artifactId>jersey-client</artifactId>// <version>2.8</version>// </dependency>// <dependency>// <groupId>org.glassfish.jersey.media</groupId>// <artifactId>jersey-media-json-jackson</artifactId>// <version>2.8</version>// </dependency>import javax.ws.rs.client.Client;import javax.ws.rs.client.ClientBuilder;import javax.ws.rs.client.Entity;import javax.ws.rs.core.Response;import javax.ws.rs.core.MediaType;Client client = ClientBuilder.newClient();Response response = client.target("https://rest.smartvault.com/nodes/entity/{path}").request(MediaType.APPLICATION_JSON_TYPE).header("Accept", "application/json").get();System.out.println("status: " + response.getStatus());System.out.println("headers: " + response.getHeaders());System.out.println("body:" + response.readEntity(String.class));
var request = new XMLHttpRequest();request.open('GET', 'https://rest.smartvault.com/nodes/entity/{path}');request.setRequestHeader('Content-Type', 'application/json');request.setRequestHeader('Accept', 'application/json');request.onreadystatechange = function () {if (this.readyState === 4) {console.log('Status:', this.status);console.log('Headers:', this.getAllResponseHeaders());console.log('Body:', this.responseText);}};request.send();
var request = require('request');request({method: 'GET',url: 'https://rest.smartvault.com/nodes/entity/{path}',headers: {'Content-Type': 'application/json','Accept': 'application/json'}}, function (error, response, body) {console.log('Status:', response.statusCode);console.log('Headers:', JSON.stringify(response.headers));console.log('Response:', body);});
$ENV{'PERL_LWP_SSL_VERIFY_HOSTNAME'} = 0;use LWP::UserAgent;use strict;use warnings;use 5.010;use Cpanel::JSON::XS qw(encode_json decode_json);my $ua = LWP::UserAgent->new;$ua->default_header("Content-Type" => "application/json");$ua->default_header("Accept" => "application/json");my $response = $ua->get("https://rest.smartvault.com/nodes/entity/{path}");print $response->as_string;
from urllib2 import Request, urlopenheaders = {'Content-Type': 'application/json','Accept': 'application/json'}request = Request('https://rest.smartvault.com/nodes/entity/{path}', headers=headers)response_body = urlopen(request).read()print response_body
<?php$ch = curl_init();curl_setopt($ch, CURLOPT_URL, "https://rest.smartvault.com/nodes/entity/{path}");curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);curl_setopt($ch, CURLOPT_HEADER, FALSE);curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json","Accept: application/json"));$response = curl_exec($ch);curl_close($ch);var_dump($response);
require 'rubygems' if RUBY_VERSION < '1.9'require 'rest_client'headers = {:content_type => 'application/json',:accept => 'application/json'}response = RestClient.get 'https://rest.smartvault.com/nodes/entity/{path}', headersputs response
package mainimport ("fmt""io/ioutil""net/http")func main() {client := &http.Client{}req, _ := http.NewRequest("GET", "https://rest.smartvault.com/nodes/entity/{path}", nil)req.Header.Add("Content-Type", "application/json")req.Header.Add("Accept", "application/json")resp, err := client.Do(req)if err != nil {fmt.Println("Errored when sending request to the server")return}defer resp.Body.Close()resp_body, _ := ioutil.ReadAll(resp.Body)fmt.Println(resp.Status)fmt.Println(string(resp_body))}
//Common testing requirement. If you are consuming an API in a sandbox/test region, uncomment this line of code ONLY for non production uses.//System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };//Be sure to run "Install-Package Microsoft.Net.Http" from your nuget command line.using System;using System.Net.Http;var baseAddress = new Uri("https://rest.smartvault.com/");using (var httpClient = new HttpClient{ BaseAddress = baseAddress }){httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json");using(var response = await httpClient.GetAsync("nodes/entity/{path}")){string responseData = await response.Content.ReadAsStringAsync();}}
Dim request = TryCast(System.Net.WebRequest.Create("https://rest.smartvault.com/nodes/entity/{path}"), System.Net.HttpWebRequest)request.Method = "GET"request.ContentType = "application/json"request.Accept = "application/json"request.ContentLength = 0Dim responseContent As StringUsing response = TryCast(request.GetResponse(), System.Net.HttpWebResponse)Using reader = New System.IO.StreamReader(response.GetResponseStream())responseContent = reader.ReadToEnd()End UsingEnd Using
import groovyx.net.http.RESTClientimport static groovyx.net.http.ContentType.JSONimport groovy.json.JsonSlurperimport groovy.json.JsonOutput@Grab (group = 'org.codehaus.groovy.modules.http-builder', module = 'http-builder', version = '0.5.0')def client = new RESTClient("https://rest.smartvault.com")def emptyHeaders = [:]emptyHeaders."Content-Type" = "application/json"emptyHeaders."Accept" = "application/json"response = client.get( path : "/nodes/entity/{path}", headers: emptyHeaders )println("Status:" + response.status)if (response.data) {println("Content Type: " + response.contentType)println("Body:\n" + JsonOutput.prettyPrint(JsonOutput.toJson(response.data)))}
NSURL *URL = [NSURL URLWithString:@"https://rest.smartvault.com/nodes/entity/{path}"];NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL];[request setHTTPMethod:@"GET"];[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];[request setValue:@"application/json" forHTTPHeaderField:@"Accept"];NSURLSession *session = [NSURLSession sharedSession];NSURLSessionDataTask *task = [session dataTaskWithRequest:requestcompletionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {if (error) {// Handle error...return;}if ([response isKindOfClass:[NSHTTPURLResponse class]]) {NSLog(@"Response HTTP Status code: %ld\n", (long)[(NSHTTPURLResponse *)response statusCode]);NSLog(@"Response HTTP Headers:\n%@\n", [(NSHTTPURLResponse *)response allHeaderFields]);}NSString* body = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];NSLog(@"Response Body:\n%@\n", body);}];[task resume];
NSURL *URL = [NSURL URLWithString:@"https://rest.smartvault.com/nodes/entity/{path}"];NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL];[request setHTTPMethod:@"GET"];[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];[request setValue:@"application/json" forHTTPHeaderField:@"Accept"];NSURLSession *session = [NSURLSession sharedSession];NSURLSessionDataTask *task = [session dataTaskWithRequest:requestcompletionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {if (error) {// Handle error...return;}if ([response isKindOfClass:[NSHTTPURLResponse class]]) {NSLog(@"Response HTTP Status code: %ld\n", (long)[(NSHTTPURLResponse *)response statusCode]);NSLog(@"Response HTTP Headers:\n%@\n", [(NSHTTPURLResponse *)response allHeaderFields]);}NSString* body = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];NSLog(@"Response Body:\n%@\n", body);}];[task resume];
Response
Show success object
Returns an error object if the entity being retrieved doesn't exist.
Show error object
The account ID
For every entity creation endpoint request, you are going to need the account id. To retrieve it, you can simply do a GET request to:
https://rest.smartvault.com/nodes/entity/SmartVault.Accounting.Firm?children=1
which will return something like the following object, where the "name" property or the last element of the "uri" indicates the account ID and the uri itself will be the first part of every entity creation request.