Create product

Verison: 1.0 (read more)

You can omit a lot of the properties in the product object, since a lot of it may not be relevant for most users.

Here are a few examples of acceptable posts.

If you specify a product code that is already taken by other product, the API will return HTTP status code 409 Conflict.

1
POST /products/

Request

A minimal post (unitPrice will default to 0.00)

Valid Norwegian tax rates are available here

1
2
3
4
{
    "code": "myProdCode",
    "taxRate": 25
}

A typical post

1
2
3
4
5
6
{
    "code": "Test product",
    "taxRate": 25,
    "unitPrice": 10.00,
    "description": "Lorem ipsum"
}

A full post

1
2
3
4
5
6
7
8
{
    "code": "Test product",
    "vendorNumber": "Test vendor product",
    "taxRate": 25,
    "unitPrice": 10.00,
    "description": "Lorem ipsum",
    "accountNumber": 3010
}

Response

HTTP/1.1 201 Created

System will automatically generate unique number which can later be used to access the product.

Response contains Location in Header with generated number, e.g.

1

It’s also allowed to post an array of products

1
2
3
4
5
6
7
8
9
10
[
  {
    "code": "myProdCode",
    "taxRate": 25
  },
  {
    "code": "myProdCode",
    "taxRate": 25
  }
]

In this case response code will also be 201 HTTP/1.1 201 Created but links to all created entities will be listed in response body instead of Location header.

1
2
3
4
[
  "https://www.sendregning.no/products/26",
  "https://www.sendregning.no/products/27"
]

Detailed property description

Name Description Required Type Limitation
code Unique product code Yes String 9 characters
taxRate Tax rate in percentage Yes Integer Valid Norwegian tax rate
unitPrice Unit price If not provided it defaults to 0.00 Decimal 2 decimals
description Description   String 75 characters
accountNumber Account number for future bookkeeping functionality, not currently used   Integer  
vendorNumber Vendor number   String 24 characters