DWS Processor API with other languages

Nutrient DWS Processor API is offered as a simple HTTP-based API. That means it can be used from any programming language capable of POSTing multipart/form-data(opens in a new tab) payloads.

This guide outlines the general steps that apply, regardless of the language you choose.

To make use of Nutrient DWS Processor API, you essentially have to perform the following steps:

  1. Create your instructions object. Refer to the API reference for more information on how instructions needs to look. You can also look at any of our tools pages(opens in a new tab) to see how to use a specific function.
  2. Encode the instructions object as a JSON object, if you didn’t already.
  3. Next, assemble your multipart/form-data payload. Here, you need to include the instructions object with the name instructions, along with any assets with the name you use to refer to them, in the instructions object.
  4. Finally, POST your multipart payload to https://api.nutrient.io/build, making sure to include your API key in the authorization header.

To help you picture this more clearly, below are code samples for flattening a PDF in multiple languages. They all follow the general approach for using Nutrient DWS Processor API:

Terminal window
curl -X POST https://api.nutrient.io/build \
-H "Authorization: Bearer your_api_key_here" \
-o result.pdf \
--fail \
-F document.pdf=@document.pdf \
-F instructions='{
"parts": [
{
"file": "document.pdf"
}
],
"actions": [
{
"type": "flatten"
}
]
}'