Async API Portal
LKAB provides a API portal for async api specifications. It can be reached at https://asyncapi.lkab.com.
Access the portal
All_LKAB
and All_Entrepreneurs
have the roles Creators
and Readers
.
If you experience problems with the access please contact servicedesk@lkab.com.
Publish specifications
Thera are different ways to publish your specifications to the LKAB Async API Portal.
- Login to the Async API Portal and upload your
specification.json
manually. - Create a pipeline. For this to work you must have an app registration in Azure with API Permissions against the async api portal api with at least the role
Creators
.
- Make a
POST https://api.lomi.lkab.com/development/asyncapi/specifications
with the specification as aapplication/octet-stream
payload. more info
- Login to the LKAB API portal and search for
LKAB AsyncAPI Portal
then use theTry it
functionality on theCreate
endpoint.
Validate specifications
With this endpoint you can validate your async api specification.
Currently API Management only supports
application/json
so you have to convert youryaml
tojson
POST /development/asyncapi/specifications/file/validate HTTP/1.1
Content-Type: application/json
Authorization: Bearer <dedacted>
Host: api.lomi.lkab.com
Content-Length: 3308
{
"asyncapi": "3.0.0",
"id": "urn:com:lkab:rmq:iot:temperature-sensor",
...
}
Pipeline example
parameters:
- name: portalUrl
displayName: The url to the async api portal
type: string
default: https://api.lomi.lkab.com/development/asyncapi
- name: clientId
displayName: The client id for the requesting application
type: string
- name: clientSecret
displayName: The client secret for the requesting application
type: string
- name: scope
displayName: The scope
type: string
default: https://api.lkab.com/asyncapi/portal/.default
- name: specificationPath
displayName: The path to the specification
type: string
default: $(System.DefaultWorkingDirectory)
stages:
- stage: Push_Specification
dependsOn: []
displayName: Push asyncapi specification to portal
jobs:
- job: UbuntuBuild
displayName: Publish async api specification
pool:
vmImage: 'ubuntu-latest'
steps:
- task: PowerShell@2
displayName: Fetch AAD token
inputs:
targetType: 'inline'
script: |
$t=(Invoke-RestMethod -Uri https://login.microsoftonline.com/74c901f0-6a97-4cfa-8505-9542ce009b27/oauth2/v2.0/token -Method Post -Body "grant_type=client_credentials&client_id=${{ parameters.clientId }}&client_secret=${{ parameters.clientSecret }}&scope=${{ parameters.scope }}").access_token
Write-Host $t
Write-Host "##vso[task.setvariable variable=token;]$t"
- task: PowerShell@2
displayName: Push specification
inputs:
targetType: 'inline'
script: |
Write-Host $(token)
Invoke-RestMethod -Uri ${{ parameters.portalUrl }}/specifications -Headers @{'Authorization'='Bearer $(token)'; 'Content-Type'='application/octet-stream'} -Method Post -InFile "${{ parameters.specificationPath }}"