Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
94391bf
cURL: Add delete step to redact endpoints
datalogics-dliang Sep 2, 2025
3477d38
cURL: Add delete step to watermark endpoints
datalogics-dliang Sep 2, 2025
e6ad30a
cURL: Add delete step to encrypt endpoints
datalogics-dliang Sep 2, 2025
a79445f
cURL: Add delete step to restrict endpoints
datalogics-dliang Sep 2, 2025
0544169
Add optional delete step to base security samples
datalogics-dliang Sep 3, 2025
a57b830
Run `mvn spotless:apply` to Java JSON samples
datalogics-dliang Sep 3, 2025
085dcec
Update PDFWithRedactedTextPreview.java
datalogics-dliang Sep 3, 2025
cbb1d91
PDFWithRedactedTextPreview.java: fix formatting
datalogics-dliang Sep 3, 2025
af4b25b
Fix jq syntax errors in cURL
datalogics-dliang Sep 4, 2025
ae73d88
Correct typos and make headers consistent
datalogics-dliang Sep 4, 2025
84b0b90
Correct complex watermark example
datalogics-dliang Sep 4, 2025
fd488fe
Correct basic watermark sample
datalogics-dliang Sep 4, 2025
7535565
Fix watermark samples for other languages
datalogics-dliang Sep 4, 2025
82559c9
cURL: Make deletion step toggleable
datalogics-dliang Sep 5, 2025
b53f697
Make delete step optional with local toggle
datalogics-dliang Sep 5, 2025
ef1c7b5
Standardize variable naming in cURL
datalogics-dliang Sep 5, 2025
abf0b6c
Format Java samples
datalogics-dliang Sep 5, 2025
5f8fb18
cURL: Delete all files in workflow
datalogics-dliang Sep 8, 2025
7264252
cURL: pretty-print outputs for consistency
datalogics-dliang Sep 8, 2025
02866e7
Delete all output files
datalogics-dliang Sep 8, 2025
1954c5c
Delete all input files
datalogics-dliang Sep 8, 2025
910f2bb
Format Java comments
datalogics-dliang Sep 8, 2025
84c05ff
cURL: Delete input files for decrypt-add-reencrypt
datalogics-dliang Sep 8, 2025
c88dffc
Merge remote-tracking branch 'upstream/main' into security-optional-d…
datalogics-dliang Sep 8, 2025
26a5c58
Update placeholder api-key with variable
datalogics-dliang Sep 9, 2025
696fe94
Fix namespace for DotNET samples
datalogics-dliang Sep 9, 2025
56d31d2
Fix inconsistent indentation
datalogics-dliang Sep 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions DotNET/Endpoint Examples/JSON Payload/decrypted-pdf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,34 @@ public static async Task Execute(string[] args)

Console.WriteLine("Processing response received.");
Console.WriteLine(decryptResult);

// All files uploaded or generated are automatically deleted based on the
// File Retention Period as shown on https://pdfrest.com/pricing.
// For immediate deletion of files, particularly when sensitive data
// is involved, an explicit delete call can be made to the API.
//
// Deletes all files in the workflow, including outputs. Save all desired files before enabling this step.

// Toggle deletion of sensitive files (default: false)
var deleteSensitiveFiles = false;

if (deleteSensitiveFiles)
{
using (var deleteRequest = new HttpRequestMessage(HttpMethod.Post, "delete"))
{
deleteRequest.Headers.TryAddWithoutValidation("Api-Key", apiKey);
deleteRequest.Headers.Accept.Add(new("application/json"));
deleteRequest.Headers.TryAddWithoutValidation("Content-Type", "application/json");

var parsed = JObject.Parse(decryptResult);
var outId = parsed["outputId"].ToString();
JObject deleteJson = new JObject { ["ids"] = $"{uploadedID}, {outId}" };
deleteRequest.Content = new StringContent(deleteJson.ToString(), Encoding.UTF8, "application/json");
var deleteResponse = await httpClient.SendAsync(deleteRequest);
var deleteResult = await deleteResponse.Content.ReadAsStringAsync();
Console.WriteLine(deleteResult);
}
}
}
}
}
Expand Down
31 changes: 31 additions & 0 deletions DotNET/Endpoint Examples/JSON Payload/encrypted-pdf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,37 @@ public static async Task Execute(string[] args)

Console.WriteLine("Processing response received.");
Console.WriteLine(encryptResult);
JObject encryptResultJson = JObject.Parse(encryptResult);
var outputID = encryptResultJson["outputId"];

// All files uploaded or generated are automatically deleted based on the
// File Retention Period as shown on https://pdfrest.com/pricing.
// For immediate deletion of files, particularly when sensitive data
// is involved, an explicit delete call can be made to the API.
//
// Deletes all files in the workflow, including outputs. Save all desired files before enabling this step.

// Toggle deletion of sensitive files (default: false)
var deleteSensitiveFiles = false;

if (deleteSensitiveFiles)
{
using (var deleteRequest = new HttpRequestMessage(HttpMethod.Post, "delete"))
{
deleteRequest.Headers.TryAddWithoutValidation("Api-Key", apiKey);
deleteRequest.Headers.Accept.Add(new("application/json"));
deleteRequest.Headers.TryAddWithoutValidation("Content-Type", "application/json");

JObject deleteJson = new JObject
{
["ids"] = $"{uploadedID}, {outputID}"
};
deleteRequest.Content = new StringContent(deleteJson.ToString(), Encoding.UTF8, "application/json");
var deleteResponse = await httpClient.SendAsync(deleteRequest);
var deleteResult = await deleteResponse.Content.ReadAsStringAsync();
Console.WriteLine(deleteResult);
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,38 @@ public static async Task Execute(string[] args)
var redactedTextResult = await redactedTextResponse.Content.ReadAsStringAsync();
Console.WriteLine("Processing response received.");
Console.WriteLine(redactedTextResult);

JObject appliedResultJson = JObject.Parse(redactedTextResult);
var outputID = appliedResultJson["outputId"];

// All files uploaded or generated are automatically deleted based on the
// File Retention Period as shown on https://pdfrest.com/pricing.
// For immediate deletion of files, particularly when sensitive data
// is involved, an explicit delete call can be made to the API.
//
// Deletes all files in the workflow, including outputs. Save all desired files before enabling this step.

// Toggle deletion of sensitive files (default: false)
var deleteSensitiveFiles = false;

if (deleteSensitiveFiles)
{
using (var deleteRequest = new HttpRequestMessage(HttpMethod.Post, "delete"))
{
deleteRequest.Headers.TryAddWithoutValidation("Api-Key", apiKey);
deleteRequest.Headers.Accept.Add(new("application/json"));
deleteRequest.Headers.TryAddWithoutValidation("Content-Type", "application/json");

JObject deleteJson = new JObject
{
["ids"] = $"{uploadedID}, {outputID}"
};
deleteRequest.Content = new StringContent(deleteJson.ToString(), Encoding.UTF8, "application/json");
var deleteResponse = await httpClient.SendAsync(deleteRequest);
var deleteResult = await deleteResponse.Content.ReadAsStringAsync();
Console.WriteLine(deleteResult);
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,35 @@ public static async Task Execute(string[] args)
var redactedTextResult = await redactedTextResponse.Content.ReadAsStringAsync();
Console.WriteLine("Processing response received.");
Console.WriteLine(redactedTextResult);

// All files uploaded or generated are automatically deleted based on the
// File Retention Period as shown on https://pdfrest.com/pricing.
// For immediate deletion of files, particularly when sensitive data
// is involved, an explicit delete call can be made to the API.
//
// Deletes all files in the workflow, including outputs. Save all desired files before enabling this step.
// IMPORTANT: Do not delete the previewId (the preview PDF) file until after the redaction is applied
// with the /pdf-with-redacted-text-applied endpoint.

// Toggle deletion of sensitive files (default: false)
var deleteSensitiveFiles = false;

if (deleteSensitiveFiles)
{
using (var deleteRequest = new HttpRequestMessage(HttpMethod.Post, "delete"))
{
deleteRequest.Headers.TryAddWithoutValidation("Api-Key", apiKey);
deleteRequest.Headers.Accept.Add(new("application/json"));
deleteRequest.Headers.TryAddWithoutValidation("Content-Type", "application/json");

var previewId = JObject.Parse(redactedTextResult)["outputId"].ToString();
JObject deleteJson = new JObject { ["ids"] = uploadedID + ", " + previewId };
deleteRequest.Content = new StringContent(deleteJson.ToString(), Encoding.UTF8, "application/json");
var deleteResponse = await httpClient.SendAsync(deleteRequest);
var deleteResult = await deleteResponse.Content.ReadAsStringAsync();
Console.WriteLine(deleteResult);
}
}
}
}
}
Expand Down
31 changes: 31 additions & 0 deletions DotNET/Endpoint Examples/JSON Payload/restricted-pdf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,37 @@ public static async Task Execute(string[] args)

Console.WriteLine("Processing response received.");
Console.WriteLine(restrictResult);
JObject restrictResultJson = JObject.Parse(restrictResult);
var outputID = restrictResultJson["outputId"];

// All files uploaded or generated are automatically deleted based on the
// File Retention Period as shown on https://pdfrest.com/pricing.
// For immediate deletion of files, particularly when sensitive data
// is involved, an explicit delete call can be made to the API.
//
// Deletes all files in the workflow, including outputs. Save all desired files before enabling this step.

// Toggle deletion of sensitive files (default: false)
var deleteSensitiveFiles = false;

if (deleteSensitiveFiles)
{
using (var deleteRequest = new HttpRequestMessage(HttpMethod.Post, "delete"))
{
deleteRequest.Headers.TryAddWithoutValidation("Api-Key", apiKey);
deleteRequest.Headers.Accept.Add(new("application/json"));
deleteRequest.Headers.TryAddWithoutValidation("Content-Type", "application/json");

JObject deleteJson = new JObject
{
["ids"] = $"{uploadedID}, {outputID}"
};
deleteRequest.Content = new StringContent(deleteJson.ToString(), Encoding.UTF8, "application/json");
var deleteResponse = await httpClient.SendAsync(deleteRequest);
var deleteResult = await deleteResponse.Content.ReadAsStringAsync();
Console.WriteLine(deleteResult);
}
}
}
}
}
Expand Down
28 changes: 28 additions & 0 deletions DotNET/Endpoint Examples/JSON Payload/unrestricted-pdf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,34 @@ public static async Task Execute(string[] args)

Console.WriteLine("Processing response received.");
Console.WriteLine(unrestrictResult);

// All files uploaded or generated are automatically deleted based on the
// File Retention Period as shown on https://pdfrest.com/pricing.
// For immediate deletion of files, particularly when sensitive data
// is involved, an explicit delete call can be made to the API.
//
// Deletes all files in the workflow, including outputs. Save all desired files before enabling this step.

// Toggle deletion of sensitive files (default: false)
var deleteSensitiveFiles = false;

if (deleteSensitiveFiles)
{
using (var deleteRequest = new HttpRequestMessage(HttpMethod.Post, "delete"))
{
deleteRequest.Headers.TryAddWithoutValidation("Api-Key", apiKey);
deleteRequest.Headers.Accept.Add(new("application/json"));
deleteRequest.Headers.TryAddWithoutValidation("Content-Type", "application/json");

var parsed = JObject.Parse(unrestrictResult);
var outId = parsed["outputId"].ToString();
JObject deleteJson = new JObject { ["ids"] = $"{uploadedID}, {outId}" };
deleteRequest.Content = new StringContent(deleteJson.ToString(), Encoding.UTF8, "application/json");
var deleteResponse = await httpClient.SendAsync(deleteRequest);
var deleteResult = await deleteResponse.Content.ReadAsStringAsync();
Console.WriteLine(deleteResult);
}
}
}
}
}
Expand Down
31 changes: 31 additions & 0 deletions DotNET/Endpoint Examples/JSON Payload/watermarked-pdf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,37 @@ public static async Task Execute(string[] args)
var watermarkResult = await watermarkResponse.Content.ReadAsStringAsync();
Console.WriteLine("Processing response received.");
Console.WriteLine(watermarkResult);
JObject watermarkResultJson = JObject.Parse(watermarkResult);
var outputID = watermarkResultJson["outputId"];

// All files uploaded or generated are automatically deleted based on the
// File Retention Period as shown on https://pdfrest.com/pricing.
// For immediate deletion of files, particularly when sensitive data
// is involved, an explicit delete call can be made to the API.
//
// Deletes all files in the workflow, including outputs. Save all desired files before enabling this step.

// Toggle deletion of sensitive files (default: false)
var deleteSensitiveFiles = false;

if (deleteSensitiveFiles)
{
using (var deleteRequest = new HttpRequestMessage(HttpMethod.Post, "delete"))
{
deleteRequest.Headers.TryAddWithoutValidation("Api-Key", apiKey);
deleteRequest.Headers.Accept.Add(new("application/json"));
deleteRequest.Headers.TryAddWithoutValidation("Content-Type", "application/json");

JObject deleteJson = new JObject
{
["ids"] = $"{uploadedID}, {outputID}"
};
deleteRequest.Content = new StringContent(deleteJson.ToString(), Encoding.UTF8, "application/json");
var deleteResponse = await httpClient.SendAsync(deleteRequest);
var deleteResult = await deleteResponse.Content.ReadAsStringAsync();
Console.WriteLine(deleteResult);
}
}
}
}
}
Expand Down
31 changes: 31 additions & 0 deletions DotNET/Endpoint Examples/Multipart Payload/decrypted-pdf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

using System.Text;



namespace Samples.EndpointExamples.MultipartPayload
{
public static class DecryptedPdf
Expand Down Expand Up @@ -69,6 +71,35 @@ public static async Task Execute(string[] args)

Console.WriteLine("API response received.");
Console.WriteLine(apiResult);

// All files uploaded or generated are automatically deleted based on the
// File Retention Period as shown on https://pdfrest.com/pricing.
// For immediate deletion of files, particularly when sensitive data
// is involved, an explicit delete call can be made to the API.
//
// Deletes all files in the workflow, including outputs. Save all desired files before enabling this step.

// Toggle deletion of sensitive files (default: false)
var deleteSensitiveFiles = false;

if (deleteSensitiveFiles)
{
using (var deleteRequest = new HttpRequestMessage(HttpMethod.Post, "delete"))
{
deleteRequest.Headers.TryAddWithoutValidation("Api-Key", apiKey);
deleteRequest.Headers.Accept.Add(new("application/json"));
deleteRequest.Headers.TryAddWithoutValidation("Content-Type", "application/json");

var parsed = Newtonsoft.Json.Linq.JObject.Parse(apiResult);
var inId = parsed["inputId"].ToString();
var outId = parsed["outputId"].ToString();
var deleteJson = new Newtonsoft.Json.Linq.JObject { ["ids"] = $"{inId}, {outId}" };
deleteRequest.Content = new StringContent(deleteJson.ToString(), Encoding.UTF8, "application/json");
var deleteResponse = await httpClient.SendAsync(deleteRequest);
var deleteResult = await deleteResponse.Content.ReadAsStringAsync();
Console.WriteLine(deleteResult);
}
}
}
}
}
Expand Down
31 changes: 31 additions & 0 deletions DotNET/Endpoint Examples/Multipart Payload/encrypted-pdf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

using System.Text;



namespace Samples.EndpointExamples.MultipartPayload
{
public static class EncryptedPdf
Expand Down Expand Up @@ -69,6 +71,35 @@ public static async Task Execute(string[] args)

Console.WriteLine("API response received.");
Console.WriteLine(apiResult);

// All files uploaded or generated are automatically deleted based on the
// File Retention Period as shown on https://pdfrest.com/pricing.
// For immediate deletion of files, particularly when sensitive data
// is involved, an explicit delete call can be made to the API.
//
// Deletes all files in the workflow, including outputs. Save all desired files before enabling this step.

// Toggle deletion of sensitive files (default: false)
var deleteSensitiveFiles = false;

if (deleteSensitiveFiles)
{
using (var deleteRequest = new HttpRequestMessage(HttpMethod.Post, "delete"))
{
deleteRequest.Headers.TryAddWithoutValidation("Api-Key", apiKey);
deleteRequest.Headers.Accept.Add(new("application/json"));
deleteRequest.Headers.TryAddWithoutValidation("Content-Type", "application/json");

var parsed = Newtonsoft.Json.Linq.JObject.Parse(apiResult);
var inId = parsed["inputId"].ToString();
var outId = parsed["outputId"].ToString();
var deleteJson = new Newtonsoft.Json.Linq.JObject { ["ids"] = $"{inId}, {outId}" };
deleteRequest.Content = new StringContent(deleteJson.ToString(), Encoding.UTF8, "application/json");
var deleteResponse = await httpClient.SendAsync(deleteRequest);
var deleteResult = await deleteResponse.Content.ReadAsStringAsync();
Console.WriteLine(deleteResult);
}
}
}
}
}
Expand Down
Loading