Templates
Templates allow clients to easily store and organize files for an entity in the customer’s environment (Tax Engagement, Firm, Client, etc.).
Its management can be done using the /nodes/template resource.
All the endpoints related to templates are case sensitive, so be careful when doing the request because if you don't specify the casing properly, you will get an error object as a result of the request.
The template object
Some of the template object attributes (vaults, folders, containers and groups) refers to the SmartVault types specified below.
Show Attributes
The TemplateVault object
This is the vault that will contain all of the data associated with this Entity.
At most, there can only be one vault as the root.
Currently only SmartVault.Accounting.Client and SmartVault.Core.UserAssociation takes advantage of vaults.
Show vault attributes
The TemplateFolder object
This is the folder that will contain all of the data associated with the entity.
At most, there can only be one folder as the root.
Currently only SmartVault.Accounting.TaxEngagement, as well as other engagements, take advantage of folders.
Show folder attributes
The FolderAssociation object
Folder associations consist of tags. Documents published to the template entity that include these tags will be routed to this location. Each routing rule should only occur at most once in the entire hierarchy.
Show folder association attributes
The Tag object
Show tag attributes
Possible tag values are
Show content
The TemplateContainer object
These containers are children of the account; in other words, there is automatically a storage element to contain the SmartVault.Accounting.Firm before the firm is created. Unlike the vaults and folders elements, there can be any amount of containers as the root for a template.
Show container attributes
The TemplateGroup object
A group specifies who has access to the templates. For usage in templates, permissions are restricted to group monikers.
These group monikers are resolved dynamically by the system to produce groups’ identities.
Show group attributes
These are the group monikers that are currently supported.
Show group monikers
Template types
The full list of templates available for an account can be fetched executing the request below.
https://rest.smartvault.com/nodes/template/SmartVault Account/My Templates?children=1
Example of template names retrieval response
Show templates
Retrieve a template
Templates are located in /nodes/template/account_name/My Templates.
Parameters
account_name
stringThe user's account name.entity_definition
stringThe template name.Request
curl --include \--header "Authorization: Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==" \--header "Accept: application/json" \'https://rest.smartvault.com/nodes/templates/{AccountName}/My Templates/{EntityDefinition}'
// 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/templates/{AccountName}/My Templates/{EntityDefinition}").request(MediaType.TEXT_PLAIN_TYPE).header("Authorization", "Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==").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/templates/{AccountName}/My Templates/{EntityDefinition}');request.setRequestHeader('Authorization', 'Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==');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/templates/{AccountName}/My Templates/{EntityDefinition}',headers: {'Authorization': 'Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==','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("Authorization" => "Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==");$ua->default_header("Accept" => "application/json");my $response = $ua->get("https://rest.smartvault.com/nodes/templates/{AccountName}/My Templates/{EntityDefinition}");print $response->as_string;
from urllib2 import Request, urlopenheaders = {'Authorization': 'Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==','Accept': 'application/json'}request = Request('https://rest.smartvault.com/nodes/templates/{AccountName}/My Templates/{EntityDefinition}', headers=headers)response_body = urlopen(request).read()print response_body
<?php$ch = curl_init();curl_setopt($ch, CURLOPT_URL, "https://rest.smartvault.com/nodes/templates/{AccountName}/My Templates/{EntityDefinition}");curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);curl_setopt($ch, CURLOPT_HEADER, FALSE);curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==","Accept: application/json"));$response = curl_exec($ch);curl_close($ch);var_dump($response);
require 'rubygems' if RUBY_VERSION < '1.9'require 'rest_client'headers = {:authorization => 'Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==',:accept => 'application/json'}response = RestClient.get 'https://rest.smartvault.com/nodes/templates/{AccountName}/My Templates/{EntityDefinition}', headersputs response
package mainimport ("fmt""io/ioutil""net/http")func main() {client := &http.Client{}req, _ := http.NewRequest("GET", "https://rest.smartvault.com/nodes/templates/{AccountName}/My Templates/{EntityDefinition}", nil)req.Header.Add("Authorization", "Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==")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("authorization", "Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==");httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json");using(var response = await httpClient.GetAsync("nodes/templates/{AccountName}/My Templates/{EntityDefinition}{?acl,eprop}")){string responseData = await response.Content.ReadAsStringAsync();}}
Dim request = TryCast(System.Net.WebRequest.Create("https://rest.smartvault.com/nodes/templates/{AccountName}/My Templates/{EntityDefinition}"), System.Net.HttpWebRequest)request.Method = "GET"request.Headers.Add("authorization", "Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==")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."Authorization" = "Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ=="emptyHeaders."Accept" = "application/json"response = client.get( path : "/nodes/templates/{AccountName}/My Templates/{EntityDefinition}{?acl,eprop}", 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/templates/{AccountName}/My Templates/{EntityDefinition}"];NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL];[request setHTTPMethod:@"GET"];[request setValue:@"Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==" forHTTPHeaderField:@"Authorization"];[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];
import Foundation// NOTE: Uncommment following two lines for use in a Playground// import PlaygroundSupport// PlaygroundPage.current.needsIndefiniteExecution = truelet url = URL(string: "https://rest.smartvault.com/nodes/templates/{AccountName}/My Templates/{EntityDefinition}")!var request = URLRequest(url: url)request.addValue("Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==", forHTTPHeaderField: "Authorization")request.addValue("application/json", forHTTPHeaderField: "Accept")let task = URLSession.shared.dataTask(with: request) { data, response, error inif let response = response {print(response)if let data = data, let body = String(data: data, encoding: .utf8) {print(body)}} else {print(error ?? "Unknown error")}}task.resume()
Response
Returns a node response object pointing to the template retrieved.
Show success object
Returns an error object if any of the required parameters are wrong.
Show error object
Create a template
Parameters
account_name
stringThe user's account name.Body parameters
The request expects a template object as its body request. Check the example request below for more information.
Request
In the following example the API retrieve information pertaining to the Employee template, located in “My Templates” for the account “SmartVault”.
Headers:Authorization:Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==Accept:application/jsonBody:{"applies_to": "SmartVault.Accounting.TaxEngagement","api_name": "TaxEngagementCustomTemplate","label": "My Custom Tax Engagement Template","groups": [{"moniker": "FirmManager","name": "Firm Managers","rid": 8,"create": true},{"moniker": "AccountEmployees","name": "Employees","rid": 18,"create": false}],"folders": [{"name": "Tax Year 2012","acl": {"aces": [{"principal": "AccountEmployees","permissions": 15},{"principal": "FirmManager","permissions": 111}]},"id": "root","folders": [{"name": "Client Tax Returns","acl": {"aces": [{"principal": "FirmEmployees","permissions": 15}]},"id": "client_tax_returns","folder_association": {"tags": [{"value": "clientcopy.taxreturn.tags.accounting.smartvault.com"}]}}]}]}
curl --include \--request PUT \--header "Authorization: Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==" \--header "Accept: application/json" \--data-binary "{\"applies_to\": \"SmartVault.Accounting.TaxEngagement\",\"api_name\": \"TaxEngagementCustomTemplate\",\"label\": \"My Custom Tax Engagement Template\",\"groups\": [{\"moniker\": \"FirmManager\",\"name\": \"Firm Managers\",\"rid\": 8,\"create\": true},{\"moniker\": \"AccountEmployees\",\"name\": \"Employees\",\"rid\": 18,\"create\": false}],\"folders\": [{\"name\": \"Tax Year 2012\",\"acl\": {\"aces\": [{\"principal\": \"AccountEmployees\",\"permissions\": 15},{\"principal\": \"FirmManager\",\"permissions\": 111}]},\"id\": \"root\",\"folders\": [{\"name\": \"Client Tax Returns\",\"acl\": {\"aces\": [{\"principal\": \"FirmEmployees\",\"permissions\": 15}]},\"id\": \"client_tax_returns\",\"folder_association\": {\"tags\": [{\"value\": \"clientcopy.taxreturn.tags.accounting.smartvault.com\"}]}}]}]}" \'https://rest.smartvault.com/nodes/templates/AccountName/My Templates'
// 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();Entity<String> payload = Entity.text("{ \"applies_to\": \"SmartVault.Accounting.TaxEngagement\", \"api_name\": \"TaxEngagementCustomTemplate\", \"label\": \"My Custom Tax Engagement Template\", \"groups\": [ { \"moniker\": \"FirmManager\", \"name\": \"Firm Managers\", \"rid\": 8, \"create\": true }, { \"moniker\": \"AccountEmployees\", \"name\": \"Employees\", \"rid\": 18, \"create\": false } ], \"folders\": [ { \"name\": \"Tax Year 2012\", \"acl\": { \"aces\": [ { \"principal\": \"AccountEmployees\", \"permissions\": 15 }, { \"principal\": \"FirmManager\", \"permissions\": 111 } ] }, \"id\": \"root\", \"folders\": [ { \"name\": \"Client Tax Returns\", \"acl\": { \"aces\": [ { \"principal\": \"FirmEmployees\", \"permissions\": 15 } ] }, \"id\": \"client_tax_returns\", \"folder_association\": { \"tags\": [ { \"value\": \"clientcopy.taxreturn.tags.accounting.smartvault.com\" } ] } } ] } ]}");Response response = client.target("https://rest.smartvault.com/nodes/templates/AccountName/My Templates").request(MediaType.TEXT_PLAIN_TYPE).header("Authorization", "Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==").header("Accept", "application/json").put(payload);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('PUT', 'https://rest.smartvault.com/nodes/templates/AccountName/My Templates');request.setRequestHeader('Authorization', 'Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==');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);}};var body = "{ \'applies_to': 'SmartVault.Accounting.TaxEngagement', \'api_name': 'TaxEngagementCustomTemplate', \'label': 'My Custom Tax Engagement Template', \'groups': [ \{ \'moniker': 'FirmManager', \'name': 'Firm Managers', \'rid': 8, \'create': true \}, \{ \'moniker': 'AccountEmployees', \'name': 'Employees', \'rid': 18, \'create': false \} \], \'folders': [ \{ \'name': 'Tax Year 2012', \'acl': { \'aces': [ \{ \'principal': 'AccountEmployees', \'permissions': 15 \}, \{ \'principal': 'FirmManager', \'permissions': 111 \} \] \}, \'id': 'root', \'folders': [ \{ \'name': 'Client Tax Returns', \'acl': { \'aces': [ \{ \'principal': 'FirmEmployees', \'permissions': 15 \} \] \}, \'id': 'client_tax_returns', \'folder_association': { \'tags': [ \{ \'value': 'clientcopy.taxreturn.tags.accounting.smartvault.com' \} \] \} \} \] \} \] \}";request.send(body);
var request = require('request');request({method: 'PUT',url: 'https://rest.smartvault.com/nodes/templates/AccountName/My Templates',headers: {'Authorization': 'Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==','Accept': 'application/json'},body: "{ \"applies_to\": \"SmartVault.Accounting.TaxEngagement\", \"api_name\": \"TaxEngagementCustomTemplate\", \"label\": \"My Custom Tax Engagement Template\", \"groups\": [ { \"moniker\": \"FirmManager\", \"name\": \"Firm Managers\", \"rid\": 8, \"create\": true }, { \"moniker\": \"AccountEmployees\", \"name\": \"Employees\", \"rid\": 18, \"create\": false } ], \"folders\": [ { \"name\": \"Tax Year 2012\", \"acl\": { \"aces\": [ { \"principal\": \"AccountEmployees\", \"permissions\": 15 }, { \"principal\": \"FirmManager\", \"permissions\": 111 } ] }, \"id\": \"root\", \"folders\": [ { \"name\": \"Client Tax Returns\", \"acl\": { \"aces\": [ { \"principal\": \"FirmEmployees\", \"permissions\": 15 } ] }, \"id\": \"client_tax_returns\", \"folder_association\": { \"tags\": [ { \"value\": \"clientcopy.taxreturn.tags.accounting.smartvault.com\" } ] } } ] } ]}"}, 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;my $data = { "applies_to": "SmartVault.Accounting.TaxEngagement", "api_name": "TaxEngagementCustomTemplate", "label": "My Custom Tax Engagement Template", "groups": [ { "moniker": "FirmManager", "name": "Firm Managers", "rid": 8, "create": true }, { "moniker": "AccountEmployees", "name": "Employees", "rid": 18, "create": false } ], "folders": [ { "name": "Tax Year 2012", "acl": { "aces": [ { "principal": "AccountEmployees", "permissions": 15 }, { "principal": "FirmManager", "permissions": 111 } ] }, "id": "root", "folders": [ { "name": "Client Tax Returns", "acl": { "aces": [ { "principal": "FirmEmployees", "permissions": 15 } ] }, "id": "client_tax_returns", "folder_association": { "tags": [ { "value": "clientcopy.taxreturn.tags.accounting.smartvault.com" } ] } } ] } ]};$ua->default_header("Authorization" => "Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==");$ua->default_header("Accept" => "application/json");my $response = $ua->put("https://rest.smartvault.com/nodes/templates/AccountName/My Templates", Content => $data);print $response->as_string;
from urllib2 import Request, urlopenvalues = """{"applies_to": "SmartVault.Accounting.TaxEngagement","api_name": "TaxEngagementCustomTemplate","label": "My Custom Tax Engagement Template","groups": [{"moniker": "FirmManager","name": "Firm Managers","rid": 8,"create": true},{"moniker": "AccountEmployees","name": "Employees","rid": 18,"create": false}],"folders": [{"name": "Tax Year 2012","acl": {"aces": [{"principal": "AccountEmployees","permissions": 15},{"principal": "FirmManager","permissions": 111}]},"id": "root","folders": [{"name": "Client Tax Returns","acl": {"aces": [{"principal": "FirmEmployees","permissions": 15}]},"id": "client_tax_returns","folder_association": {"tags": [{"value": "clientcopy.taxreturn.tags.accounting.smartvault.com"}]}}]}]}"""headers = {'Authorization': 'Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==','Accept': 'application/json'}request = Request('https://rest.smartvault.com/nodes/templates/AccountName/My Templates', data=values, headers=headers)request.get_method = lambda: 'PUT'response_body = urlopen(request).read()print response_body
<?php$ch = curl_init();curl_setopt($ch, CURLOPT_URL, "https://rest.smartvault.com/nodes/templates/AccountName/My Templates");curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);curl_setopt($ch, CURLOPT_HEADER, FALSE);curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"applies_to\": \"SmartVault.Accounting.TaxEngagement\",\"api_name\": \"TaxEngagementCustomTemplate\",\"label\": \"My Custom Tax Engagement Template\",\"groups\": [{\"moniker\": \"FirmManager\",\"name\": \"Firm Managers\",\"rid\": 8,\"create\": true},{\"moniker\": \"AccountEmployees\",\"name\": \"Employees\",\"rid\": 18,\"create\": false}],\"folders\": [{\"name\": \"Tax Year 2012\",\"acl\": {\"aces\": [{\"principal\": \"AccountEmployees\",\"permissions\": 15},{\"principal\": \"FirmManager\",\"permissions\": 111}]},\"id\": \"root\",\"folders\": [{\"name\": \"Client Tax Returns\",\"acl\": {\"aces\": [{\"principal\": \"FirmEmployees\",\"permissions\": 15}]},\"id\": \"client_tax_returns\",\"folder_association\": {\"tags\": [{\"value\": \"clientcopy.taxreturn.tags.accounting.smartvault.com\"}]}}]}]}");curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==","Accept: application/json"));$response = curl_exec($ch);curl_close($ch);var_dump($response);
require 'rubygems' if RUBY_VERSION < '1.9'require 'rest_client'values = '{"applies_to": "SmartVault.Accounting.TaxEngagement","api_name": "TaxEngagementCustomTemplate","label": "My Custom Tax Engagement Template","groups": [{"moniker": "FirmManager","name": "Firm Managers","rid": 8,"create": true},{"moniker": "AccountEmployees","name": "Employees","rid": 18,"create": false}],"folders": [{"name": "Tax Year 2012","acl": {"aces": [{"principal": "AccountEmployees","permissions": 15},{"principal": "FirmManager","permissions": 111}]},"id": "root","folders": [{"name": "Client Tax Returns","acl": {"aces": [{"principal": "FirmEmployees","permissions": 15}]},"id": "client_tax_returns","folder_association": {"tags": [{"value": "clientcopy.taxreturn.tags.accounting.smartvault.com"}]}}]}]}'headers = {:authorization => 'Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==',:accept => 'application/json'}response = RestClient.put 'https://rest.smartvault.com/nodes/templates/AccountName/My Templates', values, headersputs response
package mainimport ("bytes""fmt""io/ioutil""net/http")func main() {client := &http.Client{}body := []byte("{\n \"applies_to\": \"SmartVault.Accounting.TaxEngagement\",\n \"api_name\": \"TaxEngagementCustomTemplate\",\n \"label\": \"My Custom Tax Engagement Template\",\n \"groups\": [\n {\n \"moniker\": \"FirmManager\",\n \"name\": \"Firm Managers\",\n \"rid\": 8,\n \"create\": true\n },\n {\n \"moniker\": \"AccountEmployees\",\n \"name\": \"Employees\",\n \"rid\": 18,\n \"create\": false\n }\n ],\n \"folders\": [\n {\n \"name\": \"Tax Year 2012\",\n \"acl\": {\n \"aces\": [\n {\n \"principal\": \"AccountEmployees\",\n \"permissions\": 15\n },\n {\n \"principal\": \"FirmManager\",\n \"permissions\": 111\n }\n ]\n },\n \"id\": \"root\",\n \"folders\": [\n {\n \"name\": \"Client Tax Returns\",\n \"acl\": {\n \"aces\": [\n {\n \"principal\": \"FirmEmployees\",\n \"permissions\": 15\n }\n ]\n },\n \"id\": \"client_tax_returns\",\n \"folder_association\": {\n \"tags\": [\n {\n \"value\": \"clientcopy.taxreturn.tags.accounting.smartvault.com\"\n }\n ]\n }\n }\n ]\n }\n ]\n}")req, _ := http.NewRequest("PUT", "https://rest.smartvault.com/nodes/templates/AccountName/My Templates", bytes.NewBuffer(body))req.Header.Add("Authorization", "Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==")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("authorization", "Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==");httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json");using (var content = new StringContent("{ \"applies_to\": \"SmartVault.Accounting.TaxEngagement\", \"api_name\": \"TaxEngagementCustomTemplate\", \"label\": \"My Custom Tax Engagement Template\", \"groups\": [ { \"moniker\": \"FirmManager\", \"name\": \"Firm Managers\", \"rid\": 8, \"create\": true }, { \"moniker\": \"AccountEmployees\", \"name\": \"Employees\", \"rid\": 18, \"create\": false } ], \"folders\": [ { \"name\": \"Tax Year 2012\", \"acl\": { \"aces\": [ { \"principal\": \"AccountEmployees\", \"permissions\": 15 }, { \"principal\": \"FirmManager\", \"permissions\": 111 } ] }, \"id\": \"root\", \"folders\": [ { \"name\": \"Client Tax Returns\", \"acl\": { \"aces\": [ { \"principal\": \"FirmEmployees\", \"permissions\": 15 } ] }, \"id\": \"client_tax_returns\", \"folder_association\": { \"tags\": [ { \"value\": \"clientcopy.taxreturn.tags.accounting.smartvault.com\" } ] } } ] } ]}")){using (var response = await httpClient.PutAsync("nodes/templates/{AccountName}/My Templates", content)){string responseData = await response.Content.ReadAsStringAsync();}}}
Dim request = TryCast(System.Net.WebRequest.Create("https://rest.smartvault.com/nodes/templates/AccountName/My Templates"), System.Net.HttpWebRequest)request.Method = "PUT"request.Headers.Add("authorization", "Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==")request.Accept = "application/json"Using writer = New System.IO.StreamWriter(request.GetRequestStream())Dim byteArray As Byte() = System.Text.Encoding.UTF8.GetBytes("{\""applies_to\"": \""SmartVault.Accounting.TaxEngagement\"",\""api_name\"": \""TaxEngagementCustomTemplate\"",\""label\"": \""My Custom Tax Engagement Template\"",\""groups\"": [{\""moniker\"": \""FirmManager\"",\""name\"": \""Firm Managers\"",\""rid\"": 8,\""create\"": true},{\""moniker\"": \""AccountEmployees\"",\""name\"": \""Employees\"",\""rid\"": 18,\""create\"": false}],\""folders\"": [{\""name\"": \""Tax Year 2012\"",\""acl\"": {\""aces\"": [{\""principal\"": \""AccountEmployees\"",\""permissions\"": 15},{\""principal\"": \""FirmManager\"",\""permissions\"": 111}]},\""id\"": \""root\"",\""folders\"": [{\""name\"": \""Client Tax Returns\"",\""acl\"": {\""aces\"": [{\""principal\"": \""FirmEmployees\"",\""permissions\"": 15}]},\""id\"": \""client_tax_returns\"",\""folder_association\"": {\""tags\"": [{\""value\"": \""clientcopy.taxreturn.tags.accounting.smartvault.com\""}]}}]}]}")request.ContentLength = byteArray.Lengthwriter.Write(byteArray)writer.Close()End UsingDim 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."Authorization" = "Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ=="emptyHeaders."Accept" = "application/json"def jsonObj = new JsonSlurper().parseText('{"applies_to": "SmartVault.Accounting.TaxEngagement","api_name": "TaxEngagementCustomTemplate","label": "My Custom Tax Engagement Template","groups": [{"moniker": "FirmManager","name": "Firm Managers","rid": 8,"create": true},{"moniker": "AccountEmployees","name": "Employees","rid": 18,"create": false}],"folders": [{"name": "Tax Year 2012","acl": {"aces": [{"principal": "AccountEmployees","permissions": 15},{"principal": "FirmManager","permissions": 111}]},"id": "root","folders": [{"name": "Client Tax Returns","acl": {"aces": [{"principal": "FirmEmployees","permissions": 15}]},"id": "client_tax_returns","folder_association": {"tags": [{"value": "clientcopy.taxreturn.tags.accounting.smartvault.com"}]}}]}]}')response = client.put( path : "/nodes/templates/{AccountName}/My Templates",body : jsonObj,headers: emptyHeaders,contentType : ANY )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/templates/AccountName/My Templates"];NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL];[request setHTTPMethod:@"PUT"];[request setValue:@"Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==" forHTTPHeaderField:@"Authorization"];[request setValue:@"application/json" forHTTPHeaderField:@"Accept"];[request setHTTPBody:[@"{\n \"applies_to\": \"SmartVault.Accounting.TaxEngagement\",\n \"api_name\": \"TaxEngagementCustomTemplate\",\n \"label\": \"My Custom Tax Engagement Template\",\n \"groups\": [\n {\n \"moniker\": \"FirmManager\",\n \"name\": \"Firm Managers\",\n \"rid\": 8,\n \"create\": true\n },\n {\n \"moniker\": \"AccountEmployees\",\n \"name\": \"Employees\",\n \"rid\": 18,\n \"create\": false\n }\n ],\n \"folders\": [\n {\n \"name\": \"Tax Year 2012\",\n \"acl\": {\n \"aces\": [\n {\n \"principal\": \"AccountEmployees\",\n \"permissions\": 15\n },\n {\n \"principal\": \"FirmManager\",\n \"permissions\": 111\n }\n ]\n },\n \"id\": \"root\",\n \"folders\": [\n {\n \"name\": \"Client Tax Returns\",\n \"acl\": {\n \"aces\": [\n {\n \"principal\": \"FirmEmployees\",\n \"permissions\": 15\n }\n ]\n },\n \"id\": \"client_tax_returns\",\n \"folder_association\": {\n \"tags\": [\n {\n \"value\": \"clientcopy.taxreturn.tags.accounting.smartvault.com\"\n }\n ]\n }\n }\n ]\n }\n ]\n}" dataUsingEncoding:NSUTF8StringEncoding]];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];
import Foundation// NOTE: Uncommment following two lines for use in a Playground// import PlaygroundSupport// PlaygroundPage.current.needsIndefiniteExecution = truelet url = URL(string: "https://rest.smartvault.com/nodes/templates/AccountName/My Templates")!var request = URLRequest(url: url)request.httpMethod = "PUT"request.addValue("Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==", forHTTPHeaderField: "Authorization")request.addValue("application/json", forHTTPHeaderField: "Accept")request.httpBody = """"{\n \"applies_to\": \"SmartVault.Accounting.TaxEngagement\",\n \"api_name\": \"TaxEngagementCustomTemplate\",\n \"label\": \"My Custom Tax Engagement Template\",\n \"groups\": [\n {\n \"moniker\": \"FirmManager\",\n \"name\": \"Firm Managers\",\n \"rid\": 8,\n \"create\": true\n },\n {\n \"moniker\": \"AccountEmployees\",\n \"name\": \"Employees\",\n \"rid\": 18,\n \"create\": false\n }\n ],\n \"folders\": [\n {\n \"name\": \"Tax Year 2012\",\n \"acl\": {\n \"aces\": [\n {\n \"principal\": \"AccountEmployees\",\n \"permissions\": 15\n },\n {\n \"principal\": \"FirmManager\",\n \"permissions\": 111\n }\n ]\n },\n \"id\": \"root\",\n \"folders\": [\n {\n \"name\": \"Client Tax Returns\",\n \"acl\": {\n \"aces\": [\n {\n \"principal\": \"FirmEmployees\",\n \"permissions\": 15\n }\n ]\n },\n \"id\": \"client_tax_returns\",\n \"folder_association\": {\n \"tags\": [\n {\n \"value\": \"clientcopy.taxreturn.tags.accounting.smartvault.com\"\n }\n ]\n }\n }\n ]\n }\n ]\n}"""".data(using: .utf8)let task = URLSession.shared.dataTask(with: request) { data, response, error inif let response = response {print(response)if let data = data, let body = String(data: data, encoding: .utf8) {print(body)}} else {print(error ?? "Unknown error")}}task.resume()
Response
Returns a node response object pointing to the template retrieved.
Show success object
Update a template
This endpoint can be used for multiple modifications of the template.
Find more information about each type of request below.
Parameters
account_name
stringThe user's account name.entity_definition
stringThe template name.Body parameters
Use the following properties to make changes to a template
Show content
The UpdateTemplateRequest object
Use the update container to change the properties associated with a template (API name for the template, label for the template, who the template applies to, etc).
Show UpdateTemplateRequest
Copying Templates
When copying templates, you will need to provide the following body parameter.
dst_uri
stringDestination URI of the new copy of the template.Modifying Template Information (The ApplyChangeSet object)
Use the change container to make changes to a template’s metadata. The properties for ApplyChangeSet are.
Show ApplyChangeSet attributes
To retrieve the current version (and know what value you should specify for the update) make a request to
/nodes/template/{account_name}/My Templates/{entity_definition}?eprop=true
The TemplateChange object
A TemplateChange is a union of possible changes made to a template.
Each change should apply at most one change to the template and most changes apply to one aspect of the template, specified by the ‘selector’ field.
One of the few exceptions is changing the template label, which is a global template change and does not require a selector.
Show TemplateChange attributes
For example, if you wanted to create a new nested folder on a template, you won't specify the "selector" value as "root", instead you can check for the current available selectors by making a request to the actual template.
GET request to /nodes/template/SmartVault Account/My Templates/SmartVault.Accounting.FinancialServicesEngagementTemplate?eprop=true
This will return the extra information of the template where you can check the selectors
Show template object
Tags
Using the folder_association element, you can add and delete routing rules from a template node.
Documents published to the template entity that include these tags will be routed to this location.
Each routing rule should only occur at most once in the entire hierarchy.
Merging Template Nodes
The Merge operation merges the selected node to the destination node and combines associations, relationships, and contents of the source folder with the target.
Show merge properties
Setting notification for nodes
Property "set_notifications" updates the notifications of the target node. It consists of a property called "notifications", which is composed of an element also called "notifications", which houses the list of notifications to be updated.
A notification has the following properties:
Show merge properties
Request
Example of a call to add a new folder to a template
Show folder addition
Example of a call to modify folder permissions inside a template. More info about the permissions values here.
Show permissions modification
Example for a template modification request execution.
Headers:Content-Type:application/jsonAuthorization:Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==Accept:application/jsonBody:{"update": {"update_api_name": "true","api_name": "SmartVault.Core.UserTemplate","update_label": "true","label": "SmartVault Employee","update_plural_label": "true","plural_label": "SmartVault Employees"},"copy": {"dst_uri": "/nodes/template/SmartVault/My Templates/Intuit.Accounting.DMS.TaxTemplate"},"change": {"version": 5,"comment": "Move Correspondence folder to My Folder","changes": [{"selector": "/root/correspondence","move": "/root/my_folder"},{"selector": "/root/my_folder","merge": {"destination": "/root/my_folder/correspondence"}},{"selector": "/root","add": {"id": "personal_folder","name": "Personal Folder"}},{"selector": "/root/my_folder/correspondence","delete": "true"},{"selector": "/root/my_folder","folder_association": {"tags": {"add": {"tags": [{"value": " misc.tags.core.smartvault.com "}]}}}},{"selector": "/root/my_folder","set_notifications": {"notifications": {"notifications": [{"principal": "AccountAdmins","notifications": 2}]}}}]}}
curl --include \--request POST \--header "Content-Type: application/json" \--header "Authorization: Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==" \--header "Accept: application/json" \--data-binary "{\"update\":{\"update_api_name\": \"true\",\"api_name\" : \"SmartVault.Core.UserTemplate\",\"update_label\" : \"true\",\"label\" : \"SmartVault Employee\",\"update_plural_label\" : \"true\",\"plural_label\" : \"SmartVault Employees\"},\"copy\":{\"dst_uri\": \"/nodes/template/SmartVault/My Templates/Intuit.Accounting.DMS.TaxTemplate\"},\"change\":{\"version\" : 5,\"comment\" : \"Move Correspondence folder to My Folder\",\"changes\" :[{\"selector\" : \"/root/correspondence\",\"move\" : \"/root/my_folder\"},{\"selector\" : \"/root/my_folder\",\"merge\" :{\"destination\" : \"/root/my_folder/correspondence\"}},{\"selector\" : \"/root\",\"add\" :{\"id\": \"personal_folder\",\"name\": \"Personal Folder\"}},{\"selector\" : \"/root/my_folder/correspondence\",\"delete\" : \"true\"},{\"selector\" : \"/root/my_folder\",\"folder_association\" :{\"tags\" :{\"add\" :{\"tags\" :[{\"value\" : \" misc.tags.core.smartvault.com \"}]}}}},{\"selector\" : \"/root/my_folder\",\"set_notifications\" :{\"notifications\" :{\"notifications\" :[{\"principal\" : \"AccountAdmins\",\"notifications\" : 2}]}}}]}}" \'https://rest.smartvault.com/nodes/templates/AccountName/My Templates/EntityDefinition'
// 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();Entity payload = Entity.json("{ \"update\": { \"update_api_name\": \"true\", \"api_name\": \"SmartVault.Core.UserTemplate\", \"update_label\": \"true\", \"label\": \"SmartVault Employee\", \"update_plural_label\": \"true\", \"plural_label\": \"SmartVault Employees\" }, \"copy\": { \"dst_uri\": \"/nodes/template/SmartVault/My Templates/Intuit.Accounting.DMS.TaxTemplate\" }, \"change\": { \"version\": 5, \"comment\": \"Move Correspondence folder to My Folder\", \"changes\": [ { \"selector\": \"/root/correspondence\", \"move\": \"/root/my_folder\" }, { \"selector\": \"/root/my_folder\", \"merge\": { \"destination\": \"/root/my_folder/correspondence\" } }, { \"selector\": \"/root\", \"add\": { \"id\": \"personal_folder\", \"name\": \"Personal Folder\" } }, { \"selector\": \"/root/my_folder/correspondence\", \"delete\": \"true\" }, { \"selector\": \"/root/my_folder\", \"folder_association\": { \"tags\": { \"add\": { \"tags\": [ { \"value\": \" misc.tags.core.smartvault.com \" } ] } } } }, { \"selector\": \"/root/my_folder\", \"set_notifications\": { \"notifications\": { \"notifications\": [ { \"principal\": \"AccountAdmins\", \"notifications\": 2 } ] } } } ] }}");Response response = client.target("https://rest.smartvault.com/nodes/templates/AccountName/My Templates/EntityDefinition").request(MediaType.APPLICATION_JSON_TYPE).header("Authorization", "Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==").header("Accept", "application/json").post(payload);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('POST', 'https://rest.smartvault.com/nodes/templates/AccountName/My Templates/EntityDefinition');request.setRequestHeader('Content-Type', 'application/json');request.setRequestHeader('Authorization', 'Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==');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);}};var body = {'update': {'update_api_name': 'true','api_name': 'SmartVault.Core.UserTemplate','update_label': 'true','label': 'SmartVault Employee','update_plural_label': 'true','plural_label': 'SmartVault Employees'},'copy': {'dst_uri': '/nodes/template/SmartVault/My Templates/Intuit.Accounting.DMS.TaxTemplate'},'change': {'version': 5,'comment': 'Move Correspondence folder to My Folder','changes': [{'selector': '/root/correspondence','move': '/root/my_folder'},{'selector': '/root/my_folder','merge': {'destination': '/root/my_folder/correspondence'}},{'selector': '/root','add': {'id': 'personal_folder','name': 'Personal Folder'}},{'selector': '/root/my_folder/correspondence','delete': 'true'},{'selector': '/root/my_folder','folder_association': {'tags': {'add': {'tags': [{'value': ' misc.tags.core.smartvault.com '}]}}}},{'selector': '/root/my_folder','set_notifications': {'notifications': {'notifications': [{'principal': 'AccountAdmins','notifications': 2}]}}}]}};request.send(JSON.stringify(body));
var request = require('request');request({method: 'POST',url: 'https://rest.smartvault.com/nodes/templates/AccountName/My Templates/EntityDefinition',headers: {'Content-Type': 'application/json','Authorization': 'Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==','Accept': 'application/json'},body: "{ \"update\": { \"update_api_name\": \"true\", \"api_name\": \"SmartVault.Core.UserTemplate\", \"update_label\": \"true\", \"label\": \"SmartVault Employee\", \"update_plural_label\": \"true\", \"plural_label\": \"SmartVault Employees\" }, \"copy\": { \"dst_uri\": \"/nodes/template/SmartVault/My Templates/Intuit.Accounting.DMS.TaxTemplate\" }, \"change\": { \"version\": 5, \"comment\": \"Move Correspondence folder to My Folder\", \"changes\": [ { \"selector\": \"/root/correspondence\", \"move\": \"/root/my_folder\" }, { \"selector\": \"/root/my_folder\", \"merge\": { \"destination\": \"/root/my_folder/correspondence\" } }, { \"selector\": \"/root\", \"add\": { \"id\": \"personal_folder\", \"name\": \"Personal Folder\" } }, { \"selector\": \"/root/my_folder/correspondence\", \"delete\": \"true\" }, { \"selector\": \"/root/my_folder\", \"folder_association\": { \"tags\": { \"add\": { \"tags\": [ { \"value\": \" misc.tags.core.smartvault.com \" } ] } } } }, { \"selector\": \"/root/my_folder\", \"set_notifications\": { \"notifications\": { \"notifications\": [ { \"principal\": \"AccountAdmins\", \"notifications\": 2 } ] } } } ] }}"}, 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;my $data = '{ "update": { "update_api_name": "true", "api_name": "SmartVault.Core.UserTemplate", "update_label": "true", "label": "SmartVault Employee", "update_plural_label": "true", "plural_label": "SmartVault Employees" }, "copy": { "dst_uri": "/nodes/template/SmartVault/My Templates/Intuit.Accounting.DMS.TaxTemplate" }, "change": { "version": 5, "comment": "Move Correspondence folder to My Folder", "changes": [ { "selector": "/root/correspondence", "move": "/root/my_folder" }, { "selector": "/root/my_folder", "merge": { "destination": "/root/my_folder/correspondence" } }, { "selector": "/root", "add": { "id": "personal_folder", "name": "Personal Folder" } }, { "selector": "/root/my_folder/correspondence", "delete": "true" }, { "selector": "/root/my_folder", "folder_association": { "tags": { "add": { "tags": [ { "value": " misc.tags.core.smartvault.com " } ] } } } }, { "selector": "/root/my_folder", "set_notifications": { "notifications": { "notifications": [ { "principal": "AccountAdmins", "notifications": 2 } ] } } } ] }}';$ua->default_header("Content-Type" => "application/json");$ua->default_header("Authorization" => "Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==");$ua->default_header("Accept" => "application/json");my $response = $ua->post("https://rest.smartvault.com/nodes/templates/AccountName/My Templates/EntityDefinition", Content => $data);print $response->as_string;
from urllib2 import Request, urlopenvalues = """{"update": {"update_api_name": "true","api_name": "SmartVault.Core.UserTemplate","update_label": "true","label": "SmartVault Employee","update_plural_label": "true","plural_label": "SmartVault Employees"},"copy": {"dst_uri": "/nodes/template/SmartVault/My Templates/Intuit.Accounting.DMS.TaxTemplate"},"change": {"version": 5,"comment": "Move Correspondence folder to My Folder","changes": [{"selector": "/root/correspondence","move": "/root/my_folder"},{"selector": "/root/my_folder","merge": {"destination": "/root/my_folder/correspondence"}},{"selector": "/root","add": {"id": "personal_folder","name": "Personal Folder"}},{"selector": "/root/my_folder/correspondence","delete": "true"},{"selector": "/root/my_folder","folder_association": {"tags": {"add": {"tags": [{"value": " misc.tags.core.smartvault.com "}]}}}},{"selector": "/root/my_folder","set_notifications": {"notifications": {"notifications": [{"principal": "AccountAdmins","notifications": 2}]}}}]}}"""headers = {'Content-Type': 'application/json','Authorization': 'Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==','Accept': 'application/json'}request = Request('https://rest.smartvault.com/nodes/templates/AccountName/My Templates/EntityDefinition', data=values, headers=headers)response_body = urlopen(request).read()print response_body
<?php$ch = curl_init();curl_setopt($ch, CURLOPT_URL, "https://rest.smartvault.com/nodes/templates/AccountName/My Templates/EntityDefinition");curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);curl_setopt($ch, CURLOPT_HEADER, FALSE);curl_setopt($ch, CURLOPT_POST, TRUE);curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"update\": {\"update_api_name\": \"true\",\"api_name\": \"SmartVault.Core.UserTemplate\",\"update_label\": \"true\",\"label\": \"SmartVault Employee\",\"update_plural_label\": \"true\",\"plural_label\": \"SmartVault Employees\"},\"copy\": {\"dst_uri\": \"/nodes/template/SmartVault/My Templates/Intuit.Accounting.DMS.TaxTemplate\"},\"change\": {\"version\": 5,\"comment\": \"Move Correspondence folder to My Folder\",\"changes\": [{\"selector\": \"/root/correspondence\",\"move\": \"/root/my_folder\"},{\"selector\": \"/root/my_folder\",\"merge\": {\"destination\": \"/root/my_folder/correspondence\"}},{\"selector\": \"/root\",\"add\": {\"id\": \"personal_folder\",\"name\": \"Personal Folder\"}},{\"selector\": \"/root/my_folder/correspondence\",\"delete\": \"true\"},{\"selector\": \"/root/my_folder\",\"folder_association\": {\"tags\": {\"add\": {\"tags\": [{\"value\": \" misc.tags.core.smartvault.com \"}]}}}},{\"selector\": \"/root/my_folder\",\"set_notifications\": {\"notifications\": {\"notifications\": [{\"principal\": \"AccountAdmins\",\"notifications\": 2}]}}}]}}");curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json","Authorization: Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==","Accept: application/json"));$response = curl_exec($ch);curl_close($ch);var_dump($response);
require 'rubygems' if RUBY_VERSION < '1.9'require 'rest_client'values = '{"update": {"update_api_name": "true","api_name": "SmartVault.Core.UserTemplate","update_label": "true","label": "SmartVault Employee","update_plural_label": "true","plural_label": "SmartVault Employees"},"copy": {"dst_uri": "/nodes/template/SmartVault/My Templates/Intuit.Accounting.DMS.TaxTemplate"},"change": {"version": 5,"comment": "Move Correspondence folder to My Folder","changes": [{"selector": "/root/correspondence","move": "/root/my_folder"},{"selector": "/root/my_folder","merge": {"destination": "/root/my_folder/correspondence"}},{"selector": "/root","add": {"id": "personal_folder","name": "Personal Folder"}},{"selector": "/root/my_folder/correspondence","delete": "true"},{"selector": "/root/my_folder","folder_association": {"tags": {"add": {"tags": [{"value": " misc.tags.core.smartvault.com "}]}}}},{"selector": "/root/my_folder","set_notifications": {"notifications": {"notifications": [{"principal": "AccountAdmins","notifications": 2}]}}}]}}'headers = {:content_type => 'application/json',:authorization => 'Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==',:accept => 'application/json'}response = RestClient.post 'https://rest.smartvault.com/nodes/templates/AccountName/My Templates/EntityDefinition', values, headersputs response
package mainimport ("bytes""fmt""io/ioutil""net/http")func main() {client := &http.Client{}body := []byte("{\n \"update\": {\n \"update_api_name\": \"true\",\n \"api_name\": \"SmartVault.Core.UserTemplate\",\n \"update_label\": \"true\",\n \"label\": \"SmartVault Employee\",\n \"update_plural_label\": \"true\",\n \"plural_label\": \"SmartVault Employees\"\n },\n \"copy\": {\n \"dst_uri\": \"/nodes/template/SmartVault/My Templates/Intuit.Accounting.DMS.TaxTemplate\"\n },\n \"change\": {\n \"version\": 5,\n \"comment\": \"Move Correspondence folder to My Folder\",\n \"changes\": [\n {\n \"selector\": \"/root/correspondence\",\n \"move\": \"/root/my_folder\"\n },\n {\n \"selector\": \"/root/my_folder\",\n \"merge\": {\n \"destination\": \"/root/my_folder/correspondence\"\n }\n },\n {\n \"selector\": \"/root\",\n \"add\": {\n \"id\": \"personal_folder\",\n \"name\": \"Personal Folder\"\n }\n },\n {\n \"selector\": \"/root/my_folder/correspondence\",\n \"delete\": \"true\"\n },\n {\n \"selector\": \"/root/my_folder\",\n \"folder_association\": {\n \"tags\": {\n \"add\": {\n \"tags\": [\n {\n \"value\": \" misc.tags.core.smartvault.com \"\n }\n ]\n }\n }\n }\n },\n {\n \"selector\": \"/root/my_folder\",\n \"set_notifications\": {\n \"notifications\": {\n \"notifications\": [\n {\n \"principal\": \"AccountAdmins\",\n \"notifications\": 2\n }\n ]\n }\n }\n }\n ]\n }\n}")req, _ := http.NewRequest("POST", "https://rest.smartvault.com/nodes/templates/AccountName/My Templates/EntityDefinition", bytes.NewBuffer(body))req.Header.Add("Content-Type", "application/json")req.Header.Add("Authorization", "Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==")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("authorization", "Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==");httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json");using (var content = new StringContent("{ \"update\": { \"update_api_name\": \"true\", \"api_name\": \"SmartVault.Core.UserTemplate\", \"update_label\": \"true\", \"label\": \"SmartVault Employee\", \"update_plural_label\": \"true\", \"plural_label\": \"SmartVault Employees\" }, \"copy\": { \"dst_uri\": \"/nodes/template/SmartVault/My Templates/Intuit.Accounting.DMS.TaxTemplate\" }, \"change\": { \"version\": 5, \"comment\": \"Move Correspondence folder to My Folder\", \"changes\": [ { \"selector\": \"/root/correspondence\", \"move\": \"/root/my_folder\" }, { \"selector\": \"/root/my_folder\", \"merge\": { \"destination\": \"/root/my_folder/correspondence\" } }, { \"selector\": \"/root\", \"add\": { \"id\": \"personal_folder\", \"name\": \"Personal Folder\" } }, { \"selector\": \"/root/my_folder/correspondence\", \"delete\": \"true\" }, { \"selector\": \"/root/my_folder\", \"folder_association\": { \"tags\": { \"add\": { \"tags\": [ { \"value\": \" misc.tags.core.smartvault.com \" } ] } } } }, { \"selector\": \"/root/my_folder\", \"set_notifications\": { \"notifications\": { \"notifications\": [ { \"principal\": \"AccountAdmins\", \"notifications\": 2 } ] } } } ] }}", System.Text.Encoding.Default, "application/json")){using (var response = await httpClient.PostAsync("nodes/templates/{AccountName}/My Templates/{EntityDefinition}", content)){string responseData = await response.Content.ReadAsStringAsync();}}}
Dim request = TryCast(System.Net.WebRequest.Create("https://rest.smartvault.com/nodes/templates/AccountName/My Templates/EntityDefinition"), System.Net.HttpWebRequest)request.Method = "POST"request.ContentType = "application/json"request.Headers.Add("authorization", "Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==")request.Accept = "application/json"Using writer = New System.IO.StreamWriter(request.GetRequestStream())Dim byteArray As Byte() = System.Text.Encoding.UTF8.GetBytes("{\""update\"": {\""update_api_name\"": \""true\"",\""api_name\"": \""SmartVault.Core.UserTemplate\"",\""update_label\"": \""true\"",\""label\"": \""SmartVault Employee\"",\""update_plural_label\"": \""true\"",\""plural_label\"": \""SmartVault Employees\""},\""copy\"": {\""dst_uri\"": \""/nodes/template/SmartVault/My Templates/Intuit.Accounting.DMS.TaxTemplate\""},\""change\"": {\""version\"": 5,\""comment\"": \""Move Correspondence folder to My Folder\"",\""changes\"": [{\""selector\"": \""/root/correspondence\"",\""move\"": \""/root/my_folder\""},{\""selector\"": \""/root/my_folder\"",\""merge\"": {\""destination\"": \""/root/my_folder/correspondence\""}},{\""selector\"": \""/root\"",\""add\"": {\""id\"": \""personal_folder\"",\""name\"": \""Personal Folder\""}},{\""selector\"": \""/root/my_folder/correspondence\"",\""delete\"": \""true\""},{\""selector\"": \""/root/my_folder\"",\""folder_association\"": {\""tags\"": {\""add\"": {\""tags\"": [{\""value\"": \"" misc.tags.core.smartvault.com \""}]}}}},{\""selector\"": \""/root/my_folder\"",\""set_notifications\"": {\""notifications\"": {\""notifications\"": [{\""principal\"": \""AccountAdmins\"",\""notifications\"": 2}]}}}]}}")request.ContentLength = byteArray.Lengthwriter.Write(byteArray)writer.Close()End UsingDim 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."Authorization" = "Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ=="emptyHeaders."Accept" = "application/json"def jsonObj = new JsonSlurper().parseText('{"update": {"update_api_name": "true","api_name": "SmartVault.Core.UserTemplate","update_label": "true","label": "SmartVault Employee","update_plural_label": "true","plural_label": "SmartVault Employees"},"copy": {"dst_uri": "/nodes/template/SmartVault/My Templates/Intuit.Accounting.DMS.TaxTemplate"},"change": {"version": 5,"comment": "Move Correspondence folder to My Folder","changes": [{"selector": "/root/correspondence","move": "/root/my_folder"},{"selector": "/root/my_folder","merge": {"destination": "/root/my_folder/correspondence"}},{"selector": "/root","add": {"id": "personal_folder","name": "Personal Folder"}},{"selector": "/root/my_folder/correspondence","delete": "true"},{"selector": "/root/my_folder","folder_association": {"tags": {"add": {"tags": [{"value": " misc.tags.core.smartvault.com "}]}}}},{"selector": "/root/my_folder","set_notifications": {"notifications": {"notifications": [{"principal": "AccountAdmins","notifications": 2}]}}}]}}')response = client.post( path : "/nodes/templates/{AccountName}/My Templates/{EntityDefinition}",body : jsonObj,headers: emptyHeaders,contentType : JSON )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/templates/AccountName/My Templates/EntityDefinition"];NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL];[request setHTTPMethod:@"POST"];[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];[request setValue:@"Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==" forHTTPHeaderField:@"Authorization"];[request setValue:@"application/json" forHTTPHeaderField:@"Accept"];[request setHTTPBody:[@"{\n \"update\": {\n \"update_api_name\": \"true\",\n \"api_name\": \"SmartVault.Core.UserTemplate\",\n \"update_label\": \"true\",\n \"label\": \"SmartVault Employee\",\n \"update_plural_label\": \"true\",\n \"plural_label\": \"SmartVault Employees\"\n },\n \"copy\": {\n \"dst_uri\": \"/nodes/template/SmartVault/My Templates/Intuit.Accounting.DMS.TaxTemplate\"\n },\n \"change\": {\n \"version\": 5,\n \"comment\": \"Move Correspondence folder to My Folder\",\n \"changes\": [\n {\n \"selector\": \"/root/correspondence\",\n \"move\": \"/root/my_folder\"\n },\n {\n \"selector\": \"/root/my_folder\",\n \"merge\": {\n \"destination\": \"/root/my_folder/correspondence\"\n }\n },\n {\n \"selector\": \"/root\",\n \"add\": {\n \"id\": \"personal_folder\",\n \"name\": \"Personal Folder\"\n }\n },\n {\n \"selector\": \"/root/my_folder/correspondence\",\n \"delete\": \"true\"\n },\n {\n \"selector\": \"/root/my_folder\",\n \"folder_association\": {\n \"tags\": {\n \"add\": {\n \"tags\": [\n {\n \"value\": \" misc.tags.core.smartvault.com \"\n }\n ]\n }\n }\n }\n },\n {\n \"selector\": \"/root/my_folder\",\n \"set_notifications\": {\n \"notifications\": {\n \"notifications\": [\n {\n \"principal\": \"AccountAdmins\",\n \"notifications\": 2\n }\n ]\n }\n }\n }\n ]\n }\n}" dataUsingEncoding:NSUTF8StringEncoding]];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];
import Foundation// NOTE: Uncommment following two lines for use in a Playground// import PlaygroundSupport// PlaygroundPage.current.needsIndefiniteExecution = truelet url = URL(string: "https://rest.smartvault.com/nodes/templates/AccountName/My Templates/EntityDefinition")!var request = URLRequest(url: url)request.httpMethod = "POST"request.addValue("application/json", forHTTPHeaderField: "Content-Type")request.addValue("Basic dGVzdHVzZXJAc21hcnR2YXVsdC5jb206UTB4Sk1EQUFBQUFBQUFBQlVZRE9MOE82N3oyQjdvVmJLcytWMngybmZHTXgzR2FzY2pNUEp4Y0dGeHZPeWc9PQ==", forHTTPHeaderField: "Authorization")request.addValue("application/json", forHTTPHeaderField: "Accept")request.httpBody = """"{\n \"update\": {\n \"update_api_name\": \"true\",\n \"api_name\": \"SmartVault.Core.UserTemplate\",\n \"update_label\": \"true\",\n \"label\": \"SmartVault Employee\",\n \"update_plural_label\": \"true\",\n \"plural_label\": \"SmartVault Employees\"\n },\n \"copy\": {\n \"dst_uri\": \"/nodes/template/SmartVault/My Templates/Intuit.Accounting.DMS.TaxTemplate\"\n },\n \"change\": {\n \"version\": 5,\n \"comment\": \"Move Correspondence folder to My Folder\",\n \"changes\": [\n {\n \"selector\": \"/root/correspondence\",\n \"move\": \"/root/my_folder\"\n },\n {\n \"selector\": \"/root/my_folder\",\n \"merge\": {\n \"destination\": \"/root/my_folder/correspondence\"\n }\n },\n {\n \"selector\": \"/root\",\n \"add\": {\n \"id\": \"personal_folder\",\n \"name\": \"Personal Folder\"\n }\n },\n {\n \"selector\": \"/root/my_folder/correspondence\",\n \"delete\": \"true\"\n },\n {\n \"selector\": \"/root/my_folder\",\n \"folder_association\": {\n \"tags\": {\n \"add\": {\n \"tags\": [\n {\n \"value\": \" misc.tags.core.smartvault.com \"\n }\n ]\n }\n }\n }\n },\n {\n \"selector\": \"/root/my_folder\",\n \"set_notifications\": {\n \"notifications\": {\n \"notifications\": [\n {\n \"principal\": \"AccountAdmins\",\n \"notifications\": 2\n }\n ]\n }\n }\n }\n ]\n }\n}"""".data(using: .utf8)let task = URLSession.shared.dataTask(with: request) { data, response, error inif let response = response {print(response)if let data = data, let body = String(data: data, encoding: .utf8) {print(body)}} else {print(error ?? "Unknown error")}}task.resume()
Response
Returns a node response object pointing to the template updated.
Show success object
Returns an error object if the template trying to be updated doesn't exist.
Show error object
Template permissions
SmartVault allows the modification of the permissions in templates. You can find right below the required objects to update the permissions of a node as well as some examples for better understanding.
The UpdateContainer object
aces
List<UpdateACE>List of access control entries.The UpdateACE object
principal
stringThe entity to which the permissions apply to.permissions
intNew permissions value. Check table below.Possible values for the permissions field of the UpdateACE. It can be each value individually or the sum of any of them.
e.g.: "permissions: 3" would be read (1) and write (2) access.
Show permissions value
Knowing this, if we wanted to add write, create and change access permission to a certain group member in a template, it'd be something like the following
More info about the rest of the body parameters here.