### C# Example: Single Tenant API Request
Source: https://developer.unimicro.no/guide/authentication/auth-code
C# code to make a GET request to the Unimicro API using an access token. This example shows how to set the Authorization header for a single-tenant scenario.
```csharp
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
var apiResult = await httpClient.GetAsync(new Uri(baseUrl + "api/biz/user?action=current-session"));
```
--------------------------------
### Install oidc-client via npm
Source: https://developer.unimicro.no/guide/authentication/pkce
Install the oidc-client library using npm for your project.
```bash
npm install oidc-client
```
--------------------------------
### Filter, Expand, and Select Orders API Example
Source: https://developer.unimicro.no/guide/api/filtering
This example shows a GET request to the orders API. It filters orders where the CustomerName contains 'Wa', expands to include Customer and Items.Product details, and selects specific fields from the order, customer, and items.
```http
GET https://test.unimicro.no/api/biz/orders?filter=contains(CustomerName,'Wa')&Expand=Customer,Items.Product&select=CustomerName,VatTotalsAmount,Customer.CustomerNumber,Items.ProductId,Items.PriceIncVat,Items.NumberOfItems,Items.Product.Name,Items.Product.Unit
[
{
"CustomValues": {},
"CustomerName": "Warlocks",
"VatTotalsAmount": 47745000.0000,
"Deleted": false,
"ID": 1,
"CustomerID": 7,
"Items": [
{
"CustomValues": {},
"ProductID": 10,
"PriceIncVat": 2125.0000,
"NumberOfItems": 56000.0000,
"ID": 1,
"CustomerOrderID": 1,
"Product": {
"CustomValues": {},
"Name": "Wolfsbane",
"Unit": "ml",
"ID": 10
}
},
{
"CustomValues": {},
"ProductID": 9,
"PriceIncVat": 18750.0000,
"NumberOfItems": 7800.0000,
"ID": 2,
"CustomerOrderID": 1,
"Product": {
"CustomValues": {},
"Name": "Tears of Lys",
"Unit": "ml",
"ID": 9
}
}
],
"Customer": {
"CustomValues": {},
"CustomerNumber": 100006,
"ID": 7
}
},
{
"CustomValues": {},
"CustomerName": "Nights Watch",
"VatTotalsAmount": 25125000.0000,
"Deleted": false,
"ID": 2,
"CustomerID": 2,
"Items": [
{
"CustomValues": {},
"ProductID": 4,
"PriceIncVat": 550000.0000,
"NumberOfItems": 150.0000,
"ID": 3,
"CustomerOrderID": 2,
"Product": {
"CustomValues": {},
"Name": "Obsidian Dagger",
"Unit": "stk",
"ID": 4
}
},
{
"CustomValues": {},
"ProductID": 5,
"PriceIncVat": 837500.0000,
"NumberOfItems": 150.0000,
"ID": 4,
"CustomerOrderID": 2,
"Product": {
"CustomValues": {},
"Name": "Obsidian Spear",
"Unit": "stk",
"ID": 5
}
}
],
"Customer": {
"CustomValues": {},
"CustomerNumber": 100001,
"ID": 2
}
}
]
```
--------------------------------
### Example Eventplan for Webhook
Source: https://developer.unimicro.no/guide/api/webhooks
This JSON object demonstrates a basic Eventplan setup for sending customer invoice events to a webhook. It specifies the entity to listen to, operations, plan type, and subscriber endpoint.
```json
{
"Name": "Webhook for CustomerInvoices"
"Active": true
"ModelFilter": "CustomerInvoice", // Which Entity to listen to
"OperationFilter": "CUD", // Create, Update, Delete
"PlanType": 0, // Webhook
"EventSubscribers": [
{
"Name": "Webhook subscriber",
"Endpoint": "https://webhook.site/some/path",
"Active" true
}
]
}
```
--------------------------------
### Product Price Calculation Response Body Example
Source: https://developer.unimicro.no/guide/endpoints/products
An example of the HTTP 200 OK response when calculating product prices. It includes calculated PriceIncVat and PriceExVat.
```json
HTTP 200 OK
{
"PartName": null,
"Name": null,
"CostPrice": 10000,
"ListPrice": null,
"PriceIncVat": 11500,
"PriceExVat": 10000,
"AverageCost": null,
"ImageFileID": null,
"Description": null,
"VariansParentID": 0,
------------------
}
```
--------------------------------
### Webhook Header Example
Source: https://developer.unimicro.no/guide/api/webhooks
An example of the Unimicro-Signature header format, which includes a timestamp and a signature. Note that new lines are added for readability; the actual header is a single line.
```text
Unimicro-Signature: t=1600327644, v1=2b1cc858a14bac03ac283819d16e43d8f2da40591db87c99b6ced02589ae74a8
```
--------------------------------
### GET /api/biz/orders
Source: https://developer.unimicro.no/guide/api/filtering
This example demonstrates fetching orders with filtering by customer name, expanding related customer and item details, and selecting specific fields from the order and its related entities.
```APIDOC
## GET /api/biz/orders
### Description
Fetches a list of orders with options to filter, expand related data, and select specific fields.
### Method
GET
### Endpoint
/api/biz/orders
### Query Parameters
- **filter** (string) - Optional - Specifies filter conditions. Example: `contains(CustomerName,'Wa')`
- **Expand** (string) - Optional - Specifies related entities to include. Example: `Customer,Items.Product`
- **select** (string) - Optional - Specifies which fields to return. Example: `CustomerName,VatTotalsAmount,Customer.CustomerNumber,Items.ProductId,Items.PriceIncVat,Items.NumberOfItems,Items.Product.Name,Items.Product.Unit`
### Response
#### Success Response (200)
Returns an array of order objects, with fields determined by the `select` parameter and including expanded related data.
### Response Example
```json
[
{
"CustomValues": {},
"CustomerName": "Warlocks",
"VatTotalsAmount": 47745000.0000,
"Deleted": false,
"ID": 1,
"CustomerID": 7,
"Items": [
{
"CustomValues": {},
"ProductID": 10,
"PriceIncVat": 2125.0000,
"NumberOfItems": 56000.0000,
"ID": 1,
"CustomerOrderID": 1,
"Product": {
"CustomValues": {},
"Name": "Wolfsbane",
"Unit": "ml",
"ID": 10
}
},
{
"CustomValues": {},
"ProductID": 9,
"PriceIncVat": 18750.0000,
"NumberOfItems": 7800.0000,
"ID": 2,
"CustomerOrderID": 1,
"Product": {
"CustomValues": {},
"Name": "Tears of Lys",
"Unit": "ml",
"ID": 9
}
}
],
"Customer": {
"CustomValues": {},
"CustomerNumber": 100006,
"ID": 7
}
},
{
"CustomValues": {},
"CustomerName": "Nights Watch",
"VatTotalsAmount": 25125000.0000,
"Deleted": false,
"ID": 2,
"CustomerID": 2,
"Items": [
{
"CustomValues": {},
"ProductID": 4,
"PriceIncVat": 550000.0000,
"NumberOfItems": 150.0000,
"ID": 3,
"CustomerOrderID": 2,
"Product": {
"CustomValues": {},
"Name": "Obsidian Dagger",
"Unit": "stk",
"ID": 4
}
},
{
"CustomValues": {},
"ProductID": 5,
"PriceIncVat": 837500.0000,
"NumberOfItems": 150.0000,
"ID": 4,
"CustomerOrderID": 2,
"Product": {
"CustomValues": {},
"Name": "Obsidian Spear",
"Unit": "stk",
"ID": 5
}
}
],
"Customer": {
"CustomValues": {},
"CustomerNumber": 100001,
"ID": 2
}
}
]
```
```
--------------------------------
### Example Response for Listing Contacts
Source: https://developer.unimicro.no/guide/endpoints/contacts
This is an example of the JSON response when listing contacts with expanded information.
```json
[
{
"ID": 1,
"InfoID": 87,
"Info": {
"ID": 87,
"DefaultEmailID": 8,
"DefaultPhoneID": 41,
"InvoiceAddressID": 107,
"Name": "Mikke Mus Kontaktperson",
"DefaultPhone": {
"ID": 41,
"BusinessRelationID": 0,
"CountryCode": "+999",
"Description": "Mobile",
"Number": "999-999-999",
"Type": "0"
},
"DefaultEmail": {
"ID": 8,
"BusinessRelationID": 0,
"Deleted": false,
"Description": null,
"EmailAddress": "mikke@mus.com"
},
"InvoiceAddress": {
"ID": 107,
"AddressLine1": "Andebygaten 33b",
"AddressLine2": "2 etg.",
"AddressLine3": "",
"BusinessRelationID": 0,
"City": "Andeby",
"Country": "DisneyWorld",
"CountryCode": "DW",
"PostalCode": "341234-A",
"Region": null
}
},
"Comment": "First comment"
}
]
```
--------------------------------
### Install oidc-client via CDN
Source: https://developer.unimicro.no/guide/authentication/pkce
Include the oidc-client library in your HTML using a CDN link.
```html
```
--------------------------------
### Token Request Body Example
Source: https://developer.unimicro.no/guide/authentication/server
An example of the HTTP POST request body sent to the token endpoint to obtain an access token.
```http
POST https://test-login.unimicro.no/connect/token
Body (application/x-www-form-urlencoded)
{
"client_id": "",
"scope": "AppFramework",
"grant_type": "client_credentials",
"client_assertion_type": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
"client_assertion": ""
}
```
--------------------------------
### C# Example: Request Access Token
Source: https://developer.unimicro.no/guide/authentication/auth-code
C# code to make a POST request to the token endpoint using HttpClient. This example demonstrates how to format the request body for the authorization code grant.
```csharp
var httpClient = new HttpClient();
var pairs = new List>
{
new KeyValuePair("client_id", ""),
new KeyValuePair("code", code),
new KeyValuePair("grant_type", "authorization_code"),
new KeyValuePair("client_secret", ""),
new KeyValuePair("redirect_uri", "https://integration-partner/post-login")
};
var content = new FormUrlEncodedContent(pairs);
var result = await httpClient.PostAsync(new Uri("https://test-login.unimicro.no/connect/token"), content)
```
--------------------------------
### Example VAT Types Response
Source: https://developer.unimicro.no/guide/endpoints/journal-entries
This is an example response when fetching VAT types. It includes details like ID, Name, VatPercent, VatCode, and whether it's an OutputVat.
```json
[
{
"ID": 1,
"Name": "Ingen mvabehandling (anskaffelser)",
"VatPercent": 0.0000,
"VatCode": "0",
"OutputVat": false
}, {
"ID": 2,
"Name": "Fradrag for inngående mva",
"VatPercent": 25.0000,
"VatCode": "1",
"OutputVat": false
}, {
"ID": 3,
"Name": "Fradrag for inngående mva",
"VatPercent": 15.0000,
"VatCode": "11",
"OutputVat": false
}, {
"ID": 4,
"Name": "Fradrag for inngående mva",
"VatPercent": 11.1100,
"VatCode": "12",
"OutputVat": false
}
]
```
--------------------------------
### Get First Product From The List
Source: https://developer.unimicro.no/guide/endpoints/products
Retrieves the oldest product record from the system.
```APIDOC
## GET /api/biz/products/?action=first
### Description
This will return the product that is added first (oldest product record).
### Method
GET
### Endpoint
/api/biz/products/?action=first
```
--------------------------------
### Get Next Product For Given Product ID
Source: https://developer.unimicro.no/guide/endpoints/products
Retrieves the product that immediately follows the product with the specified ID in the list.
```APIDOC
## GET api/biz/products/{id}?action=next
### Description
This will return the product that is next to the provided product ID.
### Method
GET
### Endpoint
api/biz/products/{id}?action=next
### Parameters
#### Path Parameters
- **id** (string) - Required - The ID of the product to find the next product for.
```
--------------------------------
### Bad Request Response Example
Source: https://developer.unimicro.no/guide/endpoints/users
Returned when the request body is malformed or essential fields are missing.
```json
{
"Message": "Invalid request data"
}
```
--------------------------------
### Create Approval Flow for SupplierInvoice
Source: https://developer.unimicro.no/guide/endpoints/flows
Initiates a new approval flow for a SupplierInvoice by assigning users. Use this to start an approval process.
```http
POST api/biz/supplierinvoices/105?action=assign-to
```
--------------------------------
### Forbidden Response Example
Source: https://developer.unimicro.no/guide/endpoints/users
This response is returned if the user lacks the necessary LicenseAdmin privileges or permissions for the specified companies.
```json
{
"Message": "No permission to add user to companies"
}
```
--------------------------------
### Filter using Starts With (Case Insensitive)
Source: https://developer.unimicro.no/guide/api/filtering
Use the 'startsWith' function for case-insensitive matching of a string from the beginning of a property.
```http
test.unimicro.no/api/biz/orders?filter=startsWith(CustomerName,'Uni')
```
--------------------------------
### Get Product by Name
Source: https://developer.unimicro.no/guide/endpoints/invoices
Retrieve product details by filtering on the product's name. This is useful for fetching specific product information for use in other operations.
```HTTP
https://test.unimicro.no/api/biz/products?filter=name eq 'Weber 114'
```
--------------------------------
### Upload File Example in C#
Source: https://developer.unimicro.no/guide/api/files
Demonstrates how to upload a file using C# with multipart form data. Ensure you have the correct authorization token, company key, and file path.
```csharp
var _token = "***";
var _companyKey = "1f2ace3-23435...";
var _fileName = @"c:\files\mytestfile.pdf";
var _fileApiRoute = "https://test-files.unimicro.com";
//Create form-data
var form = new MultipartFormDataContent();
form.Add(new StringContent(_token), "Token");
form.Add(new StringContent(_companyKey), "Key");
var fileContent = new StreamContent(new FileStream(_fileName, FileMode.Open));
fileContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/pdf");
fileContent.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("form-data")
{
Name = "File",
FileName = Path.GetFileName(_fileName)
};
form.Add(fileContent);
// Upload
using var client = new HttpClient();
client.BaseAddress = new Uri(_fileApiRoute);
var result = client.PostAsync("api/file", form).Result;
```
--------------------------------
### Initiate Sign-in with a Button
Source: https://developer.unimicro.no/guide/authentication/pkce
Add a button to your application that calls the login function to initiate the sign-in process.
```html
...
```
--------------------------------
### Get a specific supplier invoice
Source: https://developer.unimicro.no/guide/endpoints/supplier-invoices
Retrieve detailed information for a specific supplier invoice using its ID, or get a list of attachments for a given invoice.
```APIDOC
## GET /api/biz/supplierinvoices/${InvoiceId}
### Description
Retrieves detailed information for a specific supplier invoice using its unique InvoiceId.
### Method
GET
### Endpoint
/api/biz/supplierinvoices/${InvoiceId}
### Parameters
#### Path Parameters
- **InvoiceId** (string) - Required - The unique identifier of the supplier invoice.
### Response
#### Success Response (200)
- **field1** (type) - Description
#### Response Example
{
"example": "response body"
}
```
```APIDOC
## GET /api/biz/files/SupplierInvoice/${InvoiceId}
### Description
Retrieves a list of all attachments associated with a specific supplier invoice, identified by its InvoiceId.
### Method
GET
### Endpoint
/api/biz/files/SupplierInvoice/${InvoiceId}
### Parameters
#### Path Parameters
- **InvoiceId** (string) - Required - The unique identifier of the supplier invoice.
### Response
#### Success Response (200)
- **field1** (type) - Description
#### Response Example
{
"example": "response body"
}
```
--------------------------------
### List Available Transitions
Source: https://developer.unimicro.no/guide/endpoints/flows
Retrieves a list of all available transitions in the system. This can be useful for understanding the possible actions that can be performed on entities.
```bash
GET api/biz/transitions?top=2
```
```json
[
{
"ID": 1,
"UpdatedAt": null,
"MethodName": "activate",
"UpdatedBy": null,
"CreatedBy": null,
"Controller": "UserCtrl",
"EntityType": "User",
"CreatedAt": null
},
{
"ID": 2,
"UpdatedAt": null,
"MethodName": "inactivate",
"UpdatedBy": null,
"CreatedBy": null,
"Controller": "UserCtrl",
"EntityType": "User",
"CreatedAt": null
}
]
```
--------------------------------
### Fetch Available Products
Source: https://developer.unimicro.no/guide/endpoints/users
Retrieve a list of available products from the license server. This is used to determine which products and roles can be assigned to a user.
```HTTP
GET {License Server URL}/api/contracttypes/{contract_type}/products?$filter=isperuser eq true and productstatus eq 'Live' and producttype in ('Module', 'Package')&$select=id,label,name,listofroles,defaultroles,producttype,productstatus,ismandatoryproduct,isdefaultproduct,isperuser
```
--------------------------------
### Invoice Sales Event Payload Example
Source: https://developer.unimicro.no/guide/endpoints/invoice-sales
This is an example of the generic object payload sent by Unimicro for event notifications. It includes details about the event type, entity, and associated IDs.
```json
{
"EventType": "Update",
"EntityName": "PurchaseEvent",
"Entity":
{
"PurchaseEventType": 1020,
"ProductId": 49,
"CompanyName": "Testserver selskap",
"OrganizationNumber": "959415900",
"Email": "",
"Platform": "unimicro",
"ApiBaseUrl": "https://test-api.unimicro.no/",
"ID": 2931
},
"EntityID": 2931,
"MessageID": "170987-1",
"SessionID": "bb8f7d6c-c900-4d01-aab0-ed786fcafe9f",
"TimeStamp": "2021-08-27T07:00:12.51414Z",
"CompanyKey": "eda508bc-cab4-4697-aeb8-8b5688389fe6",
"Reason": "/api/elsa/purchases"
}
```
--------------------------------
### Call Unimicro API with Access Token
Source: https://developer.unimicro.no/guide/authentication/server
Demonstrates how to use the obtained access token to make authenticated requests to the Unimicro APIs, such as fetching company settings.
```csharp
static async Task CallServiceAsync(string token)
{
var baseAddress = "https://test.unimicro.no/";
var client = new HttpClient
{
BaseAddress = new Uri(baseAddress)
};
client.SetBearerToken(token);
try
{
var response = client.GetStringAsync("https://test.unimicro.no/api/init/companies").Result;
Console.WriteLine("Result: " + JArray.Parse(response));
var companies = JsonConvert.DeserializeObject>(response);
client.DefaultRequestHeaders.Add("CompanyKey", companies[0].Key);
var companyResponse = client.GetStringAsync("https://test.unimicro.no/api/biz/companysettings").Result;
Console.WriteLine("CompanySettings: " + JArray.Parse(companyResponse));
}
catch (Exception ex)
{
Console.WriteLine("Exception: " + ex.Message + " \n stack " + ex.StackTrace);
}
}
```
--------------------------------
### Example Expression Filter Code
Source: https://developer.unimicro.no/guide/api/webhooks
This example expression filters for 'CustomerInvoice' events that have had their 'StatusCode' updated to a 'Paid' status (42004) and also fall within a specific range of 'CollectorStatusCode'. This is useful for identifying direct payments and canceling third-party invoices.
```plaintext
updated(CustomerInvoice, "StatusCode") and CustomerInvoice.StatusCode = 42004 and (CustomerInvoice.CollectorStatusCode > 42500 and CustomerInvoice.CollectorStatusCode < 42507)
```
--------------------------------
### Sample Customer Creation Request JSON
Source: https://developer.unimicro.no/guide/endpoints/customers
This JSON object represents a sample request payload for creating a new customer. It includes various fields such as account identifiers, seller details, and company-specific configurations.
```json
{
"SubAccountNumberSeriesID": 6,
"SubAccountNumberSeries": null,
"DefaultSellerID": 6,
"DefaultSeller": {
"CustomValues": {},
"Deleted": false,
"Name": "Anders",
"StatusCode": null,
"DefaultDimensionsID": null,
"EmployeeID": 8,
"TeamID": null,
"ID": 6,
"UpdatedBy": "638254e7-eb4b-4367-99c6-bd8a00ce7f40",
"UpdatedAt": "2017-10-10T09:53:38.477Z",
"CreatedBy": "57a77470-75c4-40a1-b462-8f1797dabe35",
"UserID": 11,
"CreatedAt": "2017-09-26T12:01:22.79Z"
},
"Sellers": [],
"ReminderEmailAddress": "user@softrig.com",
"Companies": [],
"Account": null,
"Localization": null,
"DefaultCustomerInvoiceReportID": 4,
"DefaultCustomerOrderReportID": 84,
"DefaultCustomerQuoteReportID": 5,
"FactoringNumber": null,
"AvtaleGiro": false,
"AvtaleGiroNotification": false,
"StatusCode": null,
"CustomValues": null,
"ID": 0,
"Deleted": false,
"CreatedAt": null,
"UpdatedAt": null,
"CreatedBy": null,
"UpdatedBy": null
}
```
--------------------------------
### Get Report Details
Source: https://developer.unimicro.no/guide/endpoints/customers
Retrieves report details based on the report type.
```APIDOC
## GET api/report/type/{reportType}
### Description
Retrieves report details for a specified report type.
### Method
GET
### Endpoint
api/report/type/{reportType}
### Parameters
#### Path Parameters
- **reportType** (integer) - Required - The type of report to retrieve. Use `1` for INVOICE, `2` for ORDER, `3` for QUOTE.
### Response
#### Success Response (200)
Details of the requested report.
#### Response Example
```json
{
"ReportID": "RPT001",
"ReportName": "Invoice Report",
"Type": 1
}
```
```
--------------------------------
### Example Hypermedia Response with HAL Links
Source: https://developer.unimicro.no/guide/api/hypermedia
This JSON object demonstrates a typical API response that includes hypermedia links organized into 'actions', 'relations', and 'transitions' sections, as per the HAL specification. It also shows other data fields returned alongside the links.
```json
{
"_links": {
"actions": {
"new-based-on": {
"href": "biz/orders/1?action=new-based-on",
"method": "POST",
"responsetype": "object",
"title": "New order based on current"
},
"next": {
"href": "biz/orders/1?action=next",
"method": "POST",
"responsetype": "object",
"title": "Get next order"
},
"previous": {
"href": "biz/orders/1?action=previous",
"method": "POST",
"responsetype": "object",
"title": "Get previous order"
}
},
"relations": {
"lines": {
"href": "biz/orderlines?filter=orderid eq 1",
"method": "GET",
"responsetype": "array",
"title": "self"
},
"self": {
"href": "biz/orders/1",
"method": "GET",
"responsetype": "object",
"title": "self"
}
},
"transitions": {
"cancel": {
"href": "biz/orders/1?action=cancel",
"method": "POST",
"responsetype": "void",
"title": "Cancel"
},
"transfer-to-invoice": {
"href": "biz/orders/1?action=transfer-to-invoice",
"method": "POST",
"responsetype": "void",
"title": "Transfer to invoice"
},
"transfer-to-quote": {
"href": "biz/orders/1?action=transfer-to-quote",
"method": "POST",
"responsetype": "void",
"title": "Transfer to quote"
}
}
},
"Attachments": null,
"Comment": null,
"CreatedBy": null,
"CreatedDate": null,
"CurrencyCode": null,
"CustomValues": {},
"CustomerID": 1,
"CustomerOrgNumber": null,
"CustomerPerson": null,
"Deleted": false,
"DeliveryDate": null,
"DeliveryMethod": null,
"DeliveryTerm": null,
"DimensionsID": 1,
"FreeTxt": "Free",
"ID": 1
}
```
--------------------------------
### Get Last Product From The List
Source: https://developer.unimicro.no/guide/endpoints/products
Retrieves the most recent product record from the system.
```APIDOC
## GET /api/biz/products/?action=last
### Description
This will return the product that is added last (most recent product record).
### Method
GET
### Endpoint
/api/biz/products/?action=last
```
--------------------------------
### Create Customer Sample Request
Source: https://developer.unimicro.no/guide/endpoints/customers
This JSON object represents a sample request payload for creating a new customer. It includes details such as organization number, contact information, addresses, and default payment/email settings.
```json
{
"CustomerNumber": 0,
"CustomerNumberKidAlias": null,
"BusinessRelationID": 0,
"OrgNumber": "914012708",
"IsPrivate": false,
"Info": {
"CustomValues": null,
"Deleted": false,
"DefaultBankAccountID": null,
"Name": "John Doe",
"ShippingAddressID": null,
"StatusCode": null,
"ID": 0,
"UpdatedBy": null,
"UpdatedAt": null,
"DefaultEmailID": null,
"CreatedBy": null,
"InvoiceAddressID": null,
"DefaultPhoneID": null,
"DefaultContactID": null,
"CreatedAt": null,
"DefaultContact": null,
"Contacts": [],
"Addresses": [],
"Phones": [],
"Emails": [],
"BankAccounts": [],
"InvoiceAddress": {
"ID": 0,
"_createguid": "6588024e-24aa-4ee9-8bf5-bc28778f2e91",
"_guid": "c5e1d7d9-89b8-4314-8023-eb89a8f577d7",
"AddressLine1": "Address Line 1",
"AddressLine2": "Address Line 2",
"AddressLine3": "Address Line",
"PostalCode": "12345",
"City": "12345",
"Country": "Norge",
"CountryCode": "NO",
"_isDirty": true
},
"ShippingAddress": {
"ID": 0,
"_createguid": "6588024e-24aa-4ee9-8bf5-bc28778f2e91",
"_guid": "c5e1d7d9-89b8-4314-8023-eb89a8f577d7",
"AddressLine1": "Address Line 1",
"AddressLine2": "Address Line 2",
"AddressLine3": "Address Line",
"PostalCode": "12345",
"City": "12345",
"Country": "Norge",
"CountryCode": "NO",
"_isDirty": true
},
"DefaultPhone": {
"ID": 0,
"_createguid": "32e9a147-2ce8-4479-8578-44a94a0e0ae8",
"_guid": "48fd0a66-bb3b-40a7-8db1-41b593b7e781",
"Type": 150101,
"Number": "9834834678",
"CountryCode": "97",
"Description": "Office",
"_isDirty": true
},
"DefaultEmail": {
"ID": 0,
"_createguid": "95586df2-ecff-43de-8c4e-7d72c5d834ce",
"_guid": "fdfd2177-e9dd-4cc9-84d9-215523d704b5",
"EmailAddress": "user@softrig.com",
"Description": "SoftRig User",
"_isDirty": true
},
"DefaultBankAccount": null
},
"CreditDays": null,
"DefaultDistributionsID": null,
"Distributions": {
"CustomerInvoiceDistributionPlanID": null,
"CustomerInvoiceDistributionPlan": null,
"CustomerOrderDistributionPlanID": null,
"CustomerOrderDistributionPlan": null,
"CustomerQuoteDistributionPlanID": null,
"CustomerQuoteDistributionPlan": null,
"CustomerInvoiceReminderDistributionPlanID": null,
"CustomerInvoiceReminderDistributionPlan": null,
"PayCheckDistributionPlanID": null,
"PayCheckDistributionPlan": null,
"AnnualStatementDistributionPlanID": null,
"AnnualStatementDistributionPlan": null,
"StatusCode": null,
"CustomValues": null,
"ID": 0,
"Deleted": false,
"CreatedAt": null,
"UpdatedAt": null,
"CreatedBy": null,
"UpdatedBy": null
},
"PaymentTermsID": null,
"PaymentTerms": null,
"DeliveryTermsID": null,
"DeliveryTerms": null,
"WebUrl": null,
"DimensionsID": null,
"Dimensions": {
"CustomValues": null,
"Dimension6ID": null,
"Dimension7ID": null,
"Deleted": false,
"Dimension9ID": null,
"StatusCode": null,
"ResponsibleID": null,
"Dimension10ID": null,
"ProjectID": 1,
"DepartmentID": 2,
"ID": 0,
"UpdatedBy": null,
"UpdatedAt": null,
"Dimension5ID": null,
"CreatedBy": null,
"RegionID": null,
"Dimension8ID": null,
"CreatedAt": null,
"ProjectTaskID": null,
"Project": null,
"Department": null,
"ProjectTask": null,
"Responsible": null,
"Region": null,
"Dimension5": null,
"Dimension6": null,
"Dimension7": null,
"Dimension8": null,
"Dimension9": null,
"Dimension10": null,
"Info": null,
"_createguid": "40e9af2f-eb8b-4157-820a-e281b84ff149"
},
"GLN": null,
"PeppolAddress": null,
"EfakturaIdentifier": null,
"EInvoiceAgreementReference": null,
"CustomerInvoiceReminderSettingsID": null,
"CustomerInvoiceReminderSettings": null,
"DontSendReminders": false,
"CustomerQuotes": [],
"CustomerOrders": [],
"CustomerInvoices": [],
"CurrencyCodeID": null,
"CurrencyCode": null,
"AcceptableDelta4CustomerPaymentAccountID": null,
"AcceptableDelta4CustomerPaymentAccount": null,
"AcceptableDelta4CustomerPayment": 0
}
```
--------------------------------
### Company Response Structure
Source: https://developer.unimicro.no/guide/authentication/auth-code
Example JSON structure for a company response, including its Key.
```json
{
"Name":"Company Inc.",
"Key":"015eb513-753a-4942-9f6a-8ba930e33dc6",
"WebHookSubscriberId":null,
"IsTest":false,
"FileFlowEmail":null,
"ID":5,
"Deleted":false,
"CreatedAt":"2017-02-01T15:55:43.46Z",
"UpdatedAt":null,
"CreatedBy":null,
"UpdatedBy":null
}
```
--------------------------------
### Create Invoice with Existing Customer
Source: https://developer.unimicro.no/guide/endpoints/invoices
This process involves two steps: first, retrieving the customer's ID using a GET request, and second, using that ID to create the invoice via a POST request.
```APIDOC
## GET /api/biz/customers
### Description
Retrieves customer information, specifically their ID, based on filtering by name.
### Method
GET
### Endpoint
https://test.softrig.com/api/biz/customers
### Query Parameters
- **expand** (string) - Optional - Specifies related data to include, e.g., 'Info'.
- **filter** (string) - Required - Filters results, e.g., "info.name eq 'Jo A I Rivelsrud'".
- **select** (string) - Required - Specifies fields to return, e.g., 'id'.
### Response
#### Success Response (200)
Returns an array of customer objects matching the filter.
- **ID** (integer) - The unique identifier for the customer.
### Response Example
```json
[
{
"CustomValues": {},
"ID": 30,
"Deleted": false,
"BusinessRelationID": 129,
"Info": {
"CustomValues": {},
"ID": 129
}
}
]
```
## POST /api/biz/invoices
### Description
Creates a new customer invoice using the provided CustomerID.
### Method
POST
### Endpoint
https://test.softrig.com/api/biz/invoices
### Request Body
- **InvoiceDate** (string) - Required - The date the invoice is issued.
- **PaymentDueDate** (string) - Required - The date the payment is due.
- **OurReference** (string) - Required - Internal reference for the invoice.
- **CustomerID** (integer) - Required - The ID of the existing customer.
- **CustomerName** (string) - Required - The name of the customer.
- **Items** (array) - Required - List of invoice items (same structure as in 'Create Invoice with New Customer').
- **PaymentInfoTypeID** (integer) - Required - Payment information type ID.
- **DistributionPlanID** (integer) - Required - Distribution plan ID.
### Request Example
```json
{
"InvoiceDate": "2019-10-08",
"PaymentDueDate": "2019-10-22",
"OurReference": "Jo Are Ingvaldsen Rivelsrud",
"CustomerID": 30,
"CustomerName": "Jo A I Rivelsrud",
"Items": [
{
"ProductID": 1,
"ItemText": "Weber 114",
"Unit": "stk",
"NumberOfItems": 1,
"PriceExVat": 36000,
"AccountID": 283,
"SumVat": 9000,
"_isDirty": true,
"SumVatCurrency": 9000,
"_createguid": "b46d1b85-b7c0-4495-8bad-6054f514edc2",
"VatTypeID": 11,
"PriceIncVat": 45000,
"PriceExVatCurrency": 36000,
"PriceIncVatCurrency": 45000,
"VatPercent": 25,
"SumTotalExVat": 36000,
"SumTotalIncVat": 45000,
"SumTotalExVatCurrency": 36000,
"SumTotalIncVatCurrency": 45000,
"SortIndex": 1
}
],
"PaymentInfoTypeID": 5,
"DistributionPlanID": 5
}
```
```
--------------------------------
### Internal Server Error Response Example
Source: https://developer.unimicro.no/guide/endpoints/users
This response is returned for unexpected errors during the processing of the request.
```json
{
"Message": "An unexpected error occurred."
}
```
--------------------------------
### Execute a Transition
Source: https://developer.unimicro.no/guide/endpoints/flows
Executes a specific transition on an entity. A successful execution returns a 204 No Content status. Failed executions return a 400 Bad Request.
```bash
POST api/biz/users/1?action=activate
```
--------------------------------
### Get All Supplier Invoices
Source: https://developer.unimicro.no/guide/endpoints/supplier-invoices
Retrieve a list of all supplier invoices. This endpoint does not include attached documents.
```HTTP
GET: /api/biz/supplierinvoices
```
--------------------------------
### Create Project
Source: https://developer.unimicro.no/guide/api/dimensions
Use this endpoint to create a new project. It requires a name, project number, and numeric project number.
```APIDOC
## POST api/biz/projects
### Description
Creates a new project with the provided details.
### Method
POST
### Endpoint
`/api/biz/projects`
### Request Body
- **Name** (string) - Required - The name of the project.
- **ProjectNumber** (string) - Required - The project number (e.g., "EM-1234").
- **ProjectNumberNumeric** (string) - Required - The numeric project number (e.g., "1234").
```
--------------------------------
### Get Previous Customer
Source: https://developer.unimicro.no/guide/endpoints/customers
Retrieves the previous customer in sequence based on the provided customer ID.
```APIDOC
## GET api/biz/customers/{id}?action=previous
### Description
Retrieves the previous customer in the sequence relative to the specified customer ID.
### Method
GET
### Endpoint
api/biz/customers/{id}?action=previous
### Parameters
#### Path Parameters
- **id** (integer) - Required - The ID of the current customer to find the previous one from.
### Response
#### Success Response (200)
Details of the previous customer.
#### Response Example
```json
{
"Id": "1",
"OrgNumber": "123456789",
"Info": {
"Name": "Example Corp"
}
}
```
```
--------------------------------
### Find Applicable Transitions for SupplierInvoice
Source: https://developer.unimicro.no/guide/endpoints/flows
Retrieves a list of all possible transitions that can be applied to a SupplierInvoice entity. This is useful for understanding the available actions within the approval flow.
```http
GET api/biz/transitions?filter=EntityType%20eq%20'SupplierInvoice'
```
--------------------------------
### Get Next Customer
Source: https://developer.unimicro.no/guide/endpoints/customers
Retrieves the next customer in sequence based on the provided customer ID.
```APIDOC
## GET api/biz/customers/{id}?action=next
### Description
Retrieves the next customer in the sequence relative to the specified customer ID.
### Method
GET
### Endpoint
api/biz/customers/{id}?action=next
### Parameters
#### Path Parameters
- **id** (integer) - Required - The ID of the current customer to find the next one from.
### Response
#### Success Response (200)
Details of the next customer.
#### Response Example
```json
{
"Id": "2",
"OrgNumber": "987654321",
"Info": {
"Name": "Another Company"
}
}
```
```
--------------------------------
### Get List of Available Teams
Source: https://developer.unimicro.no/guide/endpoints/supplier-invoices
Retrieve a list of all available teams to find TeamIDs for approval assignments.
```HTTP
GET: /api/biz/teams
```
--------------------------------
### Get List of Available Users
Source: https://developer.unimicro.no/guide/endpoints/supplier-invoices
Retrieve a list of all available users to find UserIDs for approval assignments.
```HTTP
GET: /api/biz/users
```
--------------------------------
### List Transition Flows
Source: https://developer.unimicro.no/guide/endpoints/flows
Retrieves statistics about TransitionFlows, including information about valid 'To' and 'From' statuses. Ignore entries where IsDepricated is true.
```bash
GET api/statistics?model=TransitionFlow&select=TransitionFlow.*%2C%20ToStatus.Description%2C%20ToStatus.StatusCode%2CFromStatus.Description%2CfromStatus.StatusCode&expand=FromStatus%2C%20ToStatu
```
```json
{
"Data": [
{
"CreatedAt": null,
"EntityType": "User",
"ExpiresDate": null,
"ToStatusID": 9,
"CreatedBy": null,
"FromStatusID": 10,
"UpdatedBy": null,
"IsDepricated": null,
"UpdatedAt": null,
"TransitionID": 1,
"ID": 1,
"ToStatusDescription": "Active",
"ToStatusStatusCode": 110001,
"FromStatusDescription": "Inactive",
"fromStatusStatusCode": 110002
},
{
"CreatedAt": null,
"EntityType": "User",
"ExpiresDate": null,
"ToStatusID": 10,
"CreatedBy": null,
"FromStatusID": 9,
"UpdatedBy": null,
"IsDepricated": null,
"UpdatedAt": null,
"TransitionID": 2,
"ID": 2,
"ToStatusDescription": "Inactive",
"ToStatusStatusCode": 110002,
"FromStatusDescription": "Active",
"fromStatusStatusCode": 110001
}
],
"Success": true
}
```
--------------------------------
### Get PaymentInfoType (KID-type)
Source: https://developer.unimicro.no/guide/endpoints/invoices
Retrieves payment information types, specifically KID-types, which are used for payment references.
```APIDOC
## GET /api/biz/paymentinfotype
### Description
Retrieves a list of payment information types, often referred to as KID-types. This data is essential for setting up correct payment references on invoices.
### Method
GET
### Endpoint
/api/biz/paymentinfotype
### Parameters
#### Query Parameters
- **filter** (string) - Required - Allows filtering payment info types, e.g., `statuscode eq 42400`.
### Response
#### Success Response (200)
- **CustomValues** (object) -
- **Control** (integer) -
- **CreatedAt** (null) -
- **CreatedBy** (null) -
- **Deleted** (boolean) -
- **ID** (integer) -
- **Length** (integer) -
- **Locked** (boolean) -
- **Name** (string) -
- **StatusCode** (integer) -
- **Type** (integer) -
- **UpdatedAt** (null) -
- **UpdatedBy** (null) -
#### Response Example
{
"example": "[
{
\"CustomValues\": {},
\"Control\": 10,
\"CreatedAt\": null,
\"CreatedBy\": null,
\"Deleted\": false,
\"ID\": 5,
\"Length\": 15,
\"Locked\": false,
\"Name\": \"Uni Faktura KID\",
\"StatusCode\": 42400,
\"Type\": 1,
\"UpdatedAt\": null,
\"UpdatedBy\": null
},
{
\"CustomValues\": {},
\"Control\": 10,
\"CreatedAt\": null,
\"CreatedBy\": null,
\"Deleted\": false,
\"ID\": 10,
\"Length\": 16,
\"Locked\": false,
\"Name\": \"SGFinans KID\",
\"StatusCode\": 42400,
\"Type\": 1,
\"UpdatedAt\": null,
\"UpdatedBy\": null
}
]"
}
```