Skip to content

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 Creatorsand Readers.
upload-specification-access

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.

  1. Login to the Async API Portal and upload your specification.json manually. upload-specification
  2. 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.
    upload-specification-pipeline-client
  3. Make a POST https://api.lomi.lkab.com/development/asyncapi/specifications with the specification as a application/octet-stream payload. more info
    asyncapi-openapi-specification
  4. Login to the LKAB API portal and search for LKAB AsyncAPI Portal then use the Try it functionality on the Create endpoint.
    asyncapi-tryit

Validate specifications

With this endpoint you can validate your async api specification.

Currently API Management only supports application/json so you have to convert your yaml to json

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