Skip to content

1. Stanlab API

gt-mikkel-stensgaard edited this page Mar 1, 2024 · 3 revisions

The Stanlab API is organized around REST. The API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.

The scope of Stanlab is requisition of laboratory tests to Stanlab Requisition API compatible services, and submission of samples, and laboratory tests to Stanlab Reporting API compatible systems. For more information, please refer to the OpenAPI and GraphQL Docs.

The Stanlab API is user specific, i.e. the scope of commands and queries are determined by the user's organization specified in the attached access token.

Security and Authorization

The PULS REST API is secured using Danmarks Miljøportal's identity provider, that requires a set of client credentials. Please contact Danmarks Mlijøportal's support at support@miljoeportal.dk to get a client id and client secret for authorization.

Base URL

The base URL of the current Stanlab API is https://stanlab-api.test.miljoeportal.dk/v2

Authorization

Danmarks Miljøportal's identity provider supports OpenID Connect, a simple identity layer on top of the OAuth 2.0 protocol, which allows computing clients to verify the identity of an end-user based on the authentication performed by an authorization server, as well as to obtain basic profile information about the end-user in an interoperable and REST-like manner. In technical terms, OpenID Connect specifies a RESTful HTTP API, using JSON as a data format.

OpenID Connect allows a range of clients, including Web-based, mobile, and JavaScript clients, to request and receive information about authenticated sessions and end-users. The specification suite is extensible, supporting optional features such as encryption of identity data, discovery of OpenID Providers, and session management.

OpenID Connect defines a discovery mechanism, called OpenID Connect Discovery, where an OpenID server publishes its metadata at a well-known URL. The discovery documents are available on the following URL's for the test and production environment respectively.

https://log-in.test.miljoeportal.dk/runtime/oauth2/.well-known/openid-configuration

https://log-in.miljoeportal.dk/runtime/oauth2/.well-known/openid-configuration

The identity provider supports the OAuth 2.0 / OpenID Connect flow Authorization code. The Authorization Code grant type is used by confidential and public clients to exchange an authorization code for an access token.

When the user returns to the client via the redirect URL, the application will get the authorization code from the URL that can be used to request an access token (and refresh token if needed).

OpenAPI Docs

The Stanlab API is documented using the OpenAPI Specification. OpenAPI Specification (formerly Swagger Specification) is an API description format for REST APIs.

The OpenAPI specification is available here: https://stanlab-api.test.miljoeportal.dk/openapi. Please refer to the sample projects for guides on how to generate a client library implementation (SDK) in your preferred programming language and framework.

GraphQL Docs

https://stanlab-api.test.miljoeportal.dk/openapi/#tag/GraphQL

Clone this wiki locally