API-documentation

See our API-documentation:

https://api.omnium.no

Posten Norge AS is a Nordic postal and logistics group that develops and delivers integrated solutions in postal services, communications and logistics, with the Nordic region as its home market. Bring is their brand for the B2B market.

Nuget

 

http://nuget.omnium.no/nuget

 

Omnium have four public nuget packages:

Omnium

Contains general functionalliy for transferding data via out API (dependency only to Omnium.Public)

Omnium.Public

Contains share models with compatible with our public API

Omnium.EPiServer.CMS

Contains Episerver CMS specific functionallity (depencencies to Episerver and Omnium)

Omnium.EPiServer.Commerce

Contains Episerver Commerce specific functionallity (dependecies to Episerver.Commerce and Omnium)

Token

Working with tokens (C# / .Net)

private static string TokenPath = $"/api/Security/GetToken";
using (var client = new HttpClient())
{
   client.BaseAddress = new Uri("https://omniumapitest.azurewebsites.net/");
   var formContent = new FormUrlEncodedContent(new[]
   {
       new KeyValuePair<string, string>( "grant_type", "client_credentials" ),
       new KeyValuePair<string, string>( "client_id", ""),
       new KeyValuePair<string, string> ( "client_secret", "" )

   });


//Get Token
var response = await client.PostAsync(TokenPath, formContent);
if (!response.IsSuccessStatusCode)
{
   throw new Exception($"Get token failed! Status: {response.StatusCode}");
}
var tokenString = response.Content.ReadAsStringAsync().Result;
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);

 

 

Token is a JWT token which is valid for 10 days.  Store the token, and check if it is valid:

You can check if it is valid like this:

var jwtHandler = new JwtSecurityTokenHandler();

var jwtToken = jwtHandler.ReadJwtToken(tokenString);

DateTime validToUtc = jwtToken.ValidTo; //utc date


 

The Omnium Client is now ready to make calls to the API.

In order to use our API, you need a valid token. Do you want to test our API? Send an e-mail to techsupport@omnium.no and look at the example below on how to work with tokens (.Net). 

+47 22 12 01 01

OMNIUM AS © 2019