Documentation
Start New Conversion
In order to start a new conversion you need to do a following POST request:
POST https://api.xyzpdf.com/v1/convert
Usage example:
curl -i -X POST -d '{"apikey": "_YOUR_API_KEY_", "file":"http://google.com/", "outputformat":"png"}' http://api.xyzpdf.com/v1/convert
Success Response (example):
HTTP/1.1 200 OK
{
"code": 200,
"status": "ok",
"data": {
"id": "9712d01edc82e49c68d58ae6346d2013",
"minutes": 107
}
}
Error Response (example):
HTTP/1.1 401 Unauthorized
{
"code": 401,
"status": "error",
"error": "This API Key is invalid"
}
Direct File Upload For Conversion
This step required only if chooses input = 'upload' on previous step. In order to upload file for conversion, you need to do a following PUT request
PUT https://api.xyzpdf.com/v1/convert/:id/:filename
Usage example:
curl -i -X PUT --upload-file 'test.bmp' http://api.xyzpdf.com/v1/convert/_ID_/test.bmp
Success Response (example):
HTTP/1.1 200 OK
{
"code": 200,
"status": "ok",
"data": {
"id": "9712d01edc82e49c68d58ae6346d2013",
"file": "test.bmp",
"size": "1025470"
}
}
Error Response (example):
HTTP/1.1 401 Unauthorized
{
"code": 401,
"status": "error",
"error": "This API Key is invalid"
}
Get Status Of Conversion
In order to get status of a conversion you need to do a following GET request with :id, obtained on previous step
GET https://api.xyzpdf.com/v1/convert/:id/status
Usage example:
curl -i -X GET http://api.xyzpdf.com/v1/convert/_ID_/status
Success Response (example):
HTTP/1.1 200 OK
{
"code": 200,
"status": "ok",
"data": {
"id": "9712d01edc82e49c68d58ae6346d2013",
"step": "finish",
"step_percent": 100,
"minutes": 1,
"output": {
"url": "https://dl.xyzpdf.com/d31c0ed50efd097e34c6b23fa555445d/http-google-com_4.png",
"size": "36102"
}
}
}
Error Response (example):
HTTP/1.1 422 Unprocessable Entity
{
"code": 422,
"status": "error",
"error": "Input file appears to be corrupted"
}
Get Result File Content
In order to get result file of a conversion you need to do a following GET request (As an alternative to this step you may use output URL from previous step, but be advised, that this URL is bounded to the host IP address and can't be hotlinked or shared with third parties)
GET https://api.xyzpdf.com/v1/convert/:id/dl/:type
Usage example:
curl -i -X GET http://api.xyzpdf.com/v1/convert/_ID_/dl
Success Response (example):
HTTP/1.1 200 OK
{
"code": 200,
"status": "ok",
"data": {
"id": "9712d01edc82e49c68d58ae6346d2013",
"encode": "base64",
"content": "_FILE_CONTENT_"
}
}
Error Response (example):
HTTP/1.1 422 Unprocessable Entity
{
"code": 422,
"status": "error",
"error": "File is not ready yet, finished with errors or had been deleted (check file status)"
}
Delete File/Cancel Conversion
In order to stop a conversion or to delete a file you need to do a following GET request
DELETE https://api.xyzpdf.com/v1/convert/:id
Usage example:
curl -i -X DELETE http://api.xyzpdf.com/v1/convert/_ID_
Success Response (example):
HTTP/1.1 200 OK
{
"code": 200,
"status": "ok",
"message": "File deleted"
}
Error Response (example):
HTTP/1.1 404 Not Found
{
"code": 404,
"status": "error",
"error": "File not found"
}
List Of Conversions
In order to get a list of your conversions and their statuses do following POST request:
POST https://api.xyzpdf.com/v1/convert/list
Usage example:
curl -i -X POST -d '{"apikey": "_YOUR_API_KEY_", "status": "all", "count": 3}' http://api.xyzpdf.com/v1/convert/list
Success Response (example):
HTTP/1.1 200 OK
{
"code": 200,
"status": "ok",
"data": [
{
"id": "7d5c9dba440e618ed6eb1adae69c10d6",
"status": "finished",
"minutes": "1",
"inputformat": "DOC",
"outputformat": "PDF",
"filename": "report-94b97c5b.doc"
},
{
"id": "712f2e88a46d3a0444e52cc7d7f602a6",
"status": "converting",
"minutes": "0",
"inputformat": "PDF",
"outputformat": "HTML",
"filename": "printable.pdf"
}
]
}
Error Response (example):
HTTP/1.1 401 Unauthorized
{
"code": 401,
"status": "error",
"error": "This API Key is invalid"
}
© Copyright 2024 XYZPDF.com | All Rights Reserved