# SavaPage RESTful API: questions and answers

**URL:** https://community.savapage.org/t/savapage-restful-api-questions-and-answers/145
**Category:** Operation
**Tags:** api
**Created:** [October 6, 2020, 10:56am UTC](https://community.savapage.org/t/savapage-restful-api-questions-and-answers/145 "2020-10-06T10:56:04Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![rijkr](https://community.savapage.org/user_avatar/community.savapage.org/rijkr/32/3_2.png) [@rijkr](https://community.savapage.org/u/rijkr)
#### Post date: [October 6, 2020, 10:56am UTC](https://community.savapage.org/t/savapage-restful-api-questions-and-answers/145/1 "2020-10-06T10:56:04Z")

</div>

SavaPage has a [RESTful API](https://www.savapage.org/docs/manual/app-tools-webservices.html#app-tools-restful). Feedback based on real world use is greatly appreciated. _So, please tell us what RESTful services you need._

---

<div class="post-metadata">

### Author: ![MetaFight](https://community.savapage.org/user_avatar/community.savapage.org/metafight/32/48_2.png) [@MetaFight](https://community.savapage.org/u/MetaFight)
#### Post date: [November 13, 2020, 4:28pm UTC](https://community.savapage.org/t/savapage-restful-api-questions-and-answers/145/2 "2020-11-13T16:28:21Z")

</div>

Hello again,

I’m currently working on a setup where Savapage sources its users from an OpenLDAP server and also delegates authentication to Keycloak for a single-sign-on experience.

Both my Savapage and Keycloak instances use the same backing OpenLDAP instance. I also allow new users to register via Keycloak. Once the user verifies their email address a new user record is added to OpenLDAP.

I have set up Keycloak to publish events to a RabbitMQ broker and I’ve also written some middleware to read those events and process user creations/deletions.

What I would like to do now is programmatically tell Savapage to either:

- Sync a new specific user from LDAP; or
- Sync all users from LDAP

Is such funcitonality available from the REST API?

---

<div class="post-metadata">

### Author: ![rijkr](https://community.savapage.org/user_avatar/community.savapage.org/rijkr/32/3_2.png) [@rijkr](https://community.savapage.org/u/rijkr)
#### Post date: [November 14, 2020, 11:04am UTC](https://community.savapage.org/t/savapage-restful-api-questions-and-answers/145/3 "2020-11-14T11:04:51Z")

</div>

@MetaFight. When you enable “Import new users overnight”, users are automatically synchronized daily at 10 minutes past midnight. In addition you can enable “On demand user creation” to ad-hoc create a user when they successfully login to SavaPage for the first time (“At first login”), or when they print to a SavaPage queue for the first time (“At first print”). It’s all explained in the [User Creation](https://www.savapage.org/docs/manual/ch-webapp-admin-options.html#ch-webapp-admin-options-user-creation) section of the User Manual.

---

<div class="post-metadata">

### Author: ![MetaFight](https://community.savapage.org/user_avatar/community.savapage.org/metafight/32/48_2.png) [@MetaFight](https://community.savapage.org/u/MetaFight)
#### Post date: [November 14, 2020, 4:38pm UTC](https://community.savapage.org/t/savapage-restful-api-questions-and-answers/145/4 "2020-11-14T16:38:22Z")

</div>

Hi,

I’ve tried the settings you suggest but unfortunately, this doesn’t seem to work. Here’s what happens:

1. User navigates to Savapage login page
2. User clicks on “login with Keycloak” button
3. User is directed to Keycloak page
4. User choses to register a new account
5. Keycloak asks User to verify their email
6. User receives a verification email with a verification link
7. User clicks verification link
8. Keycloak acknowledges verification, creates local account, and immediately synchronises account with LDAP
9. OpenIdConnect Authentication was successful, therefore Keycloak redirects user to Savapage
10. Savapage fails to log user in with error message: ` Keycloak login failed Try again with another account, or use another method.`  
 ![image](https://community.savapage.org/uploads/default/original/1X/a79b7320adf1b1a16fb83dd3303911d4e48ccc8f.png)

However, if I trigger a manual sync with LDAP from the Savapage Admin panel then the login works.

~~Now I’m wondering if I should remove the link between Savapage and LDAP. Is this necessary now that I have a working SSO setup with Keycloak?~~ Nope, disabling the LDAP User Source doesn’t change anything. I’ll probably just sniff the API call the admin console makes when I manually sync and simulate that.

---

<div class="post-metadata">

### Author: ![rijkr](https://community.savapage.org/user_avatar/community.savapage.org/rijkr/32/3_2.png) [@rijkr](https://community.savapage.org/u/rijkr)
#### Post date: [November 16, 2020, 10:03am UTC](https://community.savapage.org/t/savapage-restful-api-questions-and-answers/145/5 "2020-11-16T10:03:37Z")

</div>

@MetaFight Please wait before diving too deep. I’m working on a solution to solve your issue right now. Should be ready today/tomorrow. I’ll let you know when its ready for testing.

---

<div class="post-metadata">

### Author: ![rijkr](https://community.savapage.org/user_avatar/community.savapage.org/rijkr/32/3_2.png) [@rijkr](https://community.savapage.org/u/rijkr)
#### Post date: [November 16, 2020, 4:16pm UTC](https://community.savapage.org/t/savapage-restful-api-questions-and-answers/145/6 "2020-11-16T16:16:27Z")

</div>

@MetaFight A new [RC snapshot](https://wiki.savapage.org/doku.php?id=software_packages) is available with issue [1150: Support OAuth ad-hoc user creation](https://issues.savapage.org/view.php?id=1150) implemented. Can you please test if this solves your problem?

P.S. Set `keycloak.savapage.usersource=true` in your `savapage-ext-oauth-keycloak.properties` file.

---

<div class="post-metadata">

### Author: ![MetaFight](https://community.savapage.org/user_avatar/community.savapage.org/metafight/32/48_2.png) [@MetaFight](https://community.savapage.org/u/MetaFight)
#### Post date: [November 16, 2020, 6:37pm UTC](https://community.savapage.org/t/savapage-restful-api-questions-and-answers/145/7 "2020-11-16T18:37:46Z")

</div>

Hi @rijkr,

Your latest build, with the changes you mentioned, works like a charm! thank you!

---

<div class="post-metadata">

### Author: ![rijkr](https://community.savapage.org/user_avatar/community.savapage.org/rijkr/32/3_2.png) [@rijkr](https://community.savapage.org/u/rijkr)
#### Post date: [November 16, 2020, 7:07pm UTC](https://community.savapage.org/t/savapage-restful-api-questions-and-answers/145/8 "2020-11-16T19:07:08Z")

</div>

@MetaFight Thanks for your swift confirmation! Issue 1150 is now marked as resolved 🙂

---

<div class="post-metadata">

### Author: ![thoschi](https://community.savapage.org/letter_avatar_proxy/v4/letter/t/58f4c7/32.png) [@thoschi](https://community.savapage.org/u/thoschi)
#### Post date: [September 1, 2022, 7:12pm UTC](https://community.savapage.org/t/savapage-restful-api-questions-and-answers/145/9 "2022-09-01T19:12:12Z")

</div>

Hi there - I hope I might revive this old thread

We just recently discovered SavaPage and it seems a near to perfect solution for our school (and others in the same situation). We have developed a billing solution for our copiers on top of the printer quota solution pykota - and it would be perfect to connect SavaPage and our billing system (also open source) as a modern successor.

What we need for that within the RESTful API would be a way to

- get user details, especially balance (to set copier quota according to the actual user balance in savapage)
- issue a print job and delegating the costs for it to a certain user (in our old system we print to virtual printers to bill the copies a user made to the printer quota/billing system - this way they could see their copies in their print log).
- it would also be nice to get the reports as JSON-Data via the RESTful API  
As all of this is easily to achieve usung the the web interface, we have some hope that there is a certain chance to implement this functionality. If there is not we might give python/selenium a try…

In any way thanks for this exciting piece of software.  
Best regards  
Thomas

---

<div class="post-metadata">

### Author: ![rijkr](https://community.savapage.org/user_avatar/community.savapage.org/rijkr/32/3_2.png) [@rijkr](https://community.savapage.org/u/rijkr)
#### Post date: [September 2, 2022, 3:05pm UTC](https://community.savapage.org/t/savapage-restful-api-questions-and-answers/145/10 "2022-09-02T15:05:11Z")

</div>

Hi @thoschi , welcome to SavaPage! and thanks for your feedback. For starters, to issue a print job by RESTful API, have a look at [POST /documents/print](https://www.savapage.org/docs/manual/app-tools-webservices.html#app-restful-user-print) to see if that suits your needs. Please contact [support@savapage.org](mailto:support@savapage.org) so we can discuss your requirements.

---

<div class="post-metadata">

### Author: ![KGLW](https://community.savapage.org/letter_avatar_proxy/v4/letter/k/b77776/32.png) [@KGLW](https://community.savapage.org/u/KGLW)
#### Post date: [October 4, 2023, 5:59pm UTC](https://community.savapage.org/t/savapage-restful-api-questions-and-answers/145/11 "2023-10-04T17:59:49Z")

</div>

Hi,

I’ve just turn on my computer with savapage server already installed and the print portal doesn’t open. I typed the status command and this appeared

savapage.service - SavaPage Open Print Portal  
Loaded: loaded (/lib/systemd/system/savapage.service; enabled; vendor pres\>  
Active: inactive (dead) since Wed 2023-10-04 11:33:55 CST; 17min ago  
Process: 14269 ExecStart=/opt/savapage/server/bin/linux-x64/app-server star\>  
Process: 14345 ExecStop=/opt/savapage/server/bin/linux-x64/app-server stop \>  
Main PID: 14319 (code=exited, status=0/SUCCESS)  
CPU: 1.945s

I tried to start, stop, restart and enable the service, but nothing worked for this. Please, help.

---

<div class="post-metadata">

### Author: ![rijkr](https://community.savapage.org/user_avatar/community.savapage.org/rijkr/32/3_2.png) [@rijkr](https://community.savapage.org/u/rijkr)
#### Post date: [October 4, 2023, 6:44pm UTC](https://community.savapage.org/t/savapage-restful-api-questions-and-answers/145/12 "2023-10-04T18:44:10Z")

</div>

> [@KGLW](#):
>
> I tried to start, stop, restart and enable the service, but nothing worked for this. Please, help.

@KGLW Welcome to SavaPage!

Open `/opt/savapage/server/logs/server.log` and look for ERROR messages. They will give you clues as to what is wrong.

---

<div class="post-metadata">

### Author: ![Wilzzer](https://community.savapage.org/letter_avatar_proxy/v4/letter/w/ba8739/32.png) [@Wilzzer](https://community.savapage.org/u/Wilzzer)
#### Post date: [April 11, 2024, 3:52pm UTC](https://community.savapage.org/t/savapage-restful-api-questions-and-answers/145/13 "2024-04-11T15:52:12Z")

</div>

Hi @rijkr !

Our infrastructure uses savapage for remote printing. Thanks for the great work !  
I’m currently building a telegram-bot that’d be able to automatically print the files sent to him. To do this, i’m using your RESTful API (can’t include links).  
Your doc uses the following :

```auto
curl -v -k -u janet:97008e2c-d8b2-11e9-aa13-406186940c49 \
     -H "Content-Type: multipart/form-data" -H "Accept: application/json" \
     -F "file=@lorem-ipsum.txt" -X POST \ 
      https://savapage:8632/restful/v1/documents/print

```

Which I use with python’s _requests_ module as so:

```auto
    print_headers = {
        'Accept': 'application/json'
    }

    files = {
        'file': open(filename, 'rb')
    }

    response = session.post(
        url='https://domain.name/restful/v1/documents/print',
        headers=print_headers,
        files = files,
        # verify = False,
        auth=(user_auth_data['user'], user_auth_data['UUID'])
    )

```

However, executing this request only uploads the file to my profile.  
Is there, to your knowledge, something I’d be missing here ?  
We have multiple printers in our infrastructure. Maybe this is the reason ? Is there some way to specify which printer I wish to use or can admins set a “by-default” printer ?

Let me know what you think or if you need more information !

Thanks again.

I wish you a lovely day.

Arthur

---

<div class="post-metadata">

### Author: ![rijkr](https://community.savapage.org/user_avatar/community.savapage.org/rijkr/32/3_2.png) [@rijkr](https://community.savapage.org/u/rijkr)
#### Post date: [April 12, 2024, 1:41pm UTC](https://community.savapage.org/t/savapage-restful-api-questions-and-answers/145/14 "2024-04-12T13:41:57Z")

</div>

> [@Wilzzer](#):
>
> However, executing this request only uploads the file to my profile.

@Wilzzer Welcome to SavaPage! Indeed, the RESTful API is just another way to print a file to SavaPage, just like a driver or driverless print: see [SavaPage as Printer](https://www.savapage.org/docs/manual/ch-printer.html). Once the print job is committed to SavaPage, you can proceed with so-called [Proxy Print Scenarios](https://www.savapage.org/docs/manual/app-proxyprint-scenarios.html), to print to a physical printer.

---

<div class="post-metadata">

### Author: ![Wilzzer](https://community.savapage.org/letter_avatar_proxy/v4/letter/w/ba8739/32.png) [@Wilzzer](https://community.savapage.org/u/Wilzzer)
#### Post date: [April 15, 2024, 10:45am UTC](https://community.savapage.org/t/savapage-restful-api-questions-and-answers/145/15 "2024-04-15T10:45:47Z")

</div>

Hi rijkr !

Thanks for your answer. I’m sorry but i’m not sure I understand how these proxy scenarios work in this case. I read all the proxy-print and IPP doc but maybe there’s something i didn’t quite understand.  
From the IPP Routing page, I understood that the following should be possible :

- Upload automatically to a specific queue (how to do that in the POST method ?)
- Queue is setup with “IPP routing” and its settings print automatically any job sent to this queue (Non-Secure printing)

Alternatively, does any command-line/API instruction exist to execute the printing once it’s uploaded ?

Currently, “standard user” simply connect to the webapp, upload their file and can then issue a printing to a printer of their choice.  
In this other scenario, the user sends an image to a telegram-bot, which converts it to a PDF, uploads it and issues the print automatically.

Let me know if you have any hints on the matter !

Thanks again.

---

<div class="post-metadata">

### Author: ![Wilzzer](https://community.savapage.org/letter_avatar_proxy/v4/letter/w/ba8739/32.png) [@Wilzzer](https://community.savapage.org/u/Wilzzer)
#### Post date: [April 15, 2024, 11:00am UTC](https://community.savapage.org/t/savapage-restful-api-questions-and-answers/145/16 "2024-04-15T11:00:59Z")

</div>

Hello again,

I think I got it, let me know if this is correct:

- Admins can create a specific queue that is IPP routed to a specific printer. This queue can be configured to automatically print what it receives.
- As RESTful prints to the queue /webservice, this specific queue has to be configured as such. In case it’s needed, can another queue be created to receive RESTful prints ?

Thanks again !

---

<div class="post-metadata">

### Author: ![rijkr](https://community.savapage.org/user_avatar/community.savapage.org/rijkr/32/3_2.png) [@rijkr](https://community.savapage.org/u/rijkr)
#### Post date: [April 16, 2024, 6:45pm UTC](https://community.savapage.org/t/savapage-restful-api-questions-and-answers/145/17 "2024-04-16T18:45:03Z")

</div>

> [@Wilzzer](#):
>
> can another queue be created to receive RESTful prints ?

I will implement this feature. It will take a few days. I will let you know when it is ready.

---

<div class="post-metadata">

### Author: ![rijkr](https://community.savapage.org/user_avatar/community.savapage.org/rijkr/32/3_2.png) [@rijkr](https://community.savapage.org/u/rijkr)
#### Post date: [April 19, 2024, 10:26am UTC](https://community.savapage.org/t/savapage-restful-api-questions-and-answers/145/18 "2024-04-19T10:26:15Z")

</div>

Please contact [support@savapage.org](mailto:support@savapage.org) to discuss implementation.

---

<div class="post-metadata">

### Author: ![Julio](https://community.savapage.org/letter_avatar_proxy/v4/letter/j/7ba0ec/32.png) [@Julio](https://community.savapage.org/u/Julio)
#### Post date: [November 22, 2024, 2:30pm UTC](https://community.savapage.org/t/savapage-restful-api-questions-and-answers/145/19 "2024-11-22T14:30:28Z")

</div>

Hi @rijkr. I want ask if the feature that @Wilzzer have asked is implented. Because i’m using also the RESTful User Services especially this endpoint `POST /documents/print` and like @Wilzzer said it just executing this request only uploads the file to user profile. But i’m wondering if to execute the printing once it’s uploaded.  
I’m also wondering if i can disable the file download of a specific user profile.

---

<div class="post-metadata">

### Author: ![rijkr](https://community.savapage.org/user_avatar/community.savapage.org/rijkr/32/3_2.png) [@rijkr](https://community.savapage.org/u/rijkr)
#### Post date: [November 26, 2024, 10:09am UTC](https://community.savapage.org/t/savapage-restful-api-questions-and-answers/145/20 "2024-11-26T10:09:56Z")

</div>

@Julio Welcome to SavaPage!

> [@Julio](#):
>
> Because i’m using also the RESTful User Services especially this endpoint `POST /documents/print` and like @Wilzzer said it just executing this request only uploads the file to user profile. But i’m wondering if to execute the printing once it’s uploaded.

This feature was implemented in version 1.5.0. See the [User Manual with curl example](https://www.savapage.org/docs/manual/app-tools-webservices.html#app-restful-user-print): “An alternative non-reserved Queue can be specified by adding an extra `-F "queue=[queue]"` parameter”. P.S. I just fixed a minor issue (tagging the print-in as “Web Service”) in the latest [1.6.0-rc](https://wiki.savapage.org/doku.php?id=software_packages).

If you configure the target queue for [IPP Routing](https://www.savapage.org/docs/manual/ch-webapp-admin-queues.html#ch-webapp-admin-queue-ipp-routing) the RESTFul `documents/print` routes to the associated Proxy Printer.

[Next page](https://community.savapage.org/t/savapage-restful-api-questions-and-answers/145.md?page=2)
