public JObject UnRelateProjectToFormInstance(Guid formInstanceId, Guid projectId, RequestOptions options = null) { dynamic postData = new ExpandoObject(); var queryString = string.Format("relateToId={0}", UrlEncode(projectId.ToString())); return HttpHelper.PutResponse(GlobalConfiguration.Routes.FormInstanceIdUnRelateProject, queryString, GetUrlParts(), this.ClientSecrets, this.ApiTokens, postData, formInstanceId); }
public List<IndexFieldDefinition> GetIndexFields(RequestOptions options = null) { if (options != null && !string.IsNullOrWhiteSpace(options.Fields)) { options.Fields = UrlEncode(options.Fields); } return HttpHelper.GetListResult<IndexFieldDefinition>(VVRestApi.GlobalConfiguration.Routes.IndexFields, "", options, GetUrlParts(), this.ClientSecrets, this.ApiTokens); }
public List<Document> GetDocumentsSharedWithMe(RequestOptions options = null) { if (options != null && !string.IsNullOrWhiteSpace(options.Fields)) { options.Fields = UrlEncode(options.Fields); } return HttpHelper.GetListResult<Document>(VVRestApi.GlobalConfiguration.Routes.DocumentsShares, "", options, GetUrlParts(), this.ClientSecrets, this.ApiTokens); }
public int GetUserAnnotationPermissions(Guid usId, string layerName, RequestOptions options = null) { var queryString = string.Format("layerName={0}", layerName); var result = HttpHelper.Get(GlobalConfiguration.Routes.DocumentViewerAnnotationsPermissionsId, queryString, options, GetUrlParts(), this.ApiTokens, usId); return result.Value<int>("data"); }
/// <summary> /// returns the list of related documents to a form instance /// </summary> /// <returns></returns> public List<Document> GetDocumentsRelatedToFormInstance(Guid formInstanceId, RequestOptions options = null) { if (options != null && !string.IsNullOrWhiteSpace(options.Fields)) { options.Fields = UrlEncode(options.Fields); } return HttpHelper.GetListResult<Document>(VVRestApi.GlobalConfiguration.Routes.FormInstanceIdDocuments, "", options, GetUrlParts(), this.ClientSecrets, this.ApiTokens, formInstanceId); }
public List<User> GetGroupMembers(Guid groupId, RequestOptions options = null) { if (options != null && !string.IsNullOrWhiteSpace(options.Fields)) { options.Fields = UrlEncode(options.Fields); } return HttpHelper.GetListResult<User>(VVRestApi.GlobalConfiguration.Routes.GroupsIdUsers, "", options, GetUrlParts(), this.ClientSecrets, this.ApiTokens, groupId); }
/// <summary> /// gets the top level folders /// </summary> /// <param name="options"></param> /// <returns></returns> public List<Folder> GetTopLevelFolders(RequestOptions options = null) { if (options != null && !string.IsNullOrWhiteSpace(options.Fields)) { options.Fields = UrlEncode(options.Fields); } return HttpHelper.GetListResult<Folder>(VVRestApi.GlobalConfiguration.Routes.Folders, "folderPath=" + this.UrlEncode("/"), options, GetUrlParts(), this.ClientSecrets, this.ApiTokens); }
public Folder GetFolderByFolderId(Guid folderId, RequestOptions options = null) { if (options != null && !string.IsNullOrWhiteSpace(options.Fields)) { options.Fields = UrlEncode(options.Fields); } return HttpHelper.Get<Folder>(VVRestApi.GlobalConfiguration.Routes.FoldersId, "", options, GetUrlParts(), this.ClientSecrets, this.ApiTokens, folderId); }
/// <summary> /// /// </summary> /// <param name="formTemplateId"></param> /// <param name="options"></param> /// <returns></returns> public List<FormInstance> GetFormInstanceData(Guid formTemplateId, RequestOptions options = null) { if (options != null && !string.IsNullOrWhiteSpace(options.Fields)) { options.Fields = UrlEncode(options.Fields); } return HttpHelper.GetListResult<FormInstance>(GlobalConfiguration.Routes.FormTemplatesForms, "", options, GetUrlParts(), this.ClientSecrets, this.ApiTokens, formTemplateId); }
/// <summary> /// Gets persisted client data by id, returns null if none exists /// </summary> /// <param name="id"> </param> /// <param name="options">A set of options to define how many items to return, a custom query, etc.</param> /// <returns></returns> public PersistedClientData GetData(Guid id, RequestOptions options = null) { if (options == null) { options = new RequestOptions { Expand = true }; } return HttpHelper.Get<PersistedClientData>(VVRestApi.GlobalConfiguration.Routes.PersistedDataId, string.Empty, options, GetUrlParts(), this.ClientSecrets, this.ApiTokens, id); }
/// <summary> /// /// </summary> /// <param name="options"></param> /// <returns></returns> public CustomerDatabaseInfo GetCustomerDatabaseInfo(RequestOptions options = null) { if (options != null && !string.IsNullOrWhiteSpace(options.Fields)) { options.Fields = UrlEncode(options.Fields); } return HttpHelper.Get<CustomerDatabaseInfo>(VVRestApi.GlobalConfiguration.Routes.CustomersCustomerDatabases, "", options, GetUrlParts(), this.ClientSecrets, this.ApiTokens); }
/// <summary> /// returns the result of a saved query /// </summary> /// <param name="queryId"></param> /// <param name="options"></param> /// <returns></returns> public dynamic GetCustomQueryResults(Guid queryId, RequestOptions options = null) { if (options != null && !string.IsNullOrWhiteSpace(options.Fields)) { options.Fields = UrlEncode(options.Fields); } var results = HttpHelper.Get(VVRestApi.GlobalConfiguration.Routes.CustomQueryId, "", options, GetUrlParts(), this.ApiTokens, queryId); var data = results.Value<JArray>("data"); return data; }
/// <summary> /// returns the result of the saved query /// </summary> /// <param name="queryName"></param> /// <param name="options"></param> /// <returns></returns> public JArray GetCustomQueryResults(string queryName, RequestOptions options = null) { if (options != null && !string.IsNullOrWhiteSpace(options.Fields)) { options.Fields = UrlEncode(options.Fields); } var queryString = string.Format("queryName={0}", UrlEncode(queryName)); var results = HttpHelper.Get(VVRestApi.GlobalConfiguration.Routes.CustomQuery, queryString, options, GetUrlParts(), this.ApiTokens); var data = results.Value<JArray>("data"); return data; }
public List<DocumentShare> GetListOfUsersDocumentSharedWith(Guid dlId, RequestOptions options = null) { if (dlId.Equals(Guid.Empty)) { throw new ArgumentException("dlId is required but was an empty Guid", "dlId"); } if (options != null && !string.IsNullOrWhiteSpace(options.Fields)) { options.Fields = UrlEncode(options.Fields); } return HttpHelper.GetListResult<DocumentShare>(VVRestApi.GlobalConfiguration.Routes.DocumentsIdShares, "", options, GetUrlParts(), this.ClientSecrets, this.ApiTokens, dlId); }
public List<Document> GetFolderDocuments(Guid folderId, string sortBy, string sortDirection, RequestOptions options = null) { if (options != null && !string.IsNullOrWhiteSpace(options.Fields)) { options.Fields = UrlEncode(options.Fields); } var sb = new StringBuilder(); sb.Append("sort="); sb.Append(UrlEncode(sortBy)); sb.Append("&sortDir="); sb.Append(UrlEncode(sortDirection)); return HttpHelper.GetListResult<Document>(VVRestApi.GlobalConfiguration.Routes.FolderDocuments, sb.ToString(), options, GetUrlParts(), this.ClientSecrets, this.ApiTokens, folderId); }
/// <summary> /// Gets the current user based on the CurrentToken /// </summary> /// <returns></returns> public List<MetaDataType> GetDataTypes() { // Let's reuse the list of names once we have gotten them if (this.DataTypes == null) { try { RequestOptions options = new RequestOptions { Expand = true }; this.DataTypes = new List<MetaDataType>(HttpHelper.GetPagedResult<MetaDataType>(GlobalConfiguration.Routes.Meta, string.Empty, options, GetUrlParts(), this.ClientSecrets, this.ApiTokens).Items); } catch (Exception e) { LogEventManager.Error("Error getting data types", e); } } return this.DataTypes; }
public void GetDocumentBySearchIncludeIndexFields() { var clientSecrets = new ClientSecrets { ApiKey = RestApiTests.ClientId, ApiSecret = RestApiTests.ClientSecret, OAuthTokenEndPoint = RestApiTests.OAuthServerTokenEndPoint, BaseUrl = RestApiTests.VaultApiBaseUrl, ApiVersion = RestApiTests.ApiVersion, CustomerAlias = RestApiTests.CustomerAlias, DatabaseAlias = RestApiTests.DatabaseAlias, Scope = RestApiTests.Scope }; var vaultApi = new VaultApi(clientSecrets); Assert.IsNotNull(vaultApi); var options = new RequestOptions();//c9b9db43-5bcf-e411-8281-14feb5f06078 options.Query = "[Animals Two] eq 'Monkey' OR LEN([Cats]) > 8"; //options.Query = "[Name Field] eq 'Receipt'"; //options.Query = "LEN([Cats]) = 9 AND [Cats] = 'Chartreux'"; //options.Query = "LEN('Chartreux') = 9 AND [Cats] = 'Chartreux'"; //options.Expand = true; //options.Query = "name eq 'Arbys-00074'"; options.Fields = "Id,DocumentId,Name,Description,ReleaseState,Text1,Cats"; //options.Query = "[Name Field] eq 'Receipt'"; //options.Fields = "Id,DocumentId,Name,Description,ReleaseState,Name Field,Start Date"; //var document = vaultApi.Documents.GetDocument(dlId, new RequestOptions { Fields = "Id,DhId,FieldId,FieldType,Label,Required,Value,OrdinalPosition,CreateDate,CreateById,CreateBy,ModifyDate,ModifyBy,ModifyById" }); var document = vaultApi.Documents.GetDocumentsBySearch(options); Assert.IsNotNull(document); }
public void GetGlobalIndexFieldDefinition() { var clientSecrets = new ClientSecrets { ApiKey = RestApiTests.ClientId, ApiSecret = RestApiTests.ClientSecret, OAuthTokenEndPoint = RestApiTests.OAuthServerTokenEndPoint, BaseUrl = RestApiTests.VaultApiBaseUrl, ApiVersion = RestApiTests.ApiVersion, CustomerAlias = RestApiTests.CustomerAlias, DatabaseAlias = RestApiTests.DatabaseAlias, Scope = RestApiTests.Scope }; var vaultApi = new VaultApi(clientSecrets); Assert.IsNotNull(vaultApi); var options = new RequestOptions(); options.Query = "label eq 'Start Date'"; var matchingIndexDefs = vaultApi.IndexFields.GetIndexFields(options); //var indexFields = vaultApi.IndexFields.GetIndexFields(); Assert.IsNotNull(matchingIndexDefs); }
public void RequestOptionTest() { VVRestApi.Common.RequestOptions options = new RequestOptions(); options.Query = "name eq 'world' AND id eq 'whatever'"; var request = options.GetQueryString("q=userid eq 'vault.config'&stuff=things"); Assert.IsNotNullOrEmpty(request); }
public List<IndexFieldSelectOption> GetFolderIndexFieldSelectOptionsList(Guid folderId, Guid fieldId, RequestOptions options = null) { if (folderId.Equals(Guid.Empty)) { throw new ArgumentException("FolderId is required but was an empty Guid", "folderId"); } if (fieldId.Equals(Guid.Empty)) { throw new ArgumentException("FieldId is required but was an empty Guid", "fieldId"); } return HttpHelper.GetListResult<IndexFieldSelectOption>(VVRestApi.GlobalConfiguration.Routes.FoldersIdIndexFieldsIdSelectOptions, "", options, GetUrlParts(), this.ClientSecrets, this.ApiTokens, folderId, fieldId); }
public List<SecurityMember> GetFolderSecurityMembers(Guid folderId, RequestOptions options = null) { if (!string.IsNullOrWhiteSpace(options?.Fields)) { options.Fields = UrlEncode(options.Fields); } return HttpHelper.GetListResult<SecurityMember>(VVRestApi.GlobalConfiguration.Routes.FoldersIdSecurityMembers, "", options, GetUrlParts(), this.ClientSecrets, this.ApiTokens, folderId); }
/// <summary> /// returns a list of child folders /// </summary> public List<Folder> GetChildFolders(Guid parentFolderid, RequestOptions options = null) { if (options != null && !string.IsNullOrWhiteSpace(options.Fields)) { options.Fields = UrlEncode(options.Fields); } return HttpHelper.GetListResult<Folder>(VVRestApi.GlobalConfiguration.Routes.FoldersIdFolders, "", options, GetUrlParts(), this.ClientSecrets, this.ApiTokens, parentFolderid); }
/// <summary> /// Gets a folder by its path, returns null if none exists /// </summary> /// <param name="folderPath"> </param> /// <param name="options"> </param> /// <returns></returns> public Folder GetFolderByPath(string folderPath, RequestOptions options = null) { return HttpHelper.Get<Folder>(VVRestApi.GlobalConfiguration.Routes.Folders, "folderPath=" + this.UrlEncode(folderPath), options, GetUrlParts(), this.ClientSecrets,this.ApiTokens); }
public void FormDataLookupByInstanceNameTest() { ClientSecrets clientSecrets = new ClientSecrets { ApiKey = RestApiTests.ClientId, ApiSecret = RestApiTests.ClientSecret, OAuthTokenEndPoint = RestApiTests.OAuthServerTokenEndPoint, BaseUrl = RestApiTests.VaultApiBaseUrl, ApiVersion = RestApiTests.ApiVersion, CustomerAlias = RestApiTests.CustomerAlias, DatabaseAlias = RestApiTests.DatabaseAlias, Scope = RestApiTests.Scope }; VaultApi vaultApi = new VaultApi(clientSecrets); Assert.IsNotNull(vaultApi); //"FormTemplates/bde2c653-f735-e511-80c8-0050568dab97/forms", "q=[instancename] eq '" + masterFormId + "'" "q=[instancename] eq 'Patient-000053'" //"bde2c653-f735-e511-80c8-0050568dab97" //Query = "[instancename] eq 'Patient-000053'", var requestOptions = new RequestOptions { Query = "[ModifyDate] ge '2015-11-07T22:18:09.444Z'", Fields = "dhdocid,revisionid" }; var formdata = vaultApi.FormTemplates.GetFormInstanceData(new Guid("FDC7C07B-5ACC-E511-AB37-5CF3706C36ED"), requestOptions); //foreach (FormTemplate formTemplate in formTemplates.Items) //{ // Assert.IsNotNullOrEmpty(formTemplate.Name); //} Assert.IsNotNull(formdata); }
/// <summary> /// GET to the server /// </summary> /// <param name="virtualPath">Path you want to access based on the base url of the token. Start it with '~/'. You can find paths that are used internally in VVRestApi.GlobalConfiguration.Routes .</param> /// <param name="queryString">The query string, already URL encoded</param> /// <param name="options"> /// Expand: If set to true, the request will return all available fields. /// Fields: A comma-delimited list of fields to return. If none are supplied, the server will return the default fields. /// </param> /// <param name="virtualPathArgs">The parameters to replace tokens in the virtualPath with.</param> /// <returns></returns> public JObject Get(string virtualPath, string queryString, RequestOptions options, params object[] virtualPathArgs) { return HttpHelper.Get(virtualPath, queryString, options, GetUrlParts(), this.ApiTokens, this.ClientSecrets, virtualPathArgs); }
/// <summary> /// Gets a user by their username /// </summary> /// <param name="username"></param> /// <param name="options"> </param> /// <returns></returns> public User GetUser(string username, RequestOptions options = null) { return HttpHelper.Get<User>(GlobalConfiguration.Routes.UsersDefaultCustomer, string.Format("q=[userid] eq '{0}'", username), options, GetUrlParts(),this.ClientSecrets, this.ApiTokens); }
/// <summary> /// Gets a page of users with no filter /// </summary> /// <param name="options"> </param> /// <returns></returns> public Page<User> GetUsers(RequestOptions options = null) { var results = HttpHelper.GetPagedResult<User>(GlobalConfiguration.Routes.Users, string.Empty, options, GetUrlParts(), this.ClientSecrets, this.ApiTokens); return results; }
public void FormDataTest() { ClientSecrets clientSecrets = new ClientSecrets { ApiKey = RestApiTests.ClientId, ApiSecret = RestApiTests.ClientSecret, OAuthTokenEndPoint = RestApiTests.OAuthServerTokenEndPoint, BaseUrl = RestApiTests.VaultApiBaseUrl, ApiVersion = RestApiTests.ApiVersion, CustomerAlias = RestApiTests.CustomerAlias, DatabaseAlias = RestApiTests.DatabaseAlias, Scope = RestApiTests.Scope }; VaultApi vaultApi = new VaultApi(clientSecrets); Assert.IsNotNull(vaultApi); var formTemplateId = new Guid("F9CB9977-5B0E-E211-80A1-14FEB5F06078"); //var options = new RequestOptions //{ // Fields = "dhdocid,revisionid,City,First Name,Unit" //}; var options = new RequestOptions { Query = "[VVModifyDate] ge '2015-11-07T22:18:09.444Z'", Expand = true }; var formdata = vaultApi.FormTemplates.GetFormInstanceData(formTemplateId, options); Assert.IsNotNull(formdata); //foreach (FormTemplate formTemplate in formTemplates.Items) //{ // Assert.IsNotNullOrEmpty(formTemplate.Name); //} //Assert.IsNotNull(formTemplates); }
public Page<User> GetAccountOwnersList(RequestOptions options = null) { var queryString = "isVaultAccess=true"; var results = HttpHelper.GetPagedResult<User>(GlobalConfiguration.Routes.Users, queryString, options, GetUrlParts(), this.ClientSecrets, this.ApiTokens); return results; }
public Page<User> GetDisabledUsers(RequestOptions options = null) { var queryString = "enabled=false"; var results = HttpHelper.GetPagedResult<User>(GlobalConfiguration.Routes.Users, queryString, options, GetUrlParts(), this.ClientSecrets, this.ApiTokens); return results; }