תיעוד API

ה-API של PrintCloud מאפשר לך לנהל מדפסות, לשלוח עבודות הדפסה ולעקוב אחר סטטוס באופן תכנותי.

כתובת בסיס: https://printcloud.abst.co.il/api

סקירה

ה-API מקבל גוף בקשה בפורמט JSON ומחזיר תגובות JSON. כל נקודות הקצה דורשות אימות אלא אם צוין אחרת.

אימות

השתמש באימות HTTP Basic עם מפתח ה-API שלך כשם המשתמש וסיסמה ריקה:

REQUEST
curl -u "pk_live_your_api_key:" \ https://printcloud.abst.co.il/api/printers
const response = await fetch('https://printcloud.abst.co.il/api/printers', { headers: { 'Authorization': 'Basic ' + btoa('pk_live_your_api_key:') } }); const data = await response.json();
import requests response = requests.get( 'https://printcloud.abst.co.il/api/printers', auth=('pk_live_your_api_key', '') ) data = response.json()
$ch = curl_init('https://printcloud.abst.co.il/api/printers'); curl_setopt($ch, CURLOPT_USERPWD, 'pk_live_your_api_key:'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); $data = json_decode($response, true);
using var client = new HttpClient(); var auth = Convert.ToBase64String( Encoding.UTF8.GetBytes("pk_live_your_api_key:")); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", auth); var response = await client.GetAsync( "https://printcloud.abst.co.il/api/printers"); var data = await response.Content.ReadAsStringAsync();
HEADER
Authorization: Basic cGtfbGl2ZV94eHg6 # base64("pk_live_your_api_key:")

הגבלת קצב

ה-API מוגבל ל- 10 בקשות בשנייה לכל חשבון. בחריגה תקבל תגובת 429 Too Many Requests.

שגיאות

תגובות שגיאה מגיעות בפורמט הבא:

{ "code": "Unauthorized", "message": "Authentication required" }
קודמשמעות
400בקשה שגויה — פרמטרים לא תקינים
401לא מורשה — מפתח API חסר או לא תקין
403אסור — הרשאות לא מספיקות
404לא נמצא
429חריגה ממגבלת הקצב
500שגיאת שרת

מדפסות

GET/api/printers

רשימת כל המדפסות בכל המחשבים שלך.

REQUEST
curl -u "pk_live_your_api_key:" \ https://printcloud.abst.co.il/api/printers
const response = await fetch('https://printcloud.abst.co.il/api/printers', { headers: { 'Authorization': 'Basic ' + btoa('pk_live_your_api_key:') } }); const data = await response.json();
import requests response = requests.get( 'https://printcloud.abst.co.il/api/printers', auth=('pk_live_your_api_key', '') ) data = response.json()
$ch = curl_init('https://printcloud.abst.co.il/api/printers'); curl_setopt($ch, CURLOPT_USERPWD, 'pk_live_your_api_key:'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); $data = json_decode($response, true);
using var client = new HttpClient(); var auth = Convert.ToBase64String( Encoding.UTF8.GetBytes("pk_live_your_api_key:")); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", auth); var response = await client.GetAsync( "https://printcloud.abst.co.il/api/printers"); var data = await response.Content.ReadAsStringAsync();
RESPONSE 200
[ { "id": "clx8f3b2c1...", "name": "HP LaserJet Pro", "computerId": "clx456...", "state": "online", "isDefault": true, "capabilities": { "color": true, "duplex": true, "media": ["A4","Letter"], "bins": ["Tray 1","Manual"] } } ]
GET/api/computers/:id/printers

רשימת מדפסות של מחשב ספציפי.

עבודות הדפסה

POST/api/printjobs

צור עבודת הדפסה חדשה. זוהי נקודת הקצה העיקרית לשליחת מסמכים למדפסות.

פרמטרסוגתיאור
printerIdstring requiredמזהה מדפסת יעד
contentTypestring requiredpdf_uri | pdf_base64 | raw_uri | raw_base64
contentstring requiredכתובת URI של מסמך או נתונים מקודדים ב-base64
titlestringכותרת עבודה (ברירת מחדל: "Untitled")
qtyintegerמספר פעמים להדפסה (ברירת מחדל: 1)
optionsobjectאפשרויות הדפסה (ראה למטה)

אפשרויות הדפסה

אפשרותסוגתיאור
copiesintegerמספר עותקים (1-999)
colorbooleanהדפסה בצבע (true/false)
duplexstringone-sided | long-edge | short-edge
paperstringשם גודל נייר (לדוגמה "A4", "Letter")
mediastringשם מגש/תא נייר
pagesstringטווח עמודים (לדוגמה "1-5", "1,3,5")
fit_to_pagebooleanהתאם לגודל העמוד

דוגמה: הדפסת PDF מכתובת URL

REQUEST
curl -u "pk_live_your_api_key:" \ -X POST https://printcloud.abst.co.il/api/printjobs \ -H "Content-Type: application/json" \ -d '{ "printerId": "clx8f3b2c1", "contentType": "pdf_uri", "content": "https://example.com/invoice.pdf", "title": "Invoice #456", "options": { "copies": 2, "duplex": "long-edge", "color": false } }'
const response = await fetch('https://printcloud.abst.co.il/api/printjobs', { method: 'POST', headers: { 'Authorization': 'Basic ' + btoa('pk_live_your_api_key:'), 'Content-Type': 'application/json' }, body: JSON.stringify({ printerId: 'clx8f3b2c1', contentType: 'pdf_uri', content: 'https://example.com/invoice.pdf', title: 'Invoice #456', options: { copies: 2, duplex: 'long-edge', color: false } }) }); const data = await response.json();
import requests response = requests.post( 'https://printcloud.abst.co.il/api/printjobs', auth=('pk_live_your_api_key', ''), json={ 'printerId': 'clx8f3b2c1', 'contentType': 'pdf_uri', 'content': 'https://example.com/invoice.pdf', 'title': 'Invoice #456', 'options': { 'copies': 2, 'duplex': 'long-edge', 'color': False } } ) data = response.json()
$ch = curl_init('https://printcloud.abst.co.il/api/printjobs'); curl_setopt($ch, CURLOPT_USERPWD, 'pk_live_your_api_key:'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json' ]); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([ 'printerId' => 'clx8f3b2c1', 'contentType' => 'pdf_uri', 'content' => 'https://example.com/invoice.pdf', 'title' => 'Invoice #456', 'options' => [ 'copies' => 2, 'duplex' => 'long-edge', 'color' => false ] ])); $response = curl_exec($ch); $data = json_decode($response, true);
using var client = new HttpClient(); var auth = Convert.ToBase64String( Encoding.UTF8.GetBytes("pk_live_your_api_key:")); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", auth); var body = new StringContent( JsonSerializer.Serialize(new { printerId = "clx8f3b2c1", contentType = "pdf_uri", content = "https://example.com/invoice.pdf", title = "Invoice #456", options = new { copies = 2, duplex = "long-edge", color = false } }), Encoding.UTF8, "application/json"); var response = await client.PostAsync( "https://printcloud.abst.co.il/api/printjobs", body); var data = await response.Content.ReadAsStringAsync();
RESPONSE 201
// Returns the print job ID "pj_a8f3b2c1d4e5f6g7" // The job goes through states: // pending → sent → printing → completed // // If the client is online, the job // is dispatched immediately. // If offline, it waits until // the client reconnects.

דוגמה: הדפסת RAW (מדבקת ZPL)

REQUEST
curl -u "pk_live_your_api_key:" \ -X POST https://printcloud.abst.co.il/api/printjobs \ -H "Content-Type: application/json" \ -d '{ "printerId": "clx_zebra_01", "contentType": "raw_base64", "content": "XlhBXkZPNTAs...", "title": "Shipping Label" }'
const response = await fetch('https://printcloud.abst.co.il/api/printjobs', { method: 'POST', headers: { 'Authorization': 'Basic ' + btoa('pk_live_your_api_key:'), 'Content-Type': 'application/json' }, body: JSON.stringify({ printerId: 'clx_zebra_01', contentType: 'raw_base64', content: 'XlhBXkZPNTAs...', title: 'Shipping Label' }) }); const data = await response.json();
import requests response = requests.post( 'https://printcloud.abst.co.il/api/printjobs', auth=('pk_live_your_api_key', ''), json={ 'printerId': 'clx_zebra_01', 'contentType': 'raw_base64', 'content': 'XlhBXkZPNTAs...', 'title': 'Shipping Label' } ) data = response.json()
$ch = curl_init('https://printcloud.abst.co.il/api/printjobs'); curl_setopt($ch, CURLOPT_USERPWD, 'pk_live_your_api_key:'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json' ]); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([ 'printerId' => 'clx_zebra_01', 'contentType' => 'raw_base64', 'content' => 'XlhBXkZPNTAs...', 'title' => 'Shipping Label' ])); $response = curl_exec($ch); $data = json_decode($response, true);
using var client = new HttpClient(); var auth = Convert.ToBase64String( Encoding.UTF8.GetBytes("pk_live_your_api_key:")); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", auth); var body = new StringContent( JsonSerializer.Serialize(new { printerId = "clx_zebra_01", contentType = "raw_base64", content = "XlhBXkZPNTAs...", title = "Shipping Label" }), Encoding.UTF8, "application/json"); var response = await client.PostAsync( "https://printcloud.abst.co.il/api/printjobs", body); var data = await response.Content.ReadAsStringAsync();
RESPONSE 201
// RAW data is sent directly to the // printer without driver conversion. // Use for ZPL, EPL, ESC/POS. "pj_b2c1d4e5f6g7h8"
GET/api/printjobs

רשימת היסטוריית עבודות הדפסה. תומך בפרמטרי שאילתה: ?limit=100&dir=desc

REQUEST
curl -u "pk_live_your_api_key:" \ "https://printcloud.abst.co.il/api/printjobs?limit=5"
const response = await fetch('https://printcloud.abst.co.il/api/printjobs?limit=5', { headers: { 'Authorization': 'Basic ' + btoa('pk_live_your_api_key:') } }); const data = await response.json();
import requests response = requests.get( 'https://printcloud.abst.co.il/api/printjobs', auth=('pk_live_your_api_key', ''), params={'limit': 5} ) data = response.json()
$ch = curl_init('https://printcloud.abst.co.il/api/printjobs?limit=5'); curl_setopt($ch, CURLOPT_USERPWD, 'pk_live_your_api_key:'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); $data = json_decode($response, true);
using var client = new HttpClient(); var auth = Convert.ToBase64String( Encoding.UTF8.GetBytes("pk_live_your_api_key:")); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", auth); var response = await client.GetAsync( "https://printcloud.abst.co.il/api/printjobs?limit=5"); var data = await response.Content.ReadAsStringAsync();
RESPONSE 200
[ { "id": "pj_a8f3b2c1", "title": "Invoice #456", "state": "completed", "contentType": "pdf_uri", "printer": { "name": "HP LaserJet" }, "createdAt": "2026-04-05T..." } ]
DELETE/api/printjobs/:ids

מחק עבודות הדפסה.

REQUEST
curl -u "pk_live_your_api_key:" \ -X DELETE \ "https://printcloud.abst.co.il/api/printjobs/pj_a8f3,pj_b2c1"
const response = await fetch('https://printcloud.abst.co.il/api/printjobs/pj_a8f3,pj_b2c1', { method: 'DELETE', headers: { 'Authorization': 'Basic ' + btoa('pk_live_your_api_key:') } }); const data = await response.json();
import requests response = requests.delete( 'https://printcloud.abst.co.il/api/printjobs/pj_a8f3,pj_b2c1', auth=('pk_live_your_api_key', '') ) data = response.json()
$ch = curl_init('https://printcloud.abst.co.il/api/printjobs/pj_a8f3,pj_b2c1'); curl_setopt($ch, CURLOPT_USERPWD, 'pk_live_your_api_key:'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE'); $response = curl_exec($ch); $data = json_decode($response, true);
using var client = new HttpClient(); var auth = Convert.ToBase64String( Encoding.UTF8.GetBytes("pk_live_your_api_key:")); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", auth); var response = await client.DeleteAsync( "https://printcloud.abst.co.il/api/printjobs/pj_a8f3,pj_b2c1"); var data = await response.Content.ReadAsStringAsync();
RESPONSE 200
["pj_a8f3", "pj_b2c1"]

מצבי עבודה

מצבתיאור
pendingעבודה נוצרה, ממתינה ללקוח
sentנשלחה לתוכנת הלקוח
printingהלקוח מדפיס
completedהודפסה בהצלחה
errorההדפסה נכשלה

מחשבים

GET/api/computers

רשימת כל המחשבים המחוברים לחשבון שלך.

REQUEST
curl -u "pk_live_your_api_key:" \ https://printcloud.abst.co.il/api/computers
const response = await fetch('https://printcloud.abst.co.il/api/computers', { headers: { 'Authorization': 'Basic ' + btoa('pk_live_your_api_key:') } }); const data = await response.json();
import requests response = requests.get( 'https://printcloud.abst.co.il/api/computers', auth=('pk_live_your_api_key', '') ) data = response.json()
$ch = curl_init('https://printcloud.abst.co.il/api/computers'); curl_setopt($ch, CURLOPT_USERPWD, 'pk_live_your_api_key:'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); $data = json_decode($response, true);
using var client = new HttpClient(); var auth = Convert.ToBase64String( Encoding.UTF8.GetBytes("pk_live_your_api_key:")); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", auth); var response = await client.GetAsync( "https://printcloud.abst.co.il/api/computers"); var data = await response.Content.ReadAsStringAsync();
RESPONSE 200
[ { "id": "clx456...", "name": "Office-PC", "os": "Windows", "state": "online", "clientVersion": "1.0.0", "printers": [ ... ], "lastSeenAt": "2026-04-05T..." } ]
DELETE/api/computers/:ids

הסר מחשבים מהחשבון שלך.

Webhooks

POST/api/webhooks

צור webhook.

REQUEST
curl -u "pk_live_your_api_key:" \ -X POST https://printcloud.abst.co.il/api/webhooks \ -H "Content-Type: application/json" \ -d '{ "url": "https://your.server/hook", "secret": "my_secret_123", "events": [ "job.state", "printer.state" ] }'
const response = await fetch('https://printcloud.abst.co.il/api/webhooks', { method: 'POST', headers: { 'Authorization': 'Basic ' + btoa('pk_live_your_api_key:'), 'Content-Type': 'application/json' }, body: JSON.stringify({ url: 'https://your.server/hook', secret: 'my_secret_123', events: [ 'job.state', 'printer.state' ] }) }); const data = await response.json();
import requests response = requests.post( 'https://printcloud.abst.co.il/api/webhooks', auth=('pk_live_your_api_key', ''), json={ 'url': 'https://your.server/hook', 'secret': 'my_secret_123', 'events': [ 'job.state', 'printer.state' ] } ) data = response.json()
$ch = curl_init('https://printcloud.abst.co.il/api/webhooks'); curl_setopt($ch, CURLOPT_USERPWD, 'pk_live_your_api_key:'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json' ]); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([ 'url' => 'https://your.server/hook', 'secret' => 'my_secret_123', 'events' => [ 'job.state', 'printer.state' ] ])); $response = curl_exec($ch); $data = json_decode($response, true);
using var client = new HttpClient(); var auth = Convert.ToBase64String( Encoding.UTF8.GetBytes("pk_live_your_api_key:")); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", auth); var body = new StringContent( JsonSerializer.Serialize(new { url = "https://your.server/hook", secret = "my_secret_123", events = new[] { "job.state", "printer.state" } }), Encoding.UTF8, "application/json"); var response = await client.PostAsync( "https://printcloud.abst.co.il/api/webhooks", body); var data = await response.Content.ReadAsStringAsync();
RESPONSE 201
{ "id": "wh_x1y2z3...", "url": "https://your.server/hook", "events": ["job.state","printer.state"], "active": true } // When an event fires, we POST to your URL: { "type": "job.state", "jobId": "pj_xxx", "state": "completed", "timestamp": "2026-04-05T..." } // Header: X-PrintCloud-Webhook-Secret: my_secret_123

אירועי Webhook

אירועתיאור
allכל האירועים
job.createdעבודת הדפסה חדשה נשלחה
job.stateמצב עבודה השתנה
computer.connectedמחשב לקוח התחבר
computer.disconnectedמחשב לקוח התנתק
printer.stateמצב מדפסת השתנה

מפתחות API

POST/api/account/apikeys

צור מפתח API חדש.

REQUEST
curl -u "pk_live_your_api_key:" \ -X POST https://printcloud.abst.co.il/api/account/apikeys \ -H "Content-Type: application/json" \ -d '{ "description": "Production", "permission": "full" }'
const response = await fetch('https://printcloud.abst.co.il/api/account/apikeys', { method: 'POST', headers: { 'Authorization': 'Basic ' + btoa('pk_live_your_api_key:'), 'Content-Type': 'application/json' }, body: JSON.stringify({ description: 'Production', permission: 'full' }) }); const data = await response.json();
import requests response = requests.post( 'https://printcloud.abst.co.il/api/account/apikeys', auth=('pk_live_your_api_key', ''), json={ 'description': 'Production', 'permission': 'full' } ) data = response.json()
$ch = curl_init('https://printcloud.abst.co.il/api/account/apikeys'); curl_setopt($ch, CURLOPT_USERPWD, 'pk_live_your_api_key:'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json' ]); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([ 'description' => 'Production', 'permission' => 'full' ])); $response = curl_exec($ch); $data = json_decode($response, true);
using var client = new HttpClient(); var auth = Convert.ToBase64String( Encoding.UTF8.GetBytes("pk_live_your_api_key:")); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", auth); var body = new StringContent( JsonSerializer.Serialize(new { description = "Production", permission = "full" }), Encoding.UTF8, "application/json"); var response = await client.PostAsync( "https://printcloud.abst.co.il/api/account/apikeys", body); var data = await response.Content.ReadAsStringAsync();
RESPONSE 201
{ "id": "key_abc123", "key": "pk_live_a1b2c3d4...", "description": "Production" } // Save the key — you won't see it again! // Permissions: full | print_only | read_only
DELETE/api/account/apikeys/:id

בטל מפתח API.

התחברות לקוח

משמש את תוכנת הלקוח לאימות עם אימייל/סיסמה וקבלת מפתח API.

POST/api/client/login

לא נדרש אימות.

REQUEST
curl -X POST https://printcloud.abst.co.il/api/client/login \ -H "Content-Type: application/json" \ -d '{ "email": "user@example.com", "password": "your_password" }'
const response = await fetch('https://printcloud.abst.co.il/api/client/login', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ email: 'user@example.com', password: 'your_password' }) }); const data = await response.json();
import requests response = requests.post( 'https://printcloud.abst.co.il/api/client/login', json={ 'email': 'user@example.com', 'password': 'your_password' } ) data = response.json()
$ch = curl_init('https://printcloud.abst.co.il/api/client/login'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json' ]); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([ 'email' => 'user@example.com', 'password' => 'your_password' ])); $response = curl_exec($ch); $data = json_decode($response, true);
using var client = new HttpClient(); var body = new StringContent( JsonSerializer.Serialize(new { email = "user@example.com", password = "your_password" }), Encoding.UTF8, "application/json"); var response = await client.PostAsync( "https://printcloud.abst.co.il/api/client/login", body); var data = await response.Content.ReadAsStringAsync();
RESPONSE 200
{ "success": true, "apiKey": "pk_live_a1b2c3...", "user": { "id": "usr_xxx", "firstName": "John", "lastName": "Doe", "email": "user@example.com" } }

פרוטוקול WebSocket

תוכנת הלקוח מתחברת דרך WebSocket לתקשורת בזמן אמת.

נקודת קצה: wss://printcloud.abst.co.il/ws

אימות

SEND
{ "type": "auth", "apiKey": "pk_live_your_api_key", "computerName": "Office-PC", "os": "Windows", "clientVersion": "1.0.0" }
RECEIVE
{ "type": "auth_ok", "computerId": "clx456..." } // On failure: { "type": "auth_error", "message": "Invalid API key" }

דיווח מדפסות

SEND
{ "type": "printers", "printers": [{ "name": "HP LaserJet Pro", "capabilities": { "color": true, "duplex": true }, "isDefault": true }] }
RECEIVE
{ "type": "printers_ok", "count": 1 }

קבלת עבודת הדפסה

RECEIVE (from server)
{ "type": "print_job", "job": { "id": "pj_xxx", "printerName": "HP LaserJet", "contentType": "pdf_base64", "content": "JVBERi0xLjQ...", "title": "Invoice #456", "options": { "copies": 2 } } }
SEND (report result)
// On success: { "type": "job_state", "jobId": "pj_xxx", "state": "completed", "message": "Printed to HP LaserJet" } // On failure: { "type": "job_state", "jobId": "pj_xxx", "state": "error", "message": "Printer offline" }