API Start
Automated system for converting a design into a print-ready layout.
Includes:
- input WF - convert various file formats to PDF.
- pre-production WF - convert any design into a print-ready layout.
- production WF - impose layout(s) on a sheet/printing table.
Welcome to the b2b.2pdfx API
b2b.2pdfx API
File processing
General flow when working with the b2b.2pdfx API
You receive an upload on your side and save the file on your server.
Via the API, you send us the file URL and the product dimensions; we perform the processing.
After processing, we return a Job object containing links to: the final processed PDF file, a detailed report on the processing results with markers Success, Warning, Error, None, and also final JPEG previews (one per page).
Server base URL for requests: https://b2b.2pdfx.com/api-v1
Architecture - server -> server
API test page RESTful Test
1. Authentication and getting a token
2. Create a Job to process a file
3. Get information about file processing
4. On successful processing: get links to the file, previews, and report. On failure: get the Job status
1. Authentication
Action | HTTP Verb | URL |
---|---|---|
Login & get token |
n/a |
api/login?email=***&pwd=*** |
Request example:
https://b2b.2pdfx.com/api-v1/login?email=test@b2b.2pdfx.printonline.com.ua&pwd=test
Request parameters:
Param |
Type |
Description |
---|---|---|
|
String(254) |
Email used as login. Use the email authorized on https://b2b.2pdfx.com |
pwd |
String(160) |
Password |
JSON response example:
{
"result":true,
"token":"nQvd1cNgIiEiwxh6744Mg6XVCSkGkAhvkvtMdAqcEjRiHmxXs7eP9n4IveP043H4",
"expire":1454961100,
"message":"Logged in",
"code":0
}
Response parameters:
Param |
Type |
Description |
result |
Boolean |
true - authentication successful false - authentication failed |
token |
String(64) |
Temporary token |
expire |
Int |
Unix timestamp when the token expires |
message |
String |
Logged in. Authentication fail. Token invalid. Token expired. |
code |
Int |
AUTH_CODE_LOGGED_IN = 0; AUTH_CODE_LOGIN_FAIL = 1; AUTH_CODE_TOKEN_INVALID = 2; AUTH_CODE_TOKEN_EXPIRED = 3; |
2. Create a Job to process a file
Action |
HTTP Verb |
URL |
Create a record |
POST |
api/Job |
Request example:
https://b2b.2pdfx.com/api-v1/Job?token=ad46e0a479366a643578fumXWU.DauK.MSQHMMg8CUduLYGnaSwMK
Post:
Headers:
Content-Type: application/json; charset=utf-8
Body:
{
"SourceURL" : "https://b2b.2pdfx.com/assets/shoes.jpg",
"Width" : 90,
"Height" : 50
}
Request parameters:
Param |
Type |
Description |
SourceURL |
String(512) |
URL of the file that must be processed by b2b.2pdfx |
Width |
Float |
Product width in millimeters |
Height |
Float |
Product height in millimeters |
Successful JSON response example:
{
"SourceURL" : "https://b2b.2pdfx.com/test.tiff",
"Width" : 90,
"Height" : 50,
"Progress" : 0,
"Message" : "WAITING",
"MessageType" : "None",
"ID" : 130
}
Failed JSON response example:
{
"SourceURL" : "https://b2b.2pdfx.com/error.tiff",
"Width" : 90,
"Height" : 50,
"Progress" : 0,
"Message" : "403",
"MessageType" : "Error",
"Details" : "SourceURL is empty file",
"ID" : 133
}
Job parameters:
Param |
Type |
Description |
ID |
Int |
Unique identifier |
SourceURL |
String(512) |
URL from which the b2b.2pdfx service downloads the file for processing |
DestURL |
String(512) |
URL where the b2b.2pdfx service publishes the processed file |
Width |
Float |
Width used to fit the design to the product format in millimeters |
Height |
Float |
Height used to fit the design to the product format in millimeters |
Progress |
Float |
Processing progress in percent, 0 to 100 |
Message |
String(512) |
Status and result messages Possible values: IDLE (None) – idle, waiting in queue WAITING (None) – job is queued, waiting for processing start PROCESSING (None) – file is being processed COMPLETED_SUCCESSFULLY (Success, Warning) – file processed successfully CANCELED (None) – file processing was canceled COMPLETED_WITH_ERROR (Error) – file not processed, b2b.2pdfx processor error Empty SourceURL (Error) – empty URL, the file cannot be downloaded
|
MessageType |
String(40) |
Message type Possible values: None – Unclassified message, informational Success – File processed successfully Notice Warning – File processed successfully, but there are warnings. See details in report.xml Warning. Handling of Warning statuses is up to your server logic. We recommend showing a message like: “Your file contains the following issues (list of warnings). I agree to manual processing.”
Error – File processing error Error. Based on our stats, Error (unable to process a file) is less than 1% and is usually caused by corrupted or incomplete uploads.
|
Details |
Text |
Text message |
Reports |
Array |
List of reports (PublicFile) |
Previews |
Array |
List of previews (PublicFile) |
PublicFile parameters
Param |
Type |
Description |
ID |
Int |
Unique identifier |
URL |
String(512) |
Public URL to download the file |
3. Get Job processing status by ID
Action |
HTTP Verb |
URL |
Find 1 record |
GET |
api/Job/ID |
Request example:
https://b2b.2pdfx.com/api-v1/Job/134?token=79793f7fb465ef5649cfeehHp4L30g2cghsgPpt3paK.UL9HnEL52
{
"SourceURL":"https://b2b.2pdfx.com/test.tiff",
"DestURL":"https://b2b.2pdfx.com/public-url/download/tN8NkYElljrt7BlWtb4vqgNB/test[2].tiff",
"Width":90,
"Height":50,
"Progress":100,
"Message":"COMPLETED_SUCCESSFULLY",
"MessageType":"Success",
"ID":133,
"Reports":[
{
"URL":"https://b2b.2pdfx.com/public-url/download/r9aMKbk83aOxtA0b4LFCgpk8K9O/report.xml"
}
],
"Previews":[
{
"URL":"https://b2b.2pdfx.com/public-url/download/rdcNPihDr4XpJjL2KfalB6PMbkdr8OlA/test[2]_1.jpg"
},
{
"URL":"https://b2b.2pdfx.com/public-url/download/xoRQGuiLsIuLtxvJIRlOG801/test[2]_2.jpg"
}
]
}
Response parameters: