public static async Task UploadFileExample() { string testFilePath = Directory.GetCurrentDirectory(); FileInfo file = new FileInfo(Path.Combine(testFilePath, "Files/ExampleAsApplied.zip")); if (!file.Exists) { throw new Exception("Missing file"); } GetTreeResponse tree = await DataExchangeAPI.GetTree(); if (tree.Success) { const string nodeNameToSearchFor = ""; TelematicsNodeResponse nodeToSendFileTo = FindNode(tree.Data, nodeNameToSearchFor); PostSendFileResponse response = await DataExchangeAPI.PostSendFiles(nodeToSendFileTo.TelematicsNodeID, file); if (response.Status.Equals("Failed")) { throw new Exception("Did not send the file correctly"); } } await Task.CompletedTask; }
public static async Task <GetTreeResponse> GetTreeExample() { TelematicsV2 telematicsV2 = new TelematicsV2(publicKey, privateKey, userKey); GetTreeResponse response = await telematicsV2.GetTree(); return(response); }
/// <summary> /// The GET TelematicsNodeV2/Tree endpoint returns the entire telematics node tree for all of the equipment assets the user can access. /// These assets are formatted in a tree structure with zero to many child nodes for each parent node. /// </summary> /// <returns></returns> public async Task <GetTreeResponse> GetTree() { Dictionary <string, string> headers = ApiUtilities.BuildHeaders(UserKey, PublicKey, PrivateKey, "telematicsnodev2/tree"); HttpResponseMessage response = await Api.Get("telematicsnodev2/tree", headers); GetTreeResponse result = await Api.DeserializeContent <GetTreeResponse>(response); return(result); }
public static async Task GetTreeExample() { GetTreeResponse response = await DataExchangeAPI.GetTree(); if (!response.Success) { throw new Exception("Did not successfully get the Tree from DE2"); } await Task.CompletedTask; }