Skip to main content
Skip table of contents

First Steps with Print Server REST API

In this guide, you will learn how to create a REST API application in MyQ Web UI and use generated credentials to get an Authentication token from the server. You should have already installed MyQ Print Server, and if not, see the Installation guide.

1. Hello World

Let’s start by testing if our print server is available.

Open up a command prompt and enter the following command:

CODE
$ curl https://localhost:8090/api/v3/server/status

1

The response is:

  • 1 = server is up and running.

  • 0 = server is not in healthy state, check whether services are running.

localhost should be changed to IP/hostname of the computer where the Print Server is running.

2. Adding a REST API application

To start using a more advanced endpoint available we have to first define a REST API application and scopes that would be used by your application.

How to access REST API applications.

  1. Open Settings tab.

  2. Navigate to External Systems/Connections.

  3. Under REST API applications click Add.

  4. Specify a title and scopes necessary for your application.

  5. Click OK.

Now you can open the created application and copy your Client ID and Secret to get an Authentication token from the Print Server.

3. Retrieving an Authentication token

To retrieve your Authentication token, you need to call endpoint: POST /api/auth/token with the request body specified below.

Example request body:

CODE
{
	"grant_type": "client_credentials",
	"scope": "jobs offline.access",
	"client_id": "7B4CD3C2-F57E-4D52-A90A-23EED001CE81",
	"client_secret": "89fbf537fe689fca26f67abae7a557106f4348d5"
}

If authentication happens, you'll receive an access token that must be provided at any other API endpoint.

Example Response:

CODE
{
	"access_token": "your_bearer_token",
	"token_type": "Bearer",
	"expires_in": 1800,
	"scope": "jobs offline.access",
	"refresh_token": "your_refresh_token"
}

Some endpoints require an authentication token of an existing user which can be requested with the login_info attribute or OAuth 2.0. More in Authentication methods.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.