Get Word Count Info Using C#

Get Word Count Info Using C#

In this topic we are going to show you how to Get Word Count Info Using C#. We are going to use the following file as our input file:

https://www.docconversionapi.com/samples/example.docx

First we start a job by making a POST request to the following URL and include these parameters into your request: inputFile.

Request headers description:

X-ApplicationID Your application ID (which you get from your Doc Conversion API Account)
X-SecretKey Your secret key  (which you get from your Doc Conversion API Account)

Annotation 2020-06-01 222907

Get Word Count Info URL

https://api2.docconversionapi.com/jobs/create/word-info

Get Word Count Info example
using System;
using System.Globalization;
using System.IO;
using System.Net.Http;

namespace sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            using (HttpClient client = new HttpClient())
            {
                // Adding authentication headers
                client.DefaultRequestHeaders.Add("X-ApplicationID", "Get your key from https://app.docconversionapi.com/#/applications");
                client.DefaultRequestHeaders.Add("X-SecretKey", "Get your key from https://app.docconversionapi.com/#/applications");

                var inputFileUrl = "https://www.docconversionapi.com/samples/example.docx";

                using (var requestContent = new MultipartFormDataContent(
                    "Upload----" + DateTime.Now.ToString(CultureInfo.InvariantCulture)
                    ))
                {
                    // Setting body parameters
                    requestContent.Add(new StringContent(inputFileUrl), "inputFile");
                    requestContent.Add(new StringContent("WordsCount"), "operation");

                    // Sending a POST request to DCA API
                    using (var requestResultTask = client.PostAsync(
                        "https://api2.docconversionapi.com/api/jobs/create/word-info", requestContent
                    ))
                    {
                        var requestResult = requestResultTask.Result;

                        if (requestResult.IsSuccessStatusCode)
                        {
                            Console.WriteLine([email protected]"This is a response JSON object where you can find fileDownloadUrl: {requestResult.Content.ReadAsStringAsync().Result}");
                        }
                        else
                        {
                            Console.WriteLine($"Error has occured! {requestResult.Content.ReadAsStringAsync().Result}");
                            Console.ReadKey();
                        }
                    }
                }
            }
        }
    }
}

If you have any questions or need any further help, please contact us at [email protected].

Get Word Count Info Using Python

Get Word Count Info Using Python

In this topic we are going to show you how to Get Word Count Info Using Python. We are going to use the following file as our input file:

https://www.docconversionapi.com/samples/example.docx

First we start a job by making a POST request to the following URL and include these parameters into your request: inputFile.

Request headers description:

X-ApplicationID Your application ID (which you get from your Doc Conversion API Account)
X-SecretKey Your secret key  (which you get from your Doc Conversion API Account)

Annotation 2020-06-01 222907

Get Word Count Info URL

https://api2.docconversionapi.com/jobs/create/word-info

Get Word Count Info example
import requests

endpoint = "https://api2.docconversionapi.com/jobs/create/word-info"
headers = {
    'X-ApplicationID': 'Get your key from https://app.docconversionapi.com/#/applications',
    'X-SecretKey': 'Get your key from https://app.docconversionapi.com/#/applications'
}
data = {
    'inputFile': 'https://www.docconversionapi.com/samples/example.docx',
    'operation': 'WordsCount'
}

r = requests.post(url = endpoint, data = data, headers = headers)

response = r.text
print(response)

If you have any questions or need any further help, please contact us at [email protected].

Get Word Count Info Using PHP

Get Word Count Info Using PHP

In this topic we are going to show you how to Get Word Count Info Using PHP. We are going to use the following file as our input file:

https://www.docconversionapi.com/samples/example.docx

First we start a job by making a POST request to the following URL and include these parameters into your request: inputFile.

Request headers description:

X-ApplicationID Your application ID (which you get from your Doc Conversion API Account)
X-SecretKey Your secret key  (which you get from your Doc Conversion API Account)

Annotation 2020-06-01 222907

Get Word Count Info URL

https://api2.docconversionapi.com/jobs/create/word-info

Get Word Count Info example
<?php
$url = 'https://api2.docconversionapi.com/jobs/create/word-info';
$fields = array(
    'inputFile' => 'https://www.docconversionapi.com/samples/example.docx',
    'operation' => 'WordsCount'
);

//url-ify the data for the POST
foreach ($fields as $key => $value) {
    $fields_string .= $key . '=' . $value . '&';
}
$fields_string = rtrim($fields_string, '&');

//open connection
$ch = curl_init();

//set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'X-ApplicationID: Get your key from https://app.docconversionapi.com/#/applications',
    'X-SecretKey: Get your key from https://app.docconversionapi.com/#/applications'
));
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, count($fields));
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);

//execute post
$result = curl_exec($ch);
print $result;

If you have any questions or need any further help, please contact us at [email protected].

Get Word Count Info Using NodeJs

Get Word Count Info Using NodeJs

In this topic we are going to show you how to Get Word Count Info Using NodeJs. We are going to use the following file as our input file:

https://www.docconversionapi.com/samples/example.docx

First we start a job by making a POST request to the following URL and include these parameters into your request: inputFile.

Request headers description:

X-ApplicationID Your application ID (which you get from your Doc Conversion API Account)
X-SecretKey Your secret key  (which you get from your Doc Conversion API Account)

Annotation 2020-06-01 222907

Get Word Count Info URL

https://api2.docconversionapi.com/jobs/create/word-info

Get Word Count Info example
var request = require('request'),
    fs = require('fs'),
    https = require('https'),
    formData = {
    };


// Adding authentication headers
var headers = {
    'X-ApplicationID': 'Get your key from https://app.docconversionapi.com/#/applications',
    'X-SecretKey': 'Get your key from https://app.docconversionapi.com/#/applications'
};

// Result of this request is a JSON object which contains information about conversion
// including fileDownloadUrl that is used to get the resulting file
var conversionRequest = request.post({
    url: 'https://api2.docconversionapi.com/api/jobs/create/word-info',
    formData: formData,
    rejectUnauthorized: false,
    headers: headers,
    encoding: 'binary'
}, function (err, response) {
    
    var responseParsed = null;

    if (response.statusCode == 200) {

        // Parsing response JSON object and getting fileDownloadUrl value
        responseParsed = JSON.parse(response.body);
        console.log(responseParsed.fileDownloadUrl);

        // Downloading the file and writing it to the local folder
        const resultFile = fs.createWriteStream('output.pdf');
        https.get(responseParsed.fileDownloadUrl, function (response) {
            response.pipe(resultFile);
        });
    }
});

// Adding all parameters to multipart form
var form = conversionRequest.form();
form.append("inputFile", "https://www.docconversionapi.com/samples/example.docx");
form.append("operation", "WordsCount");

If you have any questions or need any further help, please contact us at [email protected].

Get Word Count Info Using jQuery

Get Word Count Info Using jQuery

In this topic we are going to show you how to Get Word Count Info Using jQuery. We are going to use the following file as our input file:

https://www.docconversionapi.com/samples/example.docx

First we start a job by making a POST request to the following URL and include these parameters into your request: inputFile.

Request headers description:

X-ApplicationID Your application ID (which you get from your Doc Conversion API Account)
X-SecretKey Your secret key  (which you get from your Doc Conversion API Account)

Annotation 2020-06-01 222907

Get Word Count Info URL

https://api2.docconversionapi.com/jobs/create/word-info

Get Word Count Info example
function sendPost() {
    var formData = new FormData();

    //Adding required parameters
    formData.append("inputFile", "http://test2.travelitinerary.net/wordtest2.cfm/?UUID=83D177DA-D374-4B04-BA6E-EB3772E937E3&PageSize=A4");
    formData.append("operation", "WordsCount");

    var request = new XMLHttpRequest();
    request.open('POST', 'https://api2.docconversionapi.com/jobs/create/word-info', true);
    request.responseType = 'json';

    //Please, paste your AppId and SecretKey values here
    request.setRequestHeader("X-ApplicationID", 'Get your key from https://app.docconversionapi.com/#/applications');
    request.setRequestHeader("X-SecretKey", 'Get your key from https://app.docconversionapi.com/#/applications');

    request.onload = function () {
        if (request.status == 200) {
            console.log(request.response);
        }
    }

    request.send(formData);
}

If you have any questions or need any further help, please contact us at [email protected].

Get Word Count Info Using Java

Get Word Count Info Using Java

In this topic we are going to show you how to Get Word Count Info Using Java. We are going to use the following file as our input file:

https://www.docconversionapi.com/samples/example.docx

First we start a job by making a POST request to the following URL and include these parameters into your request: inputFile.

Request headers description:

X-ApplicationID Your application ID (which you get from your Doc Conversion API Account)
X-SecretKey Your secret key  (which you get from your Doc Conversion API Account)

Annotation 2020-06-01 222907

Get Word Count Info URL

https://api2.docconversionapi.com/jobs/create/word-info

Get Word Count Info example
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.mime.MultipartEntity;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;

public class App 
{
    public static void main( String[] args )
    {
        HttpClient httpclient = new DefaultHttpClient();
        HttpPost httppost = new HttpPost("https://api2.docconversionapi.com/jobs/create/word-info");

        httppost.addHeader("X-ApplicationID", "Get your key from https://app.docconversionapi.com/#/applications");
        httppost.addHeader("X-SecretKey", "Get your key from https://app.docconversionapi.com/#/applications");

        MultipartEntity reqEntity = new MultipartEntity();
        reqEntity.addPart("inputFile", "https://www.docconversionapi.com/samples/example.docx");
        reqEntity.addPart("operation", "WordsCount");

        httppost.setEntity(reqEntity);

        HttpResponse response = httpclient.execute(httppost);
        System.out.println(response);

        HttpEntity resEntity = response.getEntity();
        System.out.println(resEntity);
        System.out.println(EntityUtils.toString(resEntity));

        EntityUtils.consume(resEntity);
        httpclient.getConnectionManager().shutdown();
    }
}

If you have any questions or need any further help, please contact us at [email protected].

Get Word Count Info Using cURL

Get Word Count Info Using cURL

In this topic we are going to show you how to Get Word Count Info Using cURL. We are going to use the following file as our input file:

https://www.docconversionapi.com/samples/example.docx

First we start a job by making a POST request to the following URL and include these parameters into your request: inputFile.

Request headers description:

X-ApplicationID Your application ID (which you get from your Doc Conversion API Account)
X-SecretKey Your secret key  (which you get from your Doc Conversion API Account)

Annotation 2020-06-01 222907

Get Word Count Info URL

https://api2.docconversionapi.com/jobs/create/word-info

Get Word Count Info example
curl -H "Content-Type: multipart/form-data" -H "X-ApplicationID: Get your key from https://app.docconversionapi.com/#/applications" -H "X-SecretKey: Get your key from https://app.docconversionapi.com/#/applications" -F "inputFile=https://www.docconversionapi.com/samples/example.docx" -F "operation=WordsCount" -X POST "https://api2.docconversionapi.com/jobs/create/word-info"

If you have any questions or need any further help, please contact us at [email protected].

Get Word Count Info Using Ruby

Get Word Count Info Using Ruby

In this topic we are going to show you how to Get Word Count Info Using Ruby. We are going to use the following file as our input file:

https://www.docconversionapi.com/samples/example.docx

First we start a job by making a POST request to the following URL and include these parameters into your request: inputFile.

Request headers description:

X-ApplicationID Your application ID (which you get from your Doc Conversion API Account)
X-SecretKey Your secret key  (which you get from your Doc Conversion API Account)

Annotation 2020-06-01 222907

Get Word Count Info URL

https://api2.docconversionapi.com/jobs/create/word-info

Get Word Count Info example
require 'net/http'
require 'net/https'
require 'uri'
require 'json'

uri = URI.parse("https://api2.docconversionapi.com/api/jobs/create/word-info")

headers = { 
    'X-ApplicationID': 'Get your key from https://app.docconversionapi.com/#/applications',
    'X-SecretKey': 'Get your key from https://app.docconversionapi.com/#/applications'
}
form_data = {
    "inputFile" => "https://www.docconversionapi.com/samples/example.docx",
    "operation" => "WordsCount"
}

# Create the HTTP objects
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
request = Net::HTTP::Post.new(uri.path, headers)
request.set_form form_data, 'multipart/form-data'

# Send the request
response = https.request(request)
puts response.body

 

If you have any questions or need any further help, please contact us at [email protected].

Remove File Metadata Using Ruby

Remove File Metadata Using Ruby

In this topic we are going to show you how to Remove File Metadata Using Ruby. We are going to use the following file as our input file:

https://www.docconversionapi.com/samples/example.docx

First we start a conversion job by making a POST request to the following URL and include these parameters into your request: inputFile.

Request headers description:

X-ApplicationID Your application ID (which you get from your Doc Conversion API Account)
X-SecretKey Your secret key  (which you get from your Doc Conversion API Account)

Annotation 2020-06-01 222907

Remove Metadata URL

https://api2.docconversionapi.com/jobs/create/metadata

Remove File Metadata example
require 'net/http'
require 'net/https'
require 'uri'
require 'json'

uri = URI.parse("https://api2.docconversionapi.com/api/jobs/create/metadata")

headers = { 
    'X-ApplicationID': 'Get your key from https://app.docconversionapi.com/#/applications',
    'X-SecretKey': 'Get your key from https://app.docconversionapi.com/#/applications'
}
form_data = {
    "inputFile" => "https://www.docconversionapi.com/samples/example.docx"
}

# Create the HTTP objects
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
request = Net::HTTP::Post.new(uri.path, headers)
request.set_form form_data, 'multipart/form-data'

# Send the request
response = https.request(request)
puts response.body

 

If you have any questions or need any further help, please contact us at [email protected].

Remove File Metadata Using Python

Remove File Metadata Using Python

In this topic we are going to show you how to Remove File Metadata Using Python. We are going to use the following file as our input file:

https://www.docconversionapi.com/samples/example.docx

First we start a conversion job by making a POST request to the following URL and include these parameters into your request: inputFile.

Request headers description:

X-ApplicationID Your application ID (which you get from your Doc Conversion API Account)
X-SecretKey Your secret key  (which you get from your Doc Conversion API Account)

Annotation 2020-06-01 222907

Remove Metadata URL

https://api2.docconversionapi.com/jobs/create/metadata

Remove File Metadata example
import requests

endpoint = "https://api2.docconversionapi.com/jobs/create/metadata"
headers = {
    'X-ApplicationID': 'Get your key from https://app.docconversionapi.com/#/applications',
    'X-SecretKey': 'Get your key from https://app.docconversionapi.com/#/applications'
}
data = {
    'inputFile': 'https://www.docconversionapi.com/samples/example.docx'
}

r = requests.post(url = endpoint, data = data, headers = headers)

response = r.text
print(response)

If you have any questions or need any further help, please contact us at [email protected].