HMSREG provides a RESTful interface to its database and framework functionality. Built while strictly following the REST architecture and its constraints, even the commonly ignored HATEOAS constraint.
Contact HMSREG Support on support@hmsreg.no to get access.
Base url: https://az-api.hmsreg365.no/
HTTP headers:
Content-Type: application/json
Accept: application/json
Property names used in /registreringer.
Simple example for connecting to the api.
WebAPI.cs
using System;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace HmsRegApi
{
class WebAPI
{
internal const string HmsRegApiUrl = "https://az-api.hmsreg365.no/";
private static readonly Uri HmsRegApiUri = new Uri(HmsRegApiUrl, UriKind.Absolute);
private static ICredentials _Credentials;
private static HttpClientHandler _HttpClientHandler;
private static HttpClient _HttpClient;
public static void Initialize(ICredentials credentials)
{
_Credentials = credentials;
_HttpClientHandler = new HttpClientHandler();
_HttpClientHandler.Credentials = _Credentials;
_HttpClientHandler.PreAuthenticate = true;
_HttpClient = new HttpClient(_HttpClientHandler);
_HttpClient.BaseAddress = HmsRegApiUri;
var applicationJson = new MediaTypeWithQualityHeaderValue("application/json");
_HttpClient.DefaultRequestHeaders.Accept.Add(applicationJson);
}
public static async Task GetAsync(string url)
{
var uri = new Uri(HmsRegApiUri, url);
using (var response = await _HttpClient.GetAsync(url))
{
using (var responseStream = await response.Content.ReadAsStreamAsync())
{
using (var textReader = new StreamReader(responseStream))
{
using (var jsonReader = new JsonTextReader(textReader))
{
return JsonSerializer.CreateDefault().Deserialize(jsonReader);
}
}
}
}
}
public static async Task PostAsync(string url, HttpContent formData)
{
using (var response = await _HttpClient.PostAsync(url, formData))
{
using (var responseStream = await response.Content.ReadAsStreamAsync())
{
using (var textReader = new StreamReader(responseStream))
{
using (var jsonReader = new JsonTextReader(textReader))
{
return JsonSerializer.CreateDefault().Deserialize(jsonReader);
}
}
}
}
}
}
}
In Postman, click "Collection" and choose "Import". Paste this content in the box "Paste Raw Text".
{
"info": {
"_postman_id": "615b0b13-dad0-4855-a7ed-7a3eb6f8f38d",
"name": "HMSREG API",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "https://az-api.hmsreg365.no/api/registreringer",
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "",
"type": "string"
},
{
"key": "username",
"value": "",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"Kortnr\": \"[CARDNO]\",\r\n \"Retning\": \"Ankomst\",\r\n \"Tidspunkt\": \"2017-07-05T14:36:00\",\r\n \"Navn\": \"Ola Norman\",\r\n \"Orgnr\": \"[ORGNO]\",\r\n \"HmsRegnr\": [HMSREGNO],\r\n \"Kilde\": \"Test\",\r\n \"Korttype\": \"HMS\",\r\n \"Fødselsdato\": \"2017-07-05T00:00:00\"\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://az-api.hmsreg365.no/api/registreringer",
"protocol": "https",
"host": [
"az-api",
"hmsreg365",
"no"
],
"path": [
"api",
"registreringer"
]
}
},
"response": []
}
],
"protocolProfileBehavior": {}
}
End Point
Base url: https://<your solution url>/api/rest
HTTP headers:
Content-Type: application/json
Accept: application/json