diff --git a/DotNET/Single Calls/extract-text.cs b/DotNET/Single Calls/extracted-text.cs similarity index 97% rename from DotNET/Single Calls/extract-text.cs rename to DotNET/Single Calls/extracted-text.cs index 5fb2547..37685dd 100644 --- a/DotNET/Single Calls/extract-text.cs +++ b/DotNET/Single Calls/extracted-text.cs @@ -2,7 +2,7 @@ using (var httpClient = new HttpClient { BaseAddress = new Uri("https://api.pdfrest.com") }) { - using (var request = new HttpRequestMessage(HttpMethod.Post, "extract-text")) + using (var request = new HttpRequestMessage(HttpMethod.Post, "extracted-text")) { request.Headers.TryAddWithoutValidation("Api-Key", "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"); request.Headers.Accept.Add(new("application/json")); diff --git a/Java/Single Calls/ExtractText.java b/Java/Single Calls/ExtractedText.java similarity index 95% rename from Java/Single Calls/ExtractText.java rename to Java/Single Calls/ExtractedText.java index 71d1a2b..159b031 100644 --- a/Java/Single Calls/ExtractText.java +++ b/Java/Single Calls/ExtractedText.java @@ -9,7 +9,7 @@ import okhttp3.Response; import org.json.JSONObject; -public class ExtractText { +public class ExtractedText { // Specify the path to your file here, or as the first argument when running the program. private static final String DEFAULT_FILE_PATH = "/path/to/file.pdf"; @@ -38,7 +38,7 @@ public static void main(String[] args) { Request request = new Request.Builder() .header("Api-Key", dotenv.get("PDFREST_API_KEY", DEFAULT_API_KEY)) - .url("https://api.pdfrest.com/extract-text") + .url("https://api.pdfrest.com/extracted-text") .post(requestBody) .build(); try { diff --git a/JavaScript/Single Calls/extract-text.js b/JavaScript/Single Calls/extracted-text.js similarity index 83% rename from JavaScript/Single Calls/extract-text.js rename to JavaScript/Single Calls/extracted-text.js index 4ca8c17..30e28df 100644 --- a/JavaScript/Single Calls/extract-text.js +++ b/JavaScript/Single Calls/extracted-text.js @@ -11,7 +11,7 @@ data.append("file", fs.createReadStream("/path/to/file")); var config = { method: "post", maxBodyLength: Infinity, // set maximum length of the request body - url: "https://api.pdfrest.com/extract-text", + url: "https://api.pdfrest.com/extracted-text", headers: { "Api-Key": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // Replace with your API key ...data.getHeaders(), // set headers for the request @@ -27,5 +27,3 @@ axios(config) .catch(function (error) { console.log(error); }); - -// If you would like to download the file instead of getting the JSON response, please see the 'get-resource-id-endpoint.js' sample. diff --git a/PHP/Single Calls/extract-text.php b/PHP/Single Calls/extracted-text.php similarity index 88% rename from PHP/Single Calls/extract-text.php rename to PHP/Single Calls/extracted-text.php index fd6c7fa..c44ec65 100644 --- a/PHP/Single Calls/extract-text.php +++ b/PHP/Single Calls/extracted-text.php @@ -24,7 +24,7 @@ ] ]; -$request = new Request('POST', 'https://api.pdfrest.com/extract-text', $headers); // Create a new HTTP POST request with the API endpoint and headers. +$request = new Request('POST', 'https://api.pdfrest.com/extracted-text', $headers); // Create a new HTTP POST request with the API endpoint and headers. $res = $client->sendAsync($request, $options)->wait(); // Send the asynchronous request and wait for the response. diff --git a/Python/Single Calls/extract-text.py b/Python/Single Calls/extracted-text.py similarity index 70% rename from Python/Single Calls/extract-text.py rename to Python/Single Calls/extracted-text.py index 741bb8f..e6677a6 100644 --- a/Python/Single Calls/extract-text.py +++ b/Python/Single Calls/extracted-text.py @@ -2,17 +2,17 @@ import requests import json -extract_text_endpoint_url = 'https://api.pdfrest.com/extract-text' +extract_text_endpoint_url = 'https://api.pdfrest.com/extracted-text' -# The /extract-text endpoint can take a single PDF file or id as input. -#This sample demonstrates querying the title, page count, document language and author +# The /extracted-text endpoint can take a single PDF file or id as input. +#This sample demonstrates extracting the text from a document to return as JSON mp_encoder_extractText = MultipartEncoder( fields={ 'file': ('file_name', open('/path/to/file', 'rb'), 'application/pdf'), } ) -# Let's set the headers that the extract-text endpoint expects. +# Let's set the headers that the extracted-text endpoint expects. # Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart/form-data' via the content_type attribute below. headers = { 'Accept': 'application/json', @@ -20,7 +20,7 @@ 'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here } -print("Sending POST request to extract-text endpoint...") +print("Sending POST request to extracted-text endpoint...") response = requests.post(extract_text_endpoint_url, data=mp_encoder_extractText, headers=headers) print("Response status code: " + str(response.status_code)) diff --git a/cURL/Single Calls/extract-text.sh b/cURL/Single Calls/extracted-text.sh similarity index 61% rename from cURL/Single Calls/extract-text.sh rename to cURL/Single Calls/extracted-text.sh index b9823f5..a7d54dd 100755 --- a/cURL/Single Calls/extract-text.sh +++ b/cURL/Single Calls/extracted-text.sh @@ -1,5 +1,5 @@ -curl -X POST "https://api.pdfrest.com/extract-text" \ +curl -X POST "https://api.pdfrest.com/extracted-text" \ -H "Accept: application/json" \ -H "Content-Type: multipart/form-data" \ -H "Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \ - -F "file=@/path/to/file" + -F "file=@/path/to/file"