Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

For testing and development, you can use Postman. We provide a basic postman file to get you started. If you need a detailed list of possible API calls, see the Swagger documentation (read more: API Documentation).

Getting the Bearer-Token

Before you can consume the API, you must be authenticated. Therefore, you have to log in and reuse the token for Portrait.

Login

Simply login to the website with an admin or user account - depending on what you want to test:

...

Copy token

After you are logged in, you can copy the token from the Developer Tools of your Browser (Windows: F12 or Mac: ⌥ + ⌘ + I).
Go to: Application > Storage > Cookies > select your site and copy the value of the “token” cookie.

...

InfoThe bearer token will later be used inside the Auth-Variable of our Postman Collection.. You can import the OpenAPI Specification into Postman:

...

use the URL from https://portrait.atlassian.net/wiki/spaces/PA/pages/69500952/API+Documentation#OpenAPI-Specification

Set up a new environment

To add a new environment, click on the small plus in the top left in the environments section:

...

Now you have to add two new variables. One for the baseUrl of your instance and for the tokenyou copied earlier. Then add the following variables and click save

...

Info

Make sure that the baseURL does NOT contain an trailing slash.

Info

It is important that INITIAL VALUE and CURRENT VALUE are the same value.

...

Postman Collection

In order to import the Portrait collection to Postman, you first have to navigate to the following link: https://<your.portrait.instance>/swagger/swagger.json

Now in Postman, click on import:

...

...

On the top right you can select your newly created environment:

...

Configure the Authentication

Go to the settings of the new imported Request Collection:

...

And configure the following Settings:

...

Afterward, click “get new access token”

Calling an API Method

On the left, you can see all available Methods. After you select one you can fill out possible Parameter and then click send.

...

Make sure the set the Authorization Type to “Inherit auth from parent”!

...

Info

In case you can an authentication Error try to generate a new Token with “get new access token”