External Api v2

OnlinePOS Api v2
https://api.onlinepos.dk/api
Fejlkoder & Beskeder

Gælder for alle kald:

Fejlkoder er i form af http status koder.

403 Forbidden Firmaid og token er ugyldige; betyder at du ikke har tilladelse til kaldet eller hashen ikke er korrekt.

Ved 403 er der typisk en nærmere forklaring for fejen i svarets body. 500 Internal Server Error; betyder der er sket en anden uventet fejl

Gælder for campaign api kald:

Når JSON er valgt som responstype

Ved et successfuldt kald returneres et json objekt med følgende struktur:

content_copy { "status": "Card successfully Activated!" } Hvor status kan enten være en besked om handlingen der blev udført, eller andet forventet svar fra kaldet. Herunder er et eksempel fra campaignList.

content_copy { "status": { "Campaigns": [ { "campaign": { "campaignID": 26, "campaignName": "asd", "free_split": 0, "free_msg": 0, "auto_add": 0, "info_view": 0 } }, ] } Ved et fejlet kald returneres et json objekt med følgende struktur:

content_copy { "ERROR": "Unknown Card - ActivateCard" } Hvor ERROR er en fejbesked samt hvilket kald fejlen er sket ved. I dette eksempel er fejlen sket ved “ActivateCard” kaldet.

Card

API calls for Card functionality

GET /getCardsList/{debtor}/{type}/{offset}
GET /getCards/{offset}
GET /getCard/{cardnumber}
GET /getCardForKoncern/{cardnumber}
POST /addCard
POST /addCards
POST /editCard
POST /deposit
GET /createVoucher
POST /createVoucherFromInterval
Get Cards list by debtor and type
GET /getCardsList/{debtor}/{type}/{offset}

Get card list by debtor and type, return 1000 cards start from offset

Path variables

debtor
string required

Customer’s debtor number

type
string required

The type must be between 1-3

Enumeration:
1

Staff card

2

Prepaid card

3

Giftcard

offset
integer optional

if not set default = 0

Default:
0

Request headers

token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Accept
string optional

To return json use application/json, default return xml

Responses

200 200

OK

Body
application/xml
application/json
Examples

Xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<list>
	<card>
		<id>0</id>
		<name>string</name>
		<phone>string</phone>
		<debtor>string</debtor>
		<cardgroup>string</cardgroup>
		<RFID>string</RFID>
		<cardnumber>string</cardnumber>
		<cardtype>string</cardtype>
		<balance>string</balance>
		<deleted>string</deleted>
	</card>
</list>

Json

[
    {
        "id": 1,
        "name": "",
        "phone": 1,
        "debtor": "",
        "cardgroup": "",
        "RFID": "",
        "cardnumber": "",
        "cardtype": "",
        "balance": "",
        "deleted": ""
    }
]
Get all cards for customer
GET /getCards/{offset}

Return a 1000 cards, start from offset, offset default = 0

Path variables

offset
integer optional

if not set default = 0

Default:
0

Request headers

token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Accept
string optional

To return json use application/json, default return xml

Request body

Sending a body is optional.

When using filters make sure to set the correct content-type (application/json).

Object
filter
Object
mobile
integer

Find only cards with this given phone/mobile number

Example:
70702636

Responses

200 200

OK

Body
application/xml
application/json
Examples

Xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<list>
    <card>
        <id>1</id>
        <name>John Smith</name>
        <phone>88888888</phone>
        <debtor></debtor>
        <cardgroup> Kvartkort </cardgroup>
        <RFID></RFID>
        <cardnumber>090000100000000</cardnumber>
        <cardtype>Default</cardtype>
        <balance>100,00</balance>
        <deleted>yes</deleted>
    </card>
    <card>
        <id>2</id>
        <name>John Smith</name>
        <phone>88888888</phone>
        <debtor></debtor>
        <cardgroup>Personale</cardgroup>
        <RFID></RFID>
        <cardnumber>9000010000</cardnumber>
        <cardtype>Default</cardtype>
        <balance>100,00</balance>
        <deleted>no</deleted>
    </card>
</list>

Json

[
    {
        "id": 1,
        "name": "",
        "phone": 1,
        "email": "",
        "birthday": 19950101,
        "debtor": "",
        "discount": "20",
        "cardgroup": "",
        "RFID": "",
        "cardnumber": "",
        "cardtype": "",
        "balance": "",
        "deleted": ""
    }
]
Get a card by it's cardnumber
GET /getCard/{cardnumber}

Get card info from card number

Path variables

cardnumber
string required

The card number

Request headers

token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Accept
string optional

To return json use application/json, default return xml

Responses

200 200

OK

Body
application/xml
application/json
Examples

Xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<list>
    <card>
        <id>1</id>
        <name>John Smith</name>
        <phone>88888888</phone>
        <debtor></debtor>
        <cardgroup> Kvartkort </cardgroup>
        <RFID></RFID>
        <cardnumber>090000100000000</cardnumber>
        <cardtype>Default</cardtype>
        <balance>100,00</balance>
        <deleted>yes</deleted>
    </card>
</list>

Json

[
    {
        "id": 1,
        "name": "",
        "phone": 1,
        "debtor": "",
        "cardgroup": "",
        "RFID": "",
        "cardnumber": "",
        "cardtype": "",
        "balance": "",
        "deleted": ""
    }
]
Get a card by it's cardnumber for koncern
GET /getCardForKoncern/{cardnumber}

Get info for a card on koncern level

Path variables

cardnumber
string required

The card number

Request headers

token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Responses

200 200

OK

Body
application/xml
application/json
Object
id
string

The card id

name
string

The card name

phone
string

The card holders phone

debtor
string
pinkode
string

The card pin code

cardgroup
string

The card group

RFID
string

The cards RFID if it has one

cardnumber
string

The card number

cardtype
string

The type of card

balance
string

The balance on the card if it has one

Examples

Xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<card>
	<id>0</id>
	<name>string</name>
	<phone>string</phone>
	<debtor>string</debtor>
	<pinkode>string</pinkode>
	<cardgroup>string</cardgroup>
	<RFID>string</RFID>
	<cardnumber>string</cardnumber>
	<cardtype>string</cardtype>
	<balance>string</balance>
</card>

Json

{
    "id": "",
    "name": "",
    "phone": "",
    "debtor": "",
    "pinkode": "",
    "cardgroup": "",
    "RFID": "",
    "cardnumber": "",
    "cardtype": "",
    "balance": ""
}
Create a new card
POST /addCard

Create a new staffcard, pre-pay card or giftcard.

Request headers

token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Request body

application/x-www-form-urlencoded
Object
hash
string required

HMAC hash of the request values Read more

type
integer required

The card type, 1 = standard card, 2 = prepaid card, 3 = giftcard

name
string

The new card name

phone
string

The new card phone number

debtor
string

The new card debtor number. (Must be unique)

rfid
string

RFID for the card

eksnr
integer

Ekspedient number. (Must be unique)

allow_manual_input
integer

0 or 1, if 1 use cardnumber as pnr

use_debtor_input
integer

0 or 1, if 1 use debtor as pnr

group
string

The name of the group the card should belong to. A new group will be created if the name does not exist.

Example:
Personale
pin_code
string

Only relevant if Staff Card. (Must be 6 digits or less)

Example:
123456
price_group
integer

The id of the price group the card will order products from

discount
integer

The discount of the card in percentage.

Example:
25
email
string

The cardholders email address

birthday
string

The cardholders birthdate (formatted as yyyymmdd)

Example:
19991205
block_card_payment
integer

Block the card for being use for payment. 1 to block card and 0 to not block. Default is 0

Example:
1

Responses

200 200

OK

Body
application/xml
Object
Examples

Successfull response returns the cardnumber.

<?xml version="1.0" encoding="ISO-8859-1"?>
<cardnumber> 1234567890 </cardnumber>

Unsuccessfull response returns a fail with a message.

<?xml version="1.0" encoding="ISO-8859-1"?>
<fail> eksnr is not unique! </fail>
Example
POST https://api.onlinepos.dk/api/addCard HTTP/1.1 

token: <company token>
firmaid: <company id>
Content-Type: application/x-www-form-urlencoded

hash=
&type=1
&name=
&phone=
&debtor=
&rfid=
&eksnr=1
&allow_manual_input=1
&use_debtor_input=1
&group=
&pin_code=
&price_group=1
&discount=25
&email=
&birthday=19991205
Create new cards
POST /addCards

Add multiable cards at onec. Max 1000 at a time.

Request headers

token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Accept
string optional

For json response use application/json

Example:
application/json

Request body

Object
cards
Array

List of card to make

Object
hash
string required

HMAC hash of the request values Read more

Example:
nvsdajknbvijodsafbha
type
integer required

The card type, 1 = standard card, 2 = prepaid card, 3 = giftcard

Example:
3
name
string

The new card name

Example:
TestCard
phone
string

The new card phone number

Example:
88888888
debtor
string

The new card debtor number. (Must be unique)

Example:
09090
rfid
string

RFID for the card, if set it will be the cardnumber of the card to

Example:
90003000010
eksnr
string

Only relevant if standard card(type 1). Ekspedient number. (Must be unique)

Example:
1
allow_manual_input
integer

0 or 1, if 1 use cardnumber as pnr

Example:
1
use_debtor_input
integer

0 or 1, if 1 use debtor as pnr

Example:
1
group
string

The name of the group the card should belong to. A new group will be created if the name does not exist.

Example:
1
pin_code
string

Only relevant if standard card (type 1). (Must be 6 digits or less)

Example:
1234
price_group
integer

The id of the price group the card will order products from

Example:
1
discount
integer

The discount of the card in percentage.

Example:
25
email
string

The cardholders email address

Example:
test@onlinepos.dk
birthday
integer

The cardholders birthdate (formatted as yyyymmdd)

Example:
19810220
block_card_payment
integer

Block the card for being use for payment. 1 to block card and 0 to not block. Default is 0

Example:
1
Examples
{
    "cards": [
        {
            "hash": "nvsdajknbvijodsafbha",
            "type": 3,
            "name": "TestCard",
            "phone": "88888888",
            "debtor": "09090",
            "rfid": "90003000010",
            "eksnr": "1",
            "allow_manual_input": 1,
            "use_debtor_input": 1,
            "group": "1",
            "pin_code": "1234",
            "price_group": 1,
            "discount": 25,
            "email": "test@onlinepos.dk",
            "birthday": 19810220,
            "block_card_payment": 1
        }
    ]
}

Responses

200 OK
Body
Array
Object
status
string
Example:
fail
error
string
Example:
RFID is not unique!
name
string
Example:
BulkTestP0
rfid
string
Example:
90000
cardNumber
string
Examples

Response when JSON is valid cardNumber is empty on fail. Name and rfid is empty when not send with in request

[
    {
        "status": "fail",
        "error": "RFID is not unique!",
        "name": "BulkTestP0",
        "rfid": "90000",
        "cardNumber": ""
    },
    {
        "status": "success",
        "error": "",
        "name": "BulkTestP1",
        "rfid": "900030001",
        "cardNumber": "900030001"
    }
]

Response when json is invalid The number tells what part of the JSON is invalid So cards.0.hash is the hash in the first card in the cards list

{
    "status": "ERROR",
    "error": "The cards.0.hash field is required."
}
Edit an existing card
POST /editCard

Edit an existing card

Request headers

token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Request body

application/x-www-form-urlencoded
Object
hash
string required

HMAC hash of the request values Read more

cardnumber
string required

The carnumber of desired card you want to modify

Example:
1234567890
name
string

The new name for card

phone
string

The new phone number for card

debtor
string

The new debtor number for card

rfid
string

The new RFID for card

group
string

The id of the group the card should be moved to.

delete
string

Set true if you want to delete card

Example:
"true"
email
string

The cardholders email address

birthday
string

The cardholders birthdate (formatted as yyyymmdd)

Example:
19991208
discount
integer

The discount of the card in percentage.

Example:
25
Examples

Responses

200 OK
Body
application/xml
Object
Examples

Successfull response returns a status message

<?xml version="1.0" encoding="ISO-8859-1"?>
<status> Card 1234567890 successfully updated! </status>

Unsuccessfull response returns a fail with a message

<?xml version="1.0" encoding="ISO-8859-1"?>
<fail> Unknown cardnumber - edit </fail>
Example
POST https://api.onlinepos.dk/api/editCard HTTP/1.1 

token: <company token>
firmaid: <company id>
Content-Type: application/x-www-form-urlencoded

hash=
&cardnumber=1234567890
&name=
&phone=
&debtor=
&rfid=
&group=
&delete=
&email=
&birthday=19991205
Deposit to a card
POST /deposit

Deposit to a card

Request headers

token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Request body

application/x-www-form-urlencoded
Object
hash
string required

HMAC hash of the request values Read more

cardnumber
string required

The card number

Example:
1234567890
amount
integer required

The amount you want to deposit

Example:
10
overwrite_balance
boolean

Use this parameter to set the cards balance to amount. Default behaviour the balance is modified by amount.

Example:
true

Responses

200 200

OK

Body
application/xml
Object
Examples

Successfull response returns a status with the new balance

<?xml version="1.0" encoding="ISO-8859-1"?>
<status> New balance: XX.XX </status>

Unsuccessfull response returns a fail with a message

<?xml version="1.0" encoding="ISO-8859-1"?>
<fail> Unknown cardnumber: 1234567890 - Deposit </fail>
Example 1
POST https://api.onlinepos.dk/api/deposit HTTP/1.1 

token: <company token>
firmaid: <company id>
Content-Type: application/x-www-form-urlencoded

hash=
&cardnumber=1234567890
&amount=10
&overwrite_balance=true
Create Voucher
GET /createVoucher

Create a new voucher

Request headers

token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Accept
string optional

For json response use application/json

Example:
application/json

Request body

application/x-www-form-urlencoded
Object
hash
string

Hash of the data

name
string

Name of the new voucher

voucherno
string required

Voucher number, must be unique

campaignid
string required

Id of the campaign the voucher is associated with

start_date
string required

Date the voucher is valid from. Following the format YYYYMMDD

Example:
20200802 (Aug. 02nd 2020)
end_date
string required

Date the voucher is valid to. Following the format YYYYMMDD

Example:
20200802 (Aug. 02nd 2020)

Responses

200 OK JSON

When using JSON response

Body
Object
Examples

Successful operation

{
    "status": "Voucher created",
    "cardnumber": "1000000007"
}

Failed operation

{
    "ERROR": "voucherno is not unique!"
}
200 OK
Body
application/xml
string
Examples

Successfull operation

<?xml version="1.0" encoding="ISO-8859-1"?> <cardnumber> 1234567890 </cardnumber>

Failed operation

<?xml version="1.0" encoding="ISO-8859-1"?> <fail> voucherno is not unique! </fail>
403 Forbidden

Incorrect credentials, privledges or hash.

500 Internal Server Error
Create Voucher From Interval
POST /createVoucherFromInterval

Api call to create voucher from a interval of card numbers

Request headers

token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Accept
string optional

For json response use application/json

Example:
application/json

Request body

application/json;charset=UTF-8
Object
hash
string required

Hash of the data. Data order: token, firmaid, voucherNoFrom, voucherNoTo, name, campaignid, points, startDate and endDate. Read more

Example:
Test
voucherNoFrom
string

Start card number for voucher

Example:
1550000
voucherNoTo
string

End card number for voucher

Example:
1550005
points
integer required

Amount of points on voucher/card

Example:
10
campaignid
integer required

Id of campaign the voucher/card is part of

Example:
26
name
string

Name of the voucher/card. Default is Gavekort

Example:
Test
startDate
integer

Start date for voucher/card to be active if the is one. Format is YYYYMMDD

Example:
20210304
endDate
integer

End date for voucher/card to be active if the is one. Format is YYYYMMDD

Example:
20210304
Examples

Example of json body

{
    "hash": "Test",
    "voucherNoFrom": "10000",
    "voucherNoTo": "15000",
    "points": 10,
    "campaignid": 26,
    "name": "Test",
    "startDate": 20210304,
    "endDate": 20210304
}

Responses

200 OK
Body
Object
status
string required

Status of call can be Vouchers created or ERROR

Example:
Vouchers created
error
string

Error message, error is only the if status is ERROR

Example:
Hash Not Matching!
Examples

On Error

{
    "status": "ERROR",
    "error": "Hash Not Matching!"
}

On Succes

{
    "status": "Vouchers created"
}
Card For List

Schema for card list

Array
Object
id
integer

Card id

name
string

Card holders name

phone
integer

Card holders phone

email
string

The cardholders email

birthday
integer

The cardholders birthday. Format YYYYMMDD

Example:
19950101
debtor
string
discount
string

The discount on the card, as a percentage.

Example:
20
cardgroup
string

The card group

RFID
string

The RAID for the card, if the card have one

cardnumber
string

The card number

cardtype
string

The type of the card

balance
string

The balance on the card, if the card has one

deleted
string

Return yes if the card is close else return no

Product

API calls for Product functionality

GET /getProducts
POST /addProduct
Get products
GET /getProducts

Get products

Request headers

token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Accept
string optional

For json response use application/json

Example:
application/json

Responses

200 200

OK

Body
application/xml
application/json
Array
Object
ID
integer

The product id

name
string

The product name

groupid
string

The product group id

groupname
string

The product group name

price_1
string

Price 1

price_2
string

Price 2

price_3
string

Price 3

price_4
string

Price 4

price_5
string

Price 5

cost_price
string

The cost price

standard_price
string

The standard price

categories
Array

list of categories the product appears in

Object
category_id
string

the id of the category

category_name
string

the name of the category

additional_price_groups
Object

array of pricegroups indexed by their group number

group_number
Object

individual group number for each pricegroup

price
string
Example:
6
name
string
Example:
5th
Examples

JSON Response

[
    {
        "ID": 1,
        "name": "",
        "groupid": "",
        "groupname": "",
        "price_1": "",
        "price_2": "",
        "price_3": "",
        "price_4": "",
        "price_5": "",
        "cost_price": "",
        "standard_price": "",
        "categories": [
            {
                "category_id": "",
                "category_name": ""
            }
        ],
        "additional_price_groups": {
            "6": {
                "price": "25",
                "name": "middag"
            }
            "8": {
                "price": "60",
                "name": "aften"
            }
        }
    }
]

XML Response

<?xml version="1.0" encoding="ISO-8859-1"?>
<list>
	<products>
		<product id="0">
		</product>
		<product_group id="0">
		</product_group>
		<price price_1="string" price_2="string" price_3="string" price_4="string" price_5="string">
		</price>
		<indkbspris>string</indkbspris>
        <categories>
            <category id="123" name="category_1" />
            <category id="456" name="category_1" />
        </categories>
        <additional_price_groups>
            <price_group id="6" price="25" name="middag" />
            <price_group id="8" price="60" name="aften" />
        </additional_price_groups>
		<normalpris>string</normalpris>
	</products>
</list>
New product
POST /addProduct

Create a new product

Request headers

token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Request body

application/x-www-form-urlencoded
Object
hash
string required

HMAC hash of the request values Read more

productname
string required

The produkt name

Pattern: Faxe Kondi 33cl
productgroup
string required

The name of the product group the product should belong to. A new group will be created if the name does not exsist.

Example:
Sodavand
price
integer

The price of the produkt

Example:
15
costprice
integer

The cost price of the product

Example:
6

Responses

200 OK
Body
application/xml
Object
Examples

Successfull response returns a status message

<?xml version="1.0" encoding="ISO-8859-1"?>
<status> Product 123456 created </status>

Unsuccessfull response returns a fail with a message

<?xml version="1.0" encoding="ISO-8859-1"?>
<fail> No product name </fail>
Example 1
POST https://api.onlinepos.dk/api/addProduct HTTP/1.1 

token: <company token>
firmaid: <company id>
Content-Type: application/x-www-form-urlencoded

hash=
&productname=
&productgroup=Sodavand
&price=15
&costprice=6
Sales

API calls for Sales functionality

GET /debtorExportSales/{from}/{to}
GET /getByUnixTimeSales/{from}/{to}
List debtor sales
GET /debtorExportSales/{from}/{to}

Get list of debtor sales

Path variables

from
string required

Start of the period in unix time

to
string required

End of the period in unix time

Request headers

token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Responses

200 OK
application/xml
List of sales
GET /getByUnixTimeSales/{from}/{to}

There can be multiple locations

Path variables

from
string required

Start of the period in unix time

to
string required

End of the period in unix time

Request headers

token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Accept
string optional

For json response use application/json

Example:
application/json

Responses

200 OK
Body
application/json
application/xml
Object
period
string

2016.01.01 00:00:00 - 2018.07.24 00:00:00

location
Array
Object
userid
integer
amount
number
pax
string
Examples

Xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<XML>
	<period>string</period>
	<location>
		<userId>1</userId>
		<amount>2</amount>
		<pax>2</pax>
	</location>
</XML>

Json

{
    "period": "2016.01.01 00:00:00 - 2018.07.24 00:00:00",
    "location": [
        {
            "userid": 1,
            "amount": 1.1,
            "pax": "0"
        }
    ]
}
List sales from department or cardnumber
POST /exportSales

Get list of sales for a specific department or cardnumber

Request headers

token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Accept
string optional

For json response use application/json

Example:
application/json

Request body

application/x-www-form-urlencoded

Unix time

Unix time represents the seconds passed since Jan 01 1997.


Using unix time

Most programming languages have built in functions for converting a date to unix time.

You can also use an online tool like unixtimestamp.com

Object
from
string required

Start of the period in unix time

Example:
1597141149
to
string required

End of the period in unix time

Example:
1597100000
department
string

Get all sales from a specific terminal or group of terminals. Department is the name of the terminal(s)

Example:
kasse 1
cardnumber
integer

Get all sales from a specific cardnumber

Example:
1234567890
map_to_koncern
boolean

Whether to map product- and group-ids to the koncern ids

Default:
false

Responses

200 OK

Response in JSON

Body
application/json
Object
sales
Array
Object
line
Object
id
integer
chk
integer
date
string

dd.mm.yyyy

time
string

hh:mm

product_id
integer

If map_to_koncern is enabled this will show the id from the koncern

product
string
product_group_id
integer

If map_to_koncern is enabled this will show the id from the koncern

product_group
string
amount
integer
price
string
payment_type
string

The method of payment for the sale.

clerk
string
pax
integer

Number of guests involved with the sale.

department
string

The terminal or group of terminals a sale was made from.

ean_1
string

Product id

ean_2
string

Manufacturer product id

ean_3
string
ean_4
string
Examples

Successfull response returns an array of lines representing individual sales

{
    "sales": [
        {
            "line": {
                "id": 1,
                "chk": 1,
                "date": "15.03.2016",
                "time": "17:00",
                "product_id": 1,
                "product": "",
                "product_group_id": 1,
                "product_group": "",
                "amount": 1,
                "price": "10,00",
                "payment_type": "",
                "clerk": "",
                "pax": 1,
                "department": "",
                "ean_1": "",
                "ean_2": "",
                "ean_3": "",
                "ean_4": ""
            }
        }
    ]
}

Unsuccessfull response returns an error key with a message

{
    "error": "Input fail!"
}
200 OK

Response in XML (Default)

application/xml
Example 1
POST https://api.onlinepos.dk/api/exportSales HTTP/1.1 

token: <company token>
firmaid: <company id>
Content-Type: application/x-www-form-urlencoded
Accept: application/json

from=1597141149
&to=1597100000
&department=kasse 1
&cardnumber=1234567890
Webshop

API calls for Webshop functionality

Get list of stock products info
GET /stock

Returns an array of info about stock products

Request headers

token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Accept
string optional

For json response use application/json

Example:
application/json

Responses

200 OK

Ok

Body
application/json
application/xml
Object
info
Array
Object
info
Object
ean
string
stock
string
ean_2
string
ean_3
string
ean_4
string
Examples

Json

{
    "info": [
        {
            "info": {
                "ean": "",
                "stock": "",
                "ean_2": "",
                "ean_3": "",
                "ean_4": ""
            }
        }
    ]
}

Xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<info>
	<info>
		<ean>string</ean>
		<stock>0</stock>
		<ean_2>string</ean_2>
		<ean_3>string</ean_3>
		<ean_4>string</ean_4>
	</info>
</info>
200 OK

Error

Body
application/xml
Object
info
Object
type
string
num
integer
text
string
Examples

Xml

<?xml version="1.0" encoding="utf-8"?>
<info>
    <info>
        <type>1</type>
        <num>5</num>
        <text>No location</text>
    </info>
</info>

Json

{
    "info": {
        "type": "",
        "num": 1,
        "text": ""
    }
}
Get stock amount from ean
POST /stockFromEan

This call can be used to see how many of a product is in stock, by it’s ean number.

Request headers

token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Accept
string optional

For json response use application/json

Example:
application/json

Request body

application/x-www-form-urlencoded
Object
ean
string required

The ean as comma separated string or a single ean.

Example:
52929,589954,84957

Responses

200 OK

Response in JSON

Body
application/json
application/xml
Object
info
Array
Object
info
Object
ean
string
stock
string
Examples

Successfull response returns an array of ean/stocks pairs for each ean number given

{
    "info": [
        {
            "info": {
                "ean": "",
                "stock": ""
            }
        }
    ]
}
Example
POST https://api.onlinepos.dk/api/stockFromEan HTTP/1.1 

token: <company token>
firmaid: <company id>
Content-Type: application/x-www-form-urlencoded
Accept: application/json

ean=52929,589954,84957
Update stock products amount
POST /updateStock

Update the stock of a product. This could be in the event of selling a product, a product being returned, etc.

Request headers

token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Accept
string optional

For json response use application/json

Example:
application/json

Request body

application/x-www-form-urlencoded
Object
hash
string required

The hash of the data

ean
string required

The ean of the product to update the stock on.

Example:
0001234567890
amount
string required

The amount to alter the stock by. Should always be positive. Use the type to control if the stock should be descreased or increased.

Example:
3
type
string required

The type of the operation, such as a Sale or a Return.

Enumeration:
2

Sale (decrease stock)

3

Return (increase stock)

Example:
2
orderno
string required

The orderno of the order which caused this stock update.

Example:
123456

Responses

200 OK

Successfull update

Body
application/xml
Object
info
Object
reply
string

OK

Examples

Xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<info>
	<info>
		<reply>OK</reply>
	</info>
</info>

Json

{
    "info": {
        "reply": "OK"
    }
}
200 NOT OK

Error

Body
application/xml
application/json
Object
info
Object
type
string
num
integer

Error code

Enumeration:
1

The product (ean) does not exsist.

2

Incorrect update type. Must be 1 (Sale) or 2 (Return).

3

No amount specified.

4

No orderno specified.

5

No webshop stock location availible.

text
string

Description of the error.

Examples

Json

{
    "info": {
        "type": "",
        "num": 1,
        "text": ""
    }
}

Xml

<?xml version="1.0" encoding="UTF-8"?>
<info>
	<info>
		<type>0</type>
		<num>0</num>
		<text>string</text>
	</info>
</info>
Example 1
POST https://api.onlinepos.dk/api/updateStock HTTP/1.1 

token: <company token>
firmaid: <company id>
Content-Type: application/x-www-form-urlencoded

hash=
&ean=0001234567890
&amount=3
&type=2
&orderno=123456
Koncern

API calls for Koncern functionality

POST /exportKoncern
GET /getByUnixTimeKoncern/{form}/{to}
GET /koncern/koncernInfo
GET /koncern/clerkInfo
Get list of sales
POST /exportKoncern

Get list of sales for koncern. The response will return 1000 lines.

Request headers

token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Request body

application/x-www-form-urlencoded

Unix time

Unix time represents the seconds passed since Jan 01 1997.


Using unix time

Most programming languages have built in functions for converting a date to unix time.

You can also use an online tool like unixtimestamp.com.

Object
from
string required

Start of the period in unix time

Example:
1597141149
to
string required

End of the period in unix time

Example:
1597100000
cardnumber
string

Get all sales from a specific cardnumber

Example:
1234567890
offset
integer

And offset for sales, where the 1000 lines start from.

Default:
0
lokation
string

The id of a specific location in the koncern

department
string

Get all sales from a specific terminal or group of terminals. Department is the name of the terminal(s)

Example:
kasse 1

Responses

200 OK

Success

Body
application/json
Object
sales
Array
Object
line
Object
id
string
firma_id
integer
chk
string

Orderno.

date
string
time
string
product_id
integer
product
string
product_group_id
integer
product_group
string
amount
integer
price
string
payment_type
string

The method of payment for the sale.

clerk
string
pax
string

Number of guests involved with the sale.

department
string

The terminal or group of terminals a sale was made from.

ean_1
string

Product id

ean_2
string

Manufacturer product id

ean_3
string
ean_4
string
debtor
string
Examples

Successfull response returns an array of lines representing individual sales

{
    "sales": [
        {
            "line": {
                "id": 1,
                "chk": 1,
                "date": "15.03.2016",
                "time": "17:00",
                "product_id": 1,
                "product": "",
                "product_group_id": 1,
                "product_group": "",
                "amount": 1,
                "price": "10,00",
                "payment_type": "",
                "clerk": "",
                "pax": 1,
                "department": "",
                "ean_1": "",
                "ean_2": "",
                "ean_3": "",
                "ean_4": ""
            }
        }
    ]
}
200 OK

Error

application/xml
Example 1
POST https://api.onlinepos.dk/api/exportKoncern HTTP/1.1 

token: <company token>
firmaid: <company id>
Content-Type: application/x-www-form-urlencoded

from=1597141149
&to=1597100000
&cardnumber=1234567890
&offset=1
&location=
&department=kasse 1
Get list of sales by unix time
GET /getByUnixTimeKoncern/{form}/{to}

There can be multiple locations

Path variables

form
string required

Start of the period in unix time

to
string required

End of the period in unix time

Request headers

token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Responses

200 OK
Body
application/xml
Object
XML
Object
period
string
location
Object
userId
integer
amount
integer
pax
string
Examples

Xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<XML>
	<period>string</period>
	<location>
		<customerId>0</customerId>
		<amount>0</amount>
		<pax>string</pax>
	</location>
</XML>
List Koncern Locations
GET /koncern/koncernInfo

List all locations and departments under a koncern

Request headers

token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Accept
string optional

For json response use application/json

Example:
application/json

Responses

200 OK
Body
Object
lokations
Array
Object
firmaid
integer
Example:
2
name
string
Example:
OnlinePOS Café
address
string
Example:
Brødregade 1
city
string
Example:
Randers C
postnumber
string
Example:
8900
active
integer
Example:
1
country
string
Example:
Danmark
departments
Array
Object
departmentID
integer
Example:
3
departmentName
string
Example:
Bar 1
departmentActive
integer
Example:
1
lastJournal
integer
Example:
6
parent_firmaid
integer
Example:
2
Examples

JSON Response

{
    "lokations": [
        {
            "firmaid": 2,
            "name": "OnlinePOS Café",
            "address": "Brødregade 1",
            "city": "Randers C",
            "postnumber": "8900",
            "active": 1,
            "country": "Danmark",
            "departments": [
                {
                    "departmentID": 3,
                    "departmentName": "Bar 1",
                    "departmentActive": 1,
                    "lastJournal": 6,
                    "parent_firmaid": 2
                }
            ]
        }
    ]
}

XML Response

<?xml version="1.0" encoding="ISO-8859-1"?>
<lokations>
    <lokation>
        <firmaid>2</firmaid>
        <name>OnlinePOS Café</name>
        <address>Brødregade 1</address>
        <city>Randers C</city>
        <postnumber>8900</postnumber>
        <country>Danmark</country>
        <active>1</active>
        <departments>
            <department>
                <departmentID>3</departmentID>
                <departmentName>Bar 1</departmentName>
                <departmentActive>1</departmentActive>
                <lastJournal>6</lastJournal>
                <parent_firmaid>2</parent_firmaid>
            </department>
    </lokation>
</locations>
List koncern clerks
GET /koncern/clerkInfo
token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Accept
string optional

For json response use application/json

Example:
application/json
Product

Product schema

Object
id
integer

Product id

Example:
123456
name
string

Product name

Example:
Beer
price
string

Product price

Example:
100
soldout
integer

1 if product is soldout else 0

Example:
0
multi
integer

1 if product is a multi product else 0

description
string

Product description

Example:
Cold beer
type
string

item type

Example:
product
max
integer

if msg product, maximum pick

Example:
0
min
integer

if msg product, minmum pick

options
Array

if product is msg or multi, the options on the product

Object
id
integer

Product id

Example:
578234
name
string

Product name

Example:
Thousand Island Dressing
soldout
integer

1 if product is soldout else 0

price
string

Product price

Example:
0
multi
integer

1 if product is a multi product else 0

default
integer

Default product

max
integer

if msg product, maximum pick

min
integer

if msg product, minmum pick

type
string

item type

Example:
product
description
string

Product description

options
Array

keep going down array of this object

Object
Taw

Taw api

GET /taw/products
GET /taw/shops
GET /taw/timeslots/(date)
POST /taw/makeOrdre
Products
GET /taw/products

Api call to get taw products

Request headers

token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Responses

200 OK
Body
application/json
Object
groups
Array
Object
id
integer

Group id

Example:
1
name
string

Group name

Example:
beers
description
string

Group description

Example:
cold
products
Array of Product

Array of products in group

Examples

json

{
    "groups": [
        {
            "id": 1,
            "name": "beers",
            "description": "cold",
            "products": [
                {
                    "id": 123456,
                    "name": "Beer",
                    "price": "100",
                    "soldout": 1,
                    "multi": 1,
                    "description": "Cold beer",
                    "type": "product",
                    "max": 1,
                    "min": 1,
                    "options": [
                        {
                            "id": 578234,
                            "name": "Thousand Island Dressing",
                            "soldout": 1,
                            "price": "0",
                            "multi": 1,
                            "default": 1,
                            "max": 1,
                            "min": 1,
                            "type": "product",
                            "description": "",
                            "options": [
                                {}
                            ]
                        }
                    ]
                }
            ]
        }
    ]
}
Shops
GET /taw/shops

Api call to get shops

Request headers

token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Responses

200 OK
Body
Object
shops
Array

Array of shops

Object
id
integer

shop id

Example:
1
name
string

shop name

Example:
OnlinePOS
address
string

The address of the shop

postcode
string

The postcode for the shop

Example:
8920
city
string

The city the shop is in

Example:
Randers
Examples

json

{
    "shops": [
        {
            "id": 1,
            "name": "OnlinePOS",
            "address": "",
            "postcode": "8920",
            "city": "Randers"
        }
    ]
}
Timeslots
GET /taw/timeslots/(date)

Api call to get timeslots

Request parameters

date
integer optional

if date is not in the url it will use the current date. format yyyymmdd

Example:
20190911

Request headers

token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Responses

200 OK
Body
application/json
Object
date
string

The date for the timeslots. format yyyymmdd

Example:
20190910
timeslots
Array of string

Array of timeslots

Example:
["00:00", ...]
Examples

json

{
    "date": "20190910",
    "timeslots": [
        ""
    ]
}
Make Ordre
POST /taw/makeOrdre

Api call to make an ordre, If new use External order make order

Request headers

token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Request body

multipart/form-data
Object
name
string required

name of the customer

Example:
Simon
phone
string required

phone number of the customer

Example:
88888888
email
string required

email of the customer

Example:
info@onlinepos.dk
cart
string required

the cart of product for the order (price is total for line)

Example:
{"cart":[{ "productId":"74631", "amount":"1", "price":"50", "indent":"0" }]}
pickup_time
string required

Time for the ordre. format hh:mm

Example:
10:00
pickup_date
string

Date for the ordre. format yyyymmdd. if not set use current day

Example:
20190910
note
string

Note for the kitchen

Example:
no nuts
pax
integer

Number of people on the ordre

Example:
0
kds_time
string

The time when the order should be sent to the kitchen. Format: hh:mm

Example:
10:00
shopId
integer

If the ordre is for another company the the firmaid from the header set shopId

Example:
1
forDelivery
string

if 1 the ordre is mark as an delivery ordre else 0. not set = 0

Example:
0
delivery_time
string

Time for when ordre is at customer. format hh:mm

Example:
10:00
address
string

Address for delivery Required if forDelivery = 1

Example:
Denmark st
postcode
integer

Zipcode for delivery Required if forDelivery = 1

Example:
8920
city
string

City for delivery Required if forDelivery = 1

Example:
Randers
paid
integer

Set 1 if order is paid. if property is not set it equal 0 (not paid)

Example:
1

Responses

201 Created
Body
Object
status
string

OK

Example:
OK
ordernumber
string

The number of the ordre

Example:
123
Examples

JSON

{
    "status": "OK",
    "ordernumber": "123"
}
200 OK
Body
application/json
Object
error
string

Error message

Example:
Email empty
Examples

JSON

{
    "error": "Email empty"
}
Example 1
POST https://api.onlinepos.dk/api/taw/makeOrdre HTTP/1.1 

token: <company token>
firmaid: <company id>
Content-Type: multipart/form-data

name=Simon
&phone=88888888
&email=info@onlinepos.dk
&cart={"cart":[{ "productId":"74631", "amount":"1", "price":"50", "indent":"0" }]}
&pickup_time=10:00
&pickup_date=20190910
&note=no nuts
&pax=1
&kds_time=10:00
&shopId=1
&forDelivery=0
&delivery_time=10:00
&address=Denmark st
&postcode=8920
&city=Randers
&paid=1
External order
POST /external/makeorder
Make order
POST /external/makeorder

Call to make an order.

Request headers

token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Accept
string optional

For json response use application/json

Example:
application/json

Request body

Object
name
string required

The name of the person who order

Example:
Python Test
phone
string required

The phone number of the person who order

Example:
88888885
email
string required

The email of the person who order

Example:
sn@onlinepos.dk
pickupTime
string required

The time the order is ready for pickup. format hh:mm 24h (23:59)

Example:
10:00
priceChecksum
string required

The total sum of the cart. Used to verify the price is as expected.

Example:
50
amountChecksum
integer required

The total amount of lines in the cart. Used to verify the amount is as expected.

Example:
1
forDelivery
integer

0 = not a delivery order, 1 = an delivery order. if not set defaults to 0

Example:
0
address
string

The address for delivery. Is required if forDelivery = 1

Example:
testvej 1
zipCode
integer

The zip code for delivery. Is required if forDelivery = 1

Example:
8920
city
string

The city for delivery. Is required if forDelivery = 1

Example:
Randers
deliveryTime
string

This is the time the order is at the customer. format hh:mm 24h (23:59). Is required if forDelivery = 1

Example:
10:00
pax
integer

Number of people on the order

Example:
1
pickupDate
integer

The date for the order. format yyyymmdd

Example:
20200224
paid
integer

If the ordre is already paid = 1, if the order is not paid = 0. if not set default to 0

Example:
1
type
integer

The type of the order, taw = 1, kiosk = 2, app = 3. if not set default to 1

Example:
1
cart
Array required

The cart

Object
productId
integer

The product id

Example:
235931
indentation
integer

The indentation of the line

Example:
0
amount
integer

The amount on the line

Example:
1
price
integer

The total price of the line

Example:
50
lineOption
integer
shopId
integer

Shop id, is used to send an order to another company then the firmaid from the header

Example:
9000
displayOrderNo
string

Use this to set another customer ordernumber on the kds screen

Example:
5000
note
string

Note from person that made the order

Example:
No peanuts
kdsTime
string

The time when the order should be sent to the kitchen. Format: hh:mm

Example:
10:00
Examples

json

{
    "name": "Python Test",
    "phone": "88888885",
    "email": "sn@onlinepos.dk",
    "pickupTime": "10:00",
    "priceChecksum": "50",
    "amountChecksum": 1,
    "forDelivery": 1,
    "address": "testvej 1",
    "zipCode": 8920,
    "city": "Randers",
    "deliveryTime": "10:00",
    "pax": 1,
    "pickupDate": 20200224,
    "paid": 1,
    "type": 1,
    "cart": [
        {
            "productId": 235931,
            "indentation": 1,
            "amount": 1,
            "price": 50,
            "lineOption": 1
        }
    ],
    "shopId": 9000,
    "displayOrderNo": "5000",
    "note": "No peanuts",
    "kdsTime": "10:00"
}

Responses

200 OK
Body
Object
status
string

The status of the order if succes = OK on error = ERROR

Example:
OK
ordernumber
string

The number the order have be given. Only here if make order is success

Example:
1000
error
string

The error msg. Only here if make order failed

Example:
The cart field is required
Examples

json

{
    "status": "OK",
    "ordernumber": "1000",
    "error": "The cart field is required"
}
200 _
application/xml
Example 1
POST https://api.onlinepos.dk/api/external/makeorder HTTP/1.1 

token: <company token>
firmaid: <company id>
Content-Type: application/json

{
    "name": "Python Test",
    "phone": "88888885",
    "email": "sn@onlinepos.dk",
    "pickupTime": "10:00",
    "priceChecksum": "50",
    "amountChecksum": 1,
    "forDelivery": 1,
    "address": "testvej 1",
    "zipCode": 8920,
    "city": "Randers",
    "deliveryTime": "10:00",
    "pax": 1,
    "pickupDate": 20200224,
    "paid": 1,
    "type": 1,
    "cart": [
        {
            "productId": 235931,
            "indentation": 1,
            "amount": 1,
            "price": 50,
            "lineOption": 1
        }
    ],
    "shopId": 9000,
    "displayOrderNo": "5000",
    "note": "No peanuts",
    "kdsTime": "10:00"
}
Hash

Some api calls require a hash. The hash is all the data in the request body hashed using the hmac hash function together with a key. Contact support to get a key.

Object
Campaign
POST /campaign/editCampaign/{campaignid}
POST /campaign/adjustValue
GET /campaign/campaignList
GET /campaign/campaignProducts/{campaign_id}
Edit campaign
POST /campaign/editCampaign/{campaignid}

Path variables

campaignid
string required

id of the campaign to edit

Request headers

token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Accept
string optional

For json response use application/json

Example:
application/json

Request body

application/x-www-form-urlencoded
application/json
Object
hash
string required

HMAC hash of the request values Read more

name
string

New name of the campaign

cardgroup
integer

valid id of the new cardgroup for the campaign

Example:
12
free_msg
boolean
Example:
false
free_split
boolean
Example:
false
auto_add
boolean
Example:
false
info_view
boolean
Example:
false
active
boolean

Whether the campaign is active or not

Example:
true
whitelist
Array of integer

List of company id the campaign can be use on, if no company id is set it runs on all in the concern

Example:
[1, 2]
remove_from_whitelist
Array of integer

List of company id to remove from whitelist

Example:
[1, 2]

Responses

200 OK

JSON Success

Body
Object
status
string
Example:
Campaign 30 successfully updated!
200 ERROR

JSON Error

Body
Object
ERROR
string
Example:
cardgroup is invalid!
Example 1
GET https://api.onlinepos.dk/api/campaign/editCampaign/12 HTTP/1.1 

token: <company token>
firmaid: <company id>
Content-Type: application/x-www-form-urlencoded

hash=204c7d7dfd32fde50ffe148f317fa0ab854e834c
&name=
&cardgroup=12
&free_msg=false
&free_split=false
&auto_add=false
&info_view=false
&active=true
Adjust value
POST /campaign/adjustValue

Request headers

token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Accept
string optional

For json response use application/json

Example:
application/json

Request body

application/x-www-form-urlencoded
Object
CardNo
string

The cardnumber of the card to adjust the value of

CardID
string

The rfid of the card to adjust the value of

CampaignID
string

The campaign to adjust the value of the card on

value
string

What value to adjust the card with (positive or negative)

Example:
25, -80

Responses

200 OK

JSON

Example 1
POST https://api.onlinepos.dk/api/campaign/adjustValue HTTP/1.1 

token: <company token>
firmaid: <company id>
Content-Type: application/x-www-form-urlencoded

CardNo=1
&CardID=2
&CampaignID=3
&value=25
List campaigns
GET /campaign/campaignList

Request parameters

show_inactive
integer optional

Whether or not to show inactive campaigns

Default:
0
Example:
1

Request headers

token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Accept
string optional

For json response use application/json

Example:
application/json

Responses

200 OK
Body
Object
Campaigns
Array

List of campaigns

Object
campaign
Object
campaignID
integer

Id of campaign

campaignName
string

Name of campaign

active
integer

whether the campaign is active or not

Example:
1
type
string

The type of the campaign (amount, price, points)

Example:
points
free_split
integer
free_msg
integer
auto_add
integer
info_view
integer
whitelisted_company_ids
Array of string

List of company ids the campaing works on.

Example:
[1,2]
Examples
{
    "Campaigns": [
        {
            "campaign": {
                "campaignID": 1,
                "campaignName": "",
                "active": 1,
                "type": "points",
                "free_split": 1,
                "free_msg": 1,
                "auto_add": 1,
                "info_view": 1
            }
        }
    ]
}
Example 1
GET https://api.onlinepos.dk/api/campaign/campaignList?show_inactive=0 HTTP/1.1 

token: <company token>
firmaid: <company id>

HTTP/1.1 200 OK 

Content-Type: application/json

{
    "Campaigns": [
        {
            "campaign": {
                "campaignID": 1,
                "campaignName": "",
                "active": 1,
                "type": "points",
                "free_split": 1,
                "free_msg": 1,
                "auto_add": 1,
                "info_view": 1
            }
        }
    ]
}
Get campaign products
GET /campaign/campaignProducts/{campaign_id}

Path variables

campaign_id
integer required

The campaign id you wish to look up products for

Request headers

token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Accept
string optional

For json response use application/json

Example:
application/json

Responses

200 OK
Body
Object
reward_products
Array

List of reward products

Object
product_id
integer
Example:
1
product_name
string
Example:
Lille Fadøl
cost
integer

The cost to activate the campaign deal

Example:
1
campaign_price
number

The price of the product after activation

collection_products
Array

list of collection products

Object
product_id
integer
Example:
2
product_name
string
Example:
burger
reward
integer

The reward for buying the product

Examples
{
    "reward_products": [
        {
            "product_id": 1,
            "product_name": "Lille Fadøl",
            "cost": 1,
            "campaign_price": 1
        }
    ],
    "collection_products": [
        {
            "product_id": 2,
            "product_name": "burger",
            "reward": 1
        }
    ]
}
Example 1
GET https://api.onlinepos.dk/api/campaign/campaignProducts/99 HTTP/1.1 

token: <company token>
firmaid: <company id>

HTTP/1.1 200 OK 

Content-Type: application/json

{
    "reward_products": [
        {
            "product_id": 1,
            "product_name": "Lille Fadøl",
            "cost": 1,
            "campaign_price": 1
        }
    ],
    "collection_products": [
        {
            "product_id": 2,
            "product_name": "burger",
            "reward": 1
        }
    ]
}
Offer
GET /offer
POST /offer
PUT /offer/{offer_id}
POST /offer/{offer_id}/add
DELETE /offer/{offer_id}/remove
Get Offer List
GET /offer

Request headers

token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Accept
string optional

For json response use application/json

Example:
application/json

Responses

200 OK
Body
Object
ID
integer
Example:
1700
days
string

Which weekdays the offer is active on

Example:
1,1,1,1,1,1,1
pricegroup
integer
prio
integer
name
string
Example:
0
dayfrom
string
Example:
0001-01-01
dayto
string
Example:
0001-01-01
timefrom
integer
Example:
-10000
timeto
integer
Example:
-10000
content
Array
Object
pid
integer
gid
integer
amount
integer
pris
number
Example:
12.5
Create Offer
POST /offer

Request body

Responses

200 OK

Offer created

401 Unauthorized

Credentials incorrect, lacking permissions

Edit Offer
PUT /offer/{offer_id}

Path variables

offer_id
integer required

The id of the offer you’re editing

Request body

Responses

200 OK

Updated

404 OfferNotFoundResponse

The offer you’re trying to edit does not exist

401 Unauthorized

Credentials incorrect, lacking permissions

Add Offer Line
POST /offer/{offer_id}/add

Path variables

offer_id
string required

Request body

Responses

201 Created
401 Unauthorized

Credentials incorrect, lacking permissions

404 OfferNotFoundResponse

The offer you’re trying to edit does not exist

Remove Offer Line
DELETE /offer/{offer_id}/remove

Path variables

offer_id
string required

Request body

Object
pid
integer
Example:
1234
gid
integer
Example:
5678

Responses

200 OK

Deleted

404 OfferNotFoundResponse

The offer you’re trying to edit does not exist

401 Unauthorized

Credentials incorrect, lacking permissions

OfferParentSchema
Object
name
string required
Example:
Pricegroup Zero
dayfrom
string

The date the offer is valid from, exclude if unlimited

Example:
2021-07-06
dayto
string

The date the offer is valid until, exclude if unlimited

Example:
2021-08-06
days
string

Which days the offer is active on. Comma seperated days from mon-sun

Default:
1,1,1,1,1,1,1
Examples:
1,1,1,1,1,_,_ (weekdays)_,_,_,_,_,1,1 (weekend)
prio
integer

The priority (order) the offer applies, lower numbers are applied first

Example:
3
OfferContentScema

Offer lines, products or product groups, included in this offer

Object
pid
integer

Product ID - Required if gid not specified

Example:
1234
gid
integer

Product Group ID - Required if pid not specified

Example:
5678
price
number

The applied offer price of the product(s)

Example:
12.5
percent
integer

The applied percentage discount of the product(s)

Example:
25
amount
integer

The amount of products to buy, for the offer to activate

Example:
2
OfferSchema
Object
name
string required
Example:
Pricegroup Zero
dayfrom
string

The date the offer is valid from, exclude if unlimited

Example:
2021-07-06
dayto
string

The date the offer is valid until, exclude if unlimited

Example:
2021-08-06
days
string

Which days the offer is active on. Comma seperated days from mon-sun

Default:
1,1,1,1,1,1,1
Examples:
1,1,1,1,1,_,_ (weekdays)_,_,_,_,_,1,1 (weekend)
prio
integer

The priority (order) the offer applies, lower numbers are applied first

Example:
3
content
Stock
GET /stock/getStockComposition
Get Stock Composition
GET /stock/getStockComposition

This call is used for getting the relation between products and stock products

Request parameters

page
integer optional

pagination page

Request headers

token
string required

Unique token from OnlinePOS

firmaid
integer required

Firmaid at OnlinePOS

Accept
string optional

For json response use application/json

Example:
application/json

Responses

200 OK
Body
Object
data
Array

Data for relation between products and stock products

Object
product_id
integer

Id of the product

Example:
143529
stock_ids
Array

The list of stock products related to the product

Object
stock_id
integer

Id of the stock product

Example:
75613
amount
integer

Amount of stock products used with one product

Example:
1
from
integer

First number of product shown

Example:
1
next_page_url
unknown nullable

URL for next page if there is one

per_page
integer

Number of products per page (MAX 5000)

Example:
5000
prev_page_url
unknown nullable

URL for previous page if there is one

to
integer

Last number of product shown

Example:
47
current_page
integer

Current page

Example:
1
status
string

Status of call (OK on success else error)

Example:
OK
Examples
{
    "data": [
        {
            "product_id": 143529,
            "stock_ids": [
                {
                    "stock_id": 75613,
                    "amount": 1
                }
            ]
        }
    ],
    "from": 1,
    "next_page_url": null,
    "per_page": 5000,
    "prev_page_url": null,
    "to": 47,
    "current_page": 1,
    "status": "OK"
}