Skip to main content
Skip table of contents

Getting Started with the 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. 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 http://localhost:8083/api/v2/server/status

1

The response is and 1 or 0 , meaning the server is up and running or not and the configuration of the system needs to be checked.

Note: 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.

  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 endpoint 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"
}

Note: some endpoints require authentication token of an existing user, this can be achieved with login_info attribute. 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.