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.
Some of the template object attributes (vaults, folders, containers and groups) refers to the SmartVault types specified below.
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.
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.
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.
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.
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.
These are the group monikers that are currently supported.
The full list of templates available for an account can be fetched executing the request below.
cURL Java Javascript Node Perl Python PHP Ruby Go C# Visual Basic Groovy Objective-C Swift
curl -- include \
-- header "Authorization: Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==" \
-- header "Accept: application/json" \
'https://rest.smartvault.com/nodes/templates/{AccountName}/My Templates/{EntityDefinition}'
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" , "Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==" )
. 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' , 'Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==' ) ;
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' : 'Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==' ,
'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" => "Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==" ) ;
$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 , urlopen
headers = {
'Authorization' : 'Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==' ,
'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: Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==" ,
"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 => 'Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==' ,
: accept => 'application/json'
}
response = RestClient . get 'https://rest.smartvault.com/nodes/templates/{AccountName}/My Templates/{EntityDefinition}' , headers
puts response
package main
import (
"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" , "Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==" )
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 ) )
}
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" , "Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==" ) ;
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" , "Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==" )
request . Accept = "application/json"
request . ContentLength = 0
Dim responseContent As String
Using response = TryCast ( request . GetResponse ( ) , System . Net . HttpWebResponse )
Using reader = New System . IO . StreamReader ( response . GetResponseStream ( ) )
responseContent = reader . ReadToEnd ( )
End Using
End Using
import groovyx . net . http . RESTClient
import static groovyx . net . http . ContentType . JSON
import groovy . json . JsonSlurper
import 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" = "Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg=="
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 : @ "Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==" forHTTPHeaderField : @ "Authorization" ] ;
[ request setValue : @ "application/json" forHTTPHeaderField : @ "Accept" ] ;
NSURLSession * session = [ NSURLSession sharedSession ] ;
NSURLSessionDataTask * task = [ session dataTaskWithRequest : request
completionHandler :
^ ( NSData * data , NSURLResponse * response , NSError * error ) {
if ( 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
let url = URL ( string : "https://rest.smartvault.com/nodes/templates/{AccountName}/My Templates/{EntityDefinition}" ) !
var request = URLRequest ( url : url )
request . addValue ( "Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==" , forHTTPHeaderField : "Authorization" )
request . addValue ( "application/json" , forHTTPHeaderField : "Accept" )
let task = URLSession . shared . dataTask ( with : request ) { data , response , error in
if 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 ( )
In the following example the API retrieve information pertaining to the Employee template, located in “My Templates” for the account “SmartVault”.
Raw cURL Java Javascript Node Perl Python PHP Ruby Go C# Visual Basic Groovy Objective-C Swift
Headers :
Authorization : Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs + V2x2nfGMx3GascjMPJxcGFxvOyg ==
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"
}
]
}
}
]
}
]
}
curl -- include \
-- request PUT \
-- header "Authorization: Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==" \
-- 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'
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" , "Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==" )
. 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' , 'Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==' ) ;
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' : 'Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==' ,
'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" => "Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==" ) ;
$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 , urlopen
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' : 'Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==' ,
'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: Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==" ,
"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 => 'Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==' ,
: accept => 'application/json'
}
response = RestClient . put 'https://rest.smartvault.com/nodes/templates/AccountName/My Templates' , values , headers
puts response
package main
import (
"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" , "Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==" )
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 ) )
}
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" , "Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==" ) ;
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" , "Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==" )
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 . Length
writer . Write ( byteArray )
writer . Close ( )
End Using
Dim responseContent As String
Using response = TryCast ( request . GetResponse ( ) , System . Net . HttpWebResponse )
Using reader = New System . IO . StreamReader ( response . GetResponseStream ( ) )
responseContent = reader . ReadToEnd ( )
End Using
End Using
import groovyx . net . http . RESTClient
import static groovyx . net . http . ContentType . JSON
import groovy . json . JsonSlurper
import 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" = "Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg=="
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 : @ "Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==" 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 : request
completionHandler :
^ ( NSData * data , NSURLResponse * response , NSError * error ) {
if ( 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
let url = URL ( string : "https://rest.smartvault.com/nodes/templates/AccountName/My Templates" ) !
var request = URLRequest ( url : url )
request . httpMethod = "PUT"
request . addValue ( "Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==" , 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 in
if 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 ( )
This endpoint can be used for multiple modifications of the template.
Find more information about each type of request below.
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).
When copying templates, you will need to provide the following body parameter.
Use the change container to make changes to a template’s metadata. The properties for ApplyChangeSet are.
To retrieve the current version (and know what value you should specify for the update) make a request to
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.
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.
This will return the extra information of the template where you can check the selectors
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.
The Merge operation merges the selected node to the destination node and combines associations, relationships, and contents of the source folder with the target.
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:
Example of a call to modify folder permissions inside a template. More info about the permissions values here .
Example for a template modification request execution.
Raw cURL Java Javascript Node Perl Python PHP Ruby Go C# Visual Basic Groovy Objective-C Swift
Headers :
Content - Type : application / json
Authorization : Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs + V2x2nfGMx3GascjMPJxcGFxvOyg ==
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
}
]
}
}
}
]
}
}
curl -- include \
-- request POST \
-- header "Content-Type: application/json" \
-- header "Authorization: Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==" \
-- 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'
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" , "Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==" )
. 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' , 'Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==' ) ;
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' : 'Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==' ,
'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" => "Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==" ) ;
$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 , urlopen
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' : 'Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==' ,
'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: Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==" ,
"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 => 'Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==' ,
: accept => 'application/json'
}
response = RestClient . post 'https://rest.smartvault.com/nodes/templates/AccountName/My Templates/EntityDefinition' , values , headers
puts response
package main
import (
"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" , "Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==" )
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 ) )
}
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" , "Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==" ) ;
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" , "Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==" )
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 . Length
writer . Write ( byteArray )
writer . Close ( )
End Using
Dim responseContent As String
Using response = TryCast ( request . GetResponse ( ) , System . Net . HttpWebResponse )
Using reader = New System . IO . StreamReader ( response . GetResponseStream ( ) )
responseContent = reader . ReadToEnd ( )
End Using
End Using
import groovyx . net . http . RESTClient
import static groovyx . net . http . ContentType . JSON
import groovy . json . JsonSlurper
import 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" = "Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg=="
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 : @ "Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==" 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 : request
completionHandler :
^ ( NSData * data , NSURLResponse * response , NSError * error ) {
if ( 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
let 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 ( "Bearer Q0xJMDAAAAAAAAABUYDOL8O67z2B7oVbKs+V2x2nfGMx3GascjMPJxcGFxvOyg==" , 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 in
if 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 ( )
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.
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.
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
.