This page documents version 4 of the API.
The API is a RESTful interface for submitting paper data and retrieving calculated results.
The Version 4 API accepts (and correspondingly returns) JSON or XML input. JSON is the preferred format; XML is supported to ease the upgrade path for long-time API users. All API users are encouraged to use JSON as soon as they are able. XML support is deprecated and will likely go away in a future version.
Submitted data should be accompanied by an appropriate "Content-Type" header, "text/xml" or "application/json".
Data should be submitted using the "POST" HTTP method. OPTIONS requests are also supported.
The URL endpoint for the API is https://api.papercalculator.org/v4/pc
Throughout the sample code and examples, you will need to replace "YOUR_ID_HERE" with the id you obtain from the Environmental Paper Network.
Sample request documents can be found here:
JSON Request document
XML Request document
"grade" holds an integer value corresponding to the type of paper. "name" will be used in the result to identify the output values. The following lists the available "grade" values. The numbering has changed since the previous API. "grade" determines what calculations will be performed; the value contained in "name" comes along for the ride as a human-readable identifier.
1 | Coated Freesheet |
2 | Uncoated Freesheet |
3 | Coated Groundwood |
4 | Uncoated Groundwood |
5 | Supercalendered |
6 | Paperboard: Solid Bleached Sulfate (SBS) |
7 | Paperboard: Coated Unbleached Kraft |
8 | Paperboard: Coated Recycled Board |
9 | Paperboard: Uncoated Bleached Kraft |
10 | Paperboard: Uncoated Unbleached Kraft |
11 | Paperboard: Uncoated Recycled Board |
12 | Linerboard |
13 | Corrugating Container |
14 | Tissue |
<qpunits> (xml) or "unit" (json) should indicate the units used to measure the weight of paper used. "tons" is the default; "pounds" and "metric-tons" are also allowed values. The weight itself is given in <annualqp> (xml) or "amount" (json).
"recycledcontent" should hold the percent of recycled content in the paper (without the % symbol).
The following unix command-line can be used to submit the sample JSON document contained in the same directory and display the result using the
cURL utility
:
#!/bin/bash
curl -H 'Content-Type: application/json' --data-urlencode @sample-4.json https://api.papercalculator.org/v4/pc
The corresponding command to submit the sample XML document is:
#!/bin/bash
curl -H 'Content-Type: text/xml' --data-urlencode @sample.xml curl -H 'Content-Type: application/json' --data-urlencode @sample-4.json https://api.papercalculator.org/v4/pc
Sample result documents:
json
xml
Those of you migrating from the previous API version will notice the following changes: