GetToken
Api method get Token
https://squeezeimg.com/api/getToken
Params
Name |
Type |
Description |
login |
String |
email for account squeezeimg.com |
password |
String |
password for account squeezeimg.com |
Success 200
Name |
Type |
Description |
status |
Bollean |
Status response |
token |
String |
Api token |
HTTP/1.1 200 OK
{
"status":true,
"token":"jhgfdtfyguhijkohg",
}
Error 4xx
Name |
Type |
Description |
status |
Bollean |
Status response |
error |
String |
Error message |
HTTP/1.1 422
{
"status":false,
"error":"message error",
}
PageCompress
PageCompress
https://api.squeezeimg.com/pageCompress
Params
Name |
Type |
Description |
url |
String |
The target page url |
qlt |
Number |
The quality precentage (max 80) |
token |
String |
Your Api token |
method |
String |
Method processing image (convert or compress) |
to |
String |
Target format for method convert (jp2 or webp) |
Success 200
Name |
Type |
Description |
path |
String |
Url get result processing pageCompress |
HTTP/1.1 200 OK
{
"path":'some_path',
}
Error 4xx
Name |
Type |
Description |
status |
Bollean |
Status response |
error |
String |
Error message |
HTTP/1.1 422
{
"status":false,
"error":"message error",
}
Plugin
Api method processing binary file image.
https://api.squeezeimg.com/plugin
Params
Name |
Type |
Description |
file_name |
String |
The name target processing file. |
qlt |
Number |
The quality precentage (max 80) |
token |
String |
Your Api token |
method |
String |
Method processing image (convert or compress) |
to |
String |
Target format for method convert (jp2 or webp) |
file |
Binary |
The form-data object including image file " binary " and file name. |
Request example
let req = request.post({ url:URL,encoding:'binary'}, (err, resp, body) => {
});
let formData = req.form();
formData.append('file_name',file.relative);
formData.append('qlt',options.qlt|| 60);
formData.append('token',options.token);
formData.append('method',options.method || 'compress');
formData.append('to', options.to || 'webp');
formData.append('file',file.contents,{ filename:file.relative});
Success 200
Name |
Type |
Description |
file |
Binary |
Binary buffer compressed image file. |
Error 4xx
Name |
Type |
Description |
status |
Bollean |
Status response |
error |
String |
Error message |
HTTP/1.1 422
{
"status":false,
"error":"message error",
}
Process
Api method processing by url image
https://api.squeezeimg.com/
Params
Name |
Type |
Description |
img |
String |
The url target image. |
qlt |
Number |
The quality precentage (max 80) |
token |
String |
Your Api token |
method |
String |
Method processing image (convert or compress) |
to |
String |
Target format for method convert (jp2 or webp) |
Success 200
Name |
Type |
Description |
src |
String |
The src image url. |
format |
String |
Method processing image. |
src_size |
Numder |
Size src image. |
dest |
String |
The processed image url. |
dest_size |
Numder |
Size rocessed image. |
percent |
Numder |
The percentage of the processed image. |
expires |
Date |
Date expires processed image. |
generator |
String |
Name and version generator. |
HTTP/1.1 200 OK
{
"src":"https://upload.wikimedia.org/wikipedia/commons/b/b6/Image_created_with_a_mobile_phone.png",
"format":"compress",
"src_size":20576088,
"dest":"https://s1.squeezeimg.com/compressed-images/4754f71fb867ce2ce1ab41983b1857a1/Image_created_with_a_mobile_phone.png",
"dest_size":5398881,
"percent":74,
"expires":Tuesday, December 22nd, 2020, 4:15:37 PM,
"generator":squeezeImg.com version: 1.0.0,
}
Error 4xx
Name |
Type |
Description |
status |
Bollean |
Status response |
error |
String |
Error message |
HTTP/1.1 422
{
"status":false,
"error":"message error",
}
GetInfo
Getting information about the tariff plan of the account
https://squeezeimg.com/api/getinfo
Params
Name |
Type |
Description |
token |
String |
Api token |
Success 200
Name |
Type |
Description |
status |
String |
Status response |
email |
String |
email account |
token |
String |
Api token |
plan |
String |
Tariff plan name |
limit |
Numder |
Limit of images in the tariff plan |
used |
Numder |
Number of images used |
reset_day |
Date |
Date of renewal of the tariff plan |
HTTP/1.1 200 OK
{
"status":true,
"email":"test@test.com",
"token":"sdfghjklsdfghjkljhgfds",
"plan":"MEGA PLUS",
"limit":600000,
"used":555432,
"reset_day":"date",
}
Error 4xx
Name |
Type |
Description |
status |
Bollean |
Status response |
error |
String |
Error message |
HTTP/1.1 422
{
"status":false,
"error":"message error",
}